Skip to content

Commit 969ec74

Browse files
committed
Merge branch 't/12866' into major
2 parents 439339b + 2670bdf commit 969ec74

File tree

4 files changed

+16
-34
lines changed

4 files changed

+16
-34
lines changed

plugins/notification/plugin.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ CKEDITOR.plugins.add( 'notification', {
2222
* @param {String} message Message displayed on the notification.
2323
* @param {String} [type='info'] Type of the notification. Can be `'info'`, `'warning'`, `'success'` or `'progress'`.
2424
* @param {Number} [progressOrDuration] If the type is `progress` the third parameter may be a progress from `0` to `1`
25-
* (defaults to `0`). Otherwise the the third parameter may be a notification duration: how many milliseconds after the
26-
* next change event notification should be closed automatically. `0` means that notification will not be closed
27-
* automatically, user needs to close it manually. See {@link CKEDITOR.plugins.notification#duration}.
25+
* (defaults to `0`). Otherwise the the third parameter may be a notification duration: after how many milliseconds
26+
* notification should be closed automatically. `0` means that notification will not be closed automatically, user
27+
* needs to close it manually. See {@link CKEDITOR.plugins.notification#duration}.
28+
* Note that `warning` notifications will not be closed automatically.
2829
* @returns {CKEDITOR.plugins.notification} Created and shown notification.
2930
*/
3031
editor.showNotification = function( message, type, progressOrDuration ) {
@@ -172,8 +173,7 @@ function Notification( editor, options ) {
172173
*/
173174

174175
/**
175-
* Notification duration. Determines how many milliseconds after the next {@link CKEDITOR.editor#change} event
176-
* the notification should be closed automatically.
176+
* Notification duration. Determines after how many milliseconds notification should be closed automatically.
177177
* 0 means that notification will not be closed automatically, user needs to close it manually.
178178
* By default it is 0 for `warning` and `progress`. For `info` and `success` value it is the of
179179
* {@link CKEDITOR.config#notification_duration notification_duration} configuration option or 5000 if not set.
@@ -389,7 +389,7 @@ Notification.prototype = {
389389
},
390390

391391
/**
392-
* Hides notification after the timeout after the first change event.
392+
* Hides notification after the timeout.
393393
*
394394
* @private
395395
*/
@@ -410,11 +410,9 @@ Notification.prototype = {
410410
}
411411

412412
if ( duration ) {
413-
this.editor.once( 'change', function() {
414-
notification._hideTimeoutId = setTimeout( function() {
415-
notification.hide();
416-
}, duration );
417-
} );
413+
notification._hideTimeoutId = setTimeout( function() {
414+
notification.hide();
415+
}, duration );
418416
}
419417
}
420418
};
@@ -846,7 +844,7 @@ Area.prototype = {
846844
CKEDITOR.plugins.notification = Notification;
847845

848846
/**
849-
* How many milliseconds after the {@link CKEDITOR.editor#change} event notifications of the `info` and `success`
847+
* After how many milliseconds the notification of the `info` and `success`
850848
* {@link CKEDITOR.plugins.notification#type type} should be closed automatically.
851849
* `0` means that notifications will not be closed automatically.
852850
* Note that `warning` and `progress` notifications will not be closed automatically.

tests/plugins/notification/manual/classic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
* Play with notification using buttons.
77
* Using scroll, check if position of notification is correct.
88

9-
**Note:** `info` and `success` notifications should close automatically 5 sec after `change` event or on `ESC` key if editor is focused.
9+
**Note:** `info` and `success` notifications should close automatically after 5 sec or on `ESC` key if editor is focused.
1010

1111
**Note:** if you close notification it will be shown again if update is important.

tests/plugins/notification/manual/inline.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
* Play with notification using buttons.
77
* Using scroll, check if position of notification is correct.
88

9-
**Note:** `info` and `success` notifications should close automatically 5 sec after `change` event or on `ESC` key if editor is focused.
9+
**Note:** `info` and `success` notifications should close automatically after 5 sec or on `ESC` key if editor is focused.
1010

1111
**Note:** if you close notification it will be shown again if update is important.

tests/plugins/notification/notification.js

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ bender.test( {
129129
assert.isFalse( notification.isVisible(), 'After hide' );
130130
},
131131

132-
'test close after change - info': function() {
132+
'test close after timeout - info': function() {
133133
var editor = this.editor,
134134
notification = new CKEDITOR.plugins.notification( editor, { message: 'Foo', type: 'info', duration: 100 } );
135135

@@ -143,16 +143,10 @@ bender.test( {
143143

144144
this.clock.tick( 110 );
145145

146-
assertNotifications( editor, [ { message: 'Foo', type: 'info', duration: 100 } ] );
147-
148-
editor.fire( 'change' );
149-
150-
this.clock.tick( 110 );
151-
152146
assertNotifications( editor, [] );
153147
},
154148

155-
'test close after change - warning': function() {
149+
'test close after timeout - warning': function() {
156150
var editor = this.editor,
157151
notification = new CKEDITOR.plugins.notification( editor, { message: 'Foo', type: 'warning' } );
158152

@@ -167,15 +161,9 @@ bender.test( {
167161
this.clock.tick( 110 );
168162

169163
assertNotifications( editor, [ { message: 'Foo', type: 'warning' } ] );
170-
171-
editor.fire( 'change' );
172-
173-
this.clock.tick( 110 );
174-
175-
assertNotifications( editor, [ { message: 'Foo', type: 'warning' } ] );
176164
},
177165

178-
'test close after change - default value': function() {
166+
'test close after timeout - default value': function() {
179167
var tc = this;
180168

181169
bender.editorBot.create( {
@@ -193,8 +181,6 @@ bender.test( {
193181

194182
notification.show();
195183

196-
editor.fire( 'change' );
197-
198184
assertNotifications( editor, [ { message: 'Foo', type: 'info', alert: true } ] );
199185

200186
tc.clock.tick( 4900 );
@@ -215,8 +201,6 @@ bender.test( {
215201

216202
notification.show();
217203

218-
editor.fire( 'change' );
219-
220204
notification.update( { type: 'warning' } );
221205

222206
this.clock.tick( 110 );
@@ -249,7 +233,7 @@ bender.test( {
249233

250234
assertNotifications( editor, [ { message: 'Foo', type: 'warning' } ] );
251235

252-
editor.fire( 'key', { keyCode: 27 /* ESC */ } );
236+
editor.fire( 'key', { keyCode: 27 } ); /* ESC */
253237

254238
assertNotifications( editor, [] );
255239

0 commit comments

Comments
 (0)