Skip to content
Permalink
Browse files

Merge branch 't/12866' into major

  • Loading branch information...
Reinmar committed Feb 12, 2015
2 parents 439339b + 2670bdf commit 969ec7482f8f5282317357061c6bed69b1b677a1
@@ -22,9 +22,10 @@ CKEDITOR.plugins.add( 'notification', {
* @param {String} message Message displayed on the notification.
* @param {String} [type='info'] Type of the notification. Can be `'info'`, `'warning'`, `'success'` or `'progress'`.
* @param {Number} [progressOrDuration] If the type is `progress` the third parameter may be a progress from `0` to `1`
* (defaults to `0`). Otherwise the the third parameter may be a notification duration: how many milliseconds after the
* next change event notification should be closed automatically. `0` means that notification will not be closed
* automatically, user needs to close it manually. See {@link CKEDITOR.plugins.notification#duration}.
* (defaults to `0`). Otherwise the the third parameter may be a notification duration: after how many milliseconds
* notification should be closed automatically. `0` means that notification will not be closed automatically, user
* needs to close it manually. See {@link CKEDITOR.plugins.notification#duration}.
* Note that `warning` notifications will not be closed automatically.
* @returns {CKEDITOR.plugins.notification} Created and shown notification.
*/
editor.showNotification = function( message, type, progressOrDuration ) {
@@ -172,8 +173,7 @@ function Notification( editor, options ) {
*/

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

/**
* Hides notification after the timeout after the first change event.
* Hides notification after the timeout.
*
* @private
*/
@@ -410,11 +410,9 @@ Notification.prototype = {
}

if ( duration ) {
this.editor.once( 'change', function() {
notification._hideTimeoutId = setTimeout( function() {
notification.hide();
}, duration );
} );
notification._hideTimeoutId = setTimeout( function() {
notification.hide();
}, duration );
}
}
};
@@ -846,7 +844,7 @@ Area.prototype = {
CKEDITOR.plugins.notification = Notification;

/**
* How many milliseconds after the {@link CKEDITOR.editor#change} event notifications of the `info` and `success`
* After how many milliseconds the notification of the `info` and `success`
* {@link CKEDITOR.plugins.notification#type type} should be closed automatically.
* `0` means that notifications will not be closed automatically.
* Note that `warning` and `progress` notifications will not be closed automatically.
@@ -6,6 +6,6 @@
* Play with notification using buttons.
* Using scroll, check if position of notification is correct.
**Note:** `info` and `success` notifications should close automatically 5 sec after `change` event or on `ESC` key if editor is focused.
**Note:** `info` and `success` notifications should close automatically after 5 sec or on `ESC` key if editor is focused.
**Note:** if you close notification it will be shown again if update is important.
@@ -6,6 +6,6 @@
* Play with notification using buttons.
* Using scroll, check if position of notification is correct.
**Note:** `info` and `success` notifications should close automatically 5 sec after `change` event or on `ESC` key if editor is focused.
**Note:** `info` and `success` notifications should close automatically after 5 sec or on `ESC` key if editor is focused.
**Note:** if you close notification it will be shown again if update is important.
@@ -129,7 +129,7 @@ bender.test( {
assert.isFalse( notification.isVisible(), 'After hide' );
},

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

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

this.clock.tick( 110 );

assertNotifications( editor, [ { message: 'Foo', type: 'info', duration: 100 } ] );

editor.fire( 'change' );

this.clock.tick( 110 );

assertNotifications( editor, [] );
},

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

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

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

editor.fire( 'change' );

this.clock.tick( 110 );

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

'test close after change - default value': function() {
'test close after timeout - default value': function() {
var tc = this;

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

notification.show();

editor.fire( 'change' );

assertNotifications( editor, [ { message: 'Foo', type: 'info', alert: true } ] );

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

notification.show();

editor.fire( 'change' );

notification.update( { type: 'warning' } );

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

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

editor.fire( 'key', { keyCode: 27 /* ESC */ } );
editor.fire( 'key', { keyCode: 27 } ); /* ESC */

assertNotifications( editor, [] );

0 comments on commit 969ec74

Please sign in to comment.
You can’t perform that action at this time.