Skip to content

Commit

Permalink
Merge branch 't/13114'
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Mar 31, 2015
2 parents 47c320f + e7255ee commit 7c2d0b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
7 changes: 5 additions & 2 deletions plugins/dialog/plugin.js
Expand Up @@ -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 ) {
Expand Down
13 changes: 4 additions & 9 deletions tests/plugins/dialog/beforeunload.js
Expand Up @@ -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.' );
} );
} );
} );
Expand Down

0 comments on commit 7c2d0b5

Please sign in to comment.