Skip to content
Permalink
Browse files

Merge branch 't/13114'

  • Loading branch information...
Reinmar committed Mar 31, 2015
2 parents 47c320f + e7255ee commit 7c2d0b5af3cfb0112909e40a09e43dc316104506
Showing with 9 additions and 11 deletions.
  1. +5 −2 plugins/dialog/plugin.js
  2. +4 −9 tests/plugins/dialog/beforeunload.js
@@ -565,12 +565,15 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
// to allow dynamic tab order happen in dialog definition.
setupFocus();

if ( editor.config.dialog_startupFocusTab && me._.pageCount > 1 ) {
var hasTabs = me._.pageCount > 1;

if ( editor.config.dialog_startupFocusTab && hasTabs ) {
me._.tabBarMode = true;
me._.tabs[ me._.currentTabId ][ 0 ].focus();
me._.currentFocusIndex = -1;
} else if ( !this._.hasFocus ) {
this._.currentFocusIndex = -1;
// http://dev.ckeditor.com/ticket/13114#comment:4.
this._.currentFocusIndex = hasTabs ? -1 : this._.focusList.length - 1;

// Decide where to put the initial focus.
if ( definition.onFocus ) {
@@ -24,21 +24,16 @@
// #9958
bender.test( {
'test ok button': function() {
var counter = 0;

window.onbeforeunload = function() {
counter++;
};
window.onbeforeunload = sinon.spy();

this.editor.openDialog( 'testDialog', function( dialog ) {
dialog.on( 'show', function() {
var doc = new CKEDITOR.dom.document( document ),
ok = doc.getById( dialog.getButton( 'ok' ).domId ).$;
var okButton = dialog.getButton( 'ok' ).getInputElement();

ok.click();
okButton.$.click();

resume( function() {
assert.areSame( 0, counter, 'Event onbeforeunload should not be fired.' );
assert.areSame( 0, window.onbeforeunload.callCount, 'Event onbeforeunload should not be fired.' );
} );
} );
} );

0 comments on commit 7c2d0b5

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