Skip to content

Commit 85a9d3e

Browse files
committed
Corrected notification aggregator method names. Fixes #12947.
1 parent f887b79 commit 85a9d3e

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

plugins/notificationaggregator/plugin.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@
226226
*/
227227
getPercentage: function() {
228228
// In case there are no weights at all we'll return 1.
229-
if ( this.getTasksCount() === 0 ) {
229+
if ( this.getTaskCount() === 0 ) {
230230
return 1;
231231
}
232232

@@ -238,20 +238,20 @@
238238
* (or there are no tasks at all).
239239
*/
240240
isFinished: function() {
241-
return this.getDoneTasksCount() === this.getTasksCount();
241+
return this.getDoneTaskCount() === this.getTaskCount();
242242
},
243243

244244
/**
245245
* @returns {Number} Returns a total tasks count.
246246
*/
247-
getTasksCount: function() {
247+
getTaskCount: function() {
248248
return this._tasks.length;
249249
},
250250

251251
/**
252252
* @returns {Number} Returns the number of done tasks.
253253
*/
254-
getDoneTasksCount: function() {
254+
getDoneTaskCount: function() {
255255
return this._doneTasks;
256256
},
257257

@@ -274,8 +274,8 @@
274274
* @returns {String}
275275
*/
276276
_getNotificationMessage: function() {
277-
var tasksCount = this.getTasksCount(),
278-
doneTasks = this.getDoneTasksCount(),
277+
var tasksCount = this.getTaskCount(),
278+
doneTasks = this.getDoneTaskCount(),
279279
templateParams = {
280280
current: doneTasks,
281281
max: tasksCount,
@@ -474,7 +474,7 @@
474474
* Fired when all tasks are done. On this event notification may change type to success or be hidden:
475475
*
476476
* aggregator.on( 'finished', function() {
477-
* if ( aggregator.getTasksCount() == 0 ) {
477+
* if ( aggregator.getTaskCount() == 0 ) {
478478
* aggregator.notification.hide();
479479
* } else {
480480
* aggregator.notification.update( { message: 'Done', type: 'success' } );

plugins/uploadwidget/plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@
448448
editor, editor.lang.uploadwidget.uploadMany, editor.lang.uploadwidget.uploadOne );
449449

450450
aggregator.once( 'finished', function() {
451-
var tasks = aggregator.getTasksCount();
451+
var tasks = aggregator.getTaskCount();
452452

453453
if ( tasks === 0 ) {
454454
aggregator.notification.hide();

tests/plugins/notificationaggregator/aggregator.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -133,44 +133,44 @@
133133
'test getPercentage empty': function() {
134134
var instance = new Aggregator( this.editor, '' );
135135

136-
instance.getTasksCount = sinon.stub().returns( 0 );
136+
instance.getTaskCount = sinon.stub().returns( 0 );
137137

138138
assert.areSame( 1, instance.getPercentage(), 'Invalid return value' );
139139
},
140140

141141
'test isFinished': function() {
142142
var instance = new Aggregator( this.editor, '' );
143-
instance.getDoneTasksCount = sinon.stub().returns( 2 );
144-
instance.getTasksCount = sinon.stub().returns( 2 );
143+
instance.getDoneTaskCount = sinon.stub().returns( 2 );
144+
instance.getTaskCount = sinon.stub().returns( 2 );
145145
assert.isTrue( instance.isFinished(), 'Return value' );
146146
},
147147

148148
'test isFinished falsy': function() {
149149
var instance = new Aggregator( this.editor, '' );
150-
instance.getDoneTasksCount = sinon.stub().returns( 1 );
151-
instance.getTasksCount = sinon.stub().returns( 2 );
150+
instance.getDoneTaskCount = sinon.stub().returns( 1 );
151+
instance.getTaskCount = sinon.stub().returns( 2 );
152152
assert.isFalse( instance.isFinished(), 'Return value' );
153153
},
154154

155155
'test isFinished empty': function() {
156156
var instance = new Aggregator( this.editor, '' );
157-
instance.getDoneTasksCount = sinon.stub().returns( 0 );
158-
instance.getTasksCount = sinon.stub().returns( 0 );
157+
instance.getDoneTaskCount = sinon.stub().returns( 0 );
158+
instance.getTaskCount = sinon.stub().returns( 0 );
159159
assert.isTrue( instance.isFinished(), 'Return value' );
160160
},
161161

162-
'test getTasksCount': function() {
162+
'test getTaskCount': function() {
163163
var instance = new Aggregator( this.editor, '' );
164164
instance._tasks = [ 0, 0 ];
165165

166-
assert.areSame( 2, instance.getTasksCount() );
166+
assert.areSame( 2, instance.getTaskCount() );
167167
},
168168

169-
'test getDoneTasksCount': function() {
169+
'test getDoneTaskCount': function() {
170170
var instance = new Aggregator( this.editor, '' );
171171
instance._doneTasks = 3;
172172

173-
assert.areSame( 3, instance.getDoneTasksCount() );
173+
assert.areSame( 3, instance.getDoneTaskCount() );
174174
},
175175

176176
'test _addTask': function() {
@@ -254,8 +254,8 @@
254254
'test _updateNotification notification call': function() {
255255
var instance = new Aggregator( this.editor, '' );
256256
instance._message.output = sinon.stub().returns( 'foo' );
257-
instance.getDoneTasksCount = sinon.stub().returns( 1 );
258-
instance.getTasksCount = sinon.stub().returns( 4 );
257+
instance.getDoneTaskCount = sinon.stub().returns( 1 );
258+
instance.getTaskCount = sinon.stub().returns( 4 );
259259
instance.getPercentage = sinon.stub().returns( 0.25 );
260260
instance.notification = new NotificationMock();
261261

@@ -318,8 +318,8 @@
318318
instance._message = {
319319
output: sinon.stub().returns( 'foo' )
320320
};
321-
instance.getTasksCount = sinon.stub().returns( 4 );
322-
instance.getDoneTasksCount = sinon.stub().returns( 1 );
321+
instance.getTaskCount = sinon.stub().returns( 4 );
322+
instance.getDoneTaskCount = sinon.stub().returns( 1 );
323323
instance.getPercentage = sinon.stub().returns( 0.25 );
324324

325325
assert.areSame( 'foo', instance._getNotificationMessage() );
@@ -337,8 +337,8 @@
337337
instance._singularMessage = {
338338
output: sinon.stub().returns( 'bar' )
339339
};
340-
instance.getTasksCount = sinon.stub().returns( 1 );
341-
instance.getDoneTasksCount = sinon.stub().returns( 0 );
340+
instance.getTaskCount = sinon.stub().returns( 1 );
341+
instance.getDoneTaskCount = sinon.stub().returns( 0 );
342342
instance.getPercentage = sinon.stub().returns( 0.2 );
343343

344344
assert.areSame( 'bar', instance._getNotificationMessage() );
@@ -354,8 +354,8 @@
354354
'test _getNotificationMessage plural message even if single message defined': function() {
355355
var instance = new Aggregator( this.editor, 'foo', 'bar' );
356356

357-
instance.getTasksCount = sinon.stub().returns( 2 );
358-
instance.getDoneTasksCount = sinon.stub().returns( 1 );
357+
instance.getTaskCount = sinon.stub().returns( 2 );
358+
instance.getDoneTaskCount = sinon.stub().returns( 1 );
359359

360360
assert.areSame( 'foo', instance._getNotificationMessage() );
361361
},
@@ -364,8 +364,8 @@
364364
// defined, the standard message is used.
365365
'test _getNotificationMessage missing singular': function() {
366366
var instance = new Aggregator( this.editor, 'foo' );
367-
instance.getTasksCount = sinon.stub().returns( 1 );
368-
instance.getDoneTasksCount = sinon.stub().returns( 0 );
367+
instance.getTaskCount = sinon.stub().returns( 1 );
368+
instance.getDoneTaskCount = sinon.stub().returns( 0 );
369369

370370
assert.areSame( 'foo', instance._getNotificationMessage() );
371371
},

0 commit comments

Comments
 (0)