2015-04-07 00:23:50 +00:00
|
|
|
define( [
|
2016-04-03 16:10:09 +00:00
|
|
|
"qunit",
|
2015-04-07 00:23:50 +00:00
|
|
|
"jquery",
|
2015-07-15 01:59:10 +00:00
|
|
|
"ui/widgets/dialog"
|
2016-04-03 16:10:09 +00:00
|
|
|
], function( QUnit, $ ) {
|
2009-02-02 14:36:08 +00:00
|
|
|
|
2013-11-16 11:21:02 +00:00
|
|
|
// TODO add teardown callback to remove dialogs
|
2016-04-03 16:10:09 +00:00
|
|
|
QUnit.module( "dialog: core" );
|
2009-02-02 14:36:08 +00:00
|
|
|
|
2016-04-03 16:10:09 +00:00
|
|
|
QUnit.test( "markup structure", function( assert ) {
|
|
|
|
assert.expect( 11 );
|
2014-12-03 16:23:59 +00:00
|
|
|
|
2015-08-24 12:59:54 +00:00
|
|
|
var element = $( "<div>" ).dialog( {
|
2014-12-03 16:23:59 +00:00
|
|
|
buttons: [ {
|
|
|
|
text: "Ok",
|
|
|
|
click: $.noop
|
|
|
|
} ]
|
2015-08-24 12:59:54 +00:00
|
|
|
} ),
|
2014-12-03 16:23:59 +00:00
|
|
|
widget = element.dialog( "widget" ),
|
|
|
|
titlebar = widget.find( ".ui-dialog-titlebar" ),
|
|
|
|
title = titlebar.find( ".ui-dialog-title" ),
|
|
|
|
close = titlebar.find( ".ui-dialog-titlebar-close" ),
|
|
|
|
buttonpane = widget.find( ".ui-dialog-buttonpane" ),
|
|
|
|
buttonset = widget.find( ".ui-dialog-buttonset" ),
|
|
|
|
buttons = buttonset.find( ".ui-button" );
|
|
|
|
|
|
|
|
assert.hasClasses( widget, "ui-dialog ui-dialog-buttons ui-widget ui-widget-content" );
|
|
|
|
assert.hasClasses( titlebar, "ui-dialog-titlebar ui-widget-header" );
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.equal( titlebar.length, 1, "Dialog has exactly one titlebar" );
|
2014-12-03 16:23:59 +00:00
|
|
|
assert.hasClasses( close, "ui-dialog-titlebar-close ui-widget" );
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.equal( close.length, 1, "Titlebar has exactly one close button" );
|
|
|
|
assert.equal( title.length, 1, "Titlebar has exactly one title" );
|
2014-12-03 16:23:59 +00:00
|
|
|
assert.hasClasses( element, "ui-dialog-content ui-widget-content" );
|
|
|
|
assert.hasClasses( buttonpane, "ui-dialog-buttonpane ui-widget-content" );
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.equal( buttonpane.length, 1, "Dialog has exactly one buttonpane" );
|
|
|
|
assert.equal( buttonset.length, 1, "Buttonpane has exactly one buttonset" );
|
|
|
|
assert.equal( buttons.length, 1, "Buttonset contains exactly 1 button when created with 1" );
|
2014-12-03 16:23:59 +00:00
|
|
|
|
2015-08-24 12:59:54 +00:00
|
|
|
} );
|
2014-12-03 16:23:59 +00:00
|
|
|
|
2016-04-03 16:10:09 +00:00
|
|
|
QUnit.test( "markup structure - no buttons", function( assert ) {
|
|
|
|
assert.expect( 7 );
|
2014-12-03 16:23:59 +00:00
|
|
|
|
|
|
|
var element = $( "<div>" ).dialog(),
|
|
|
|
widget = element.dialog( "widget" ),
|
|
|
|
titlebar = widget.find( ".ui-dialog-titlebar" ),
|
|
|
|
title = titlebar.find( ".ui-dialog-title" ),
|
|
|
|
close = titlebar.find( ".ui-dialog-titlebar-close" );
|
|
|
|
|
|
|
|
assert.hasClasses( widget, "ui-dialog ui-widget ui-widget-content" );
|
|
|
|
assert.hasClasses( titlebar, "ui-dialog-titlebar ui-widget-header" );
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.equal( titlebar.length, 1, "Dialog has exactly one titlebar" );
|
2014-12-03 16:23:59 +00:00
|
|
|
assert.hasClasses( close, "ui-dialog-titlebar-close ui-widget" );
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.equal( close.length, 1, "Titlebar has exactly one close button" );
|
|
|
|
assert.equal( title.length, 1, "Titlebar has exactly one title" );
|
2014-12-03 16:23:59 +00:00
|
|
|
assert.hasClasses( element, "ui-dialog-content ui-widget-content" );
|
2015-08-24 12:59:54 +00:00
|
|
|
} );
|
2014-12-03 16:23:59 +00:00
|
|
|
|
2016-04-03 16:10:09 +00:00
|
|
|
QUnit.test( "title id", function( assert ) {
|
|
|
|
assert.expect( 1 );
|
2009-02-04 04:35:18 +00:00
|
|
|
|
2012-11-03 20:17:16 +00:00
|
|
|
var titleId,
|
2015-08-24 12:59:54 +00:00
|
|
|
element = $( "<div>" ).dialog();
|
2012-11-03 20:17:16 +00:00
|
|
|
|
2015-08-24 12:59:54 +00:00
|
|
|
titleId = element.dialog( "widget" ).find( ".ui-dialog-title" ).attr( "id" );
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.ok( /ui-id-\d+$/.test( titleId ), "auto-numbered title id" );
|
2013-01-31 05:38:20 +00:00
|
|
|
element.remove();
|
2015-08-24 12:59:54 +00:00
|
|
|
} );
|
2009-02-04 04:35:18 +00:00
|
|
|
|
2016-04-03 16:10:09 +00:00
|
|
|
QUnit.test( "ARIA", function( assert ) {
|
|
|
|
assert.expect( 4 );
|
2012-11-17 12:23:57 +00:00
|
|
|
|
2014-12-03 16:23:59 +00:00
|
|
|
var element = $( "<div>" ).dialog(),
|
2013-01-31 05:38:20 +00:00
|
|
|
wrapper = element.dialog( "widget" );
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.equal( wrapper.attr( "role" ), "dialog", "dialog role" );
|
|
|
|
assert.equal( wrapper.attr( "aria-labelledby" ), wrapper.find( ".ui-dialog-title" ).attr( "id" ) );
|
|
|
|
assert.equal( wrapper.attr( "aria-describedby" ), element.attr( "id" ), "aria-describedby added" );
|
2013-01-31 05:38:20 +00:00
|
|
|
element.remove();
|
2009-02-04 04:35:18 +00:00
|
|
|
|
2015-08-24 12:59:54 +00:00
|
|
|
element = $( "<div><div aria-describedby='section2'><p id='section2'>descriotion</p></div></div>" ).dialog();
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.equal( element.dialog( "widget" ).attr( "aria-describedby" ), null, "no aria-describedby added, as already present in markup" );
|
2013-01-31 05:38:20 +00:00
|
|
|
element.remove();
|
2015-08-24 12:59:54 +00:00
|
|
|
} );
|
2009-02-02 14:36:08 +00:00
|
|
|
|
2016-04-03 16:10:09 +00:00
|
|
|
QUnit.test( "widget method", function( assert ) {
|
|
|
|
assert.expect( 1 );
|
2015-08-24 12:59:54 +00:00
|
|
|
var dialog = $( "<div>" ).appendTo( "#qunit-fixture" ).dialog();
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.deepEqual( dialog.parent()[ 0 ], dialog.dialog( "widget" )[ 0 ] );
|
2012-12-08 18:19:36 +00:00
|
|
|
dialog.remove();
|
2015-08-24 12:59:54 +00:00
|
|
|
} );
|
2010-01-07 03:19:50 +00:00
|
|
|
|
2016-04-03 16:10:09 +00:00
|
|
|
QUnit.test( "focus tabbable", function( assert ) {
|
|
|
|
var ready = assert.async();
|
|
|
|
assert.expect( 8 );
|
2013-01-31 05:38:20 +00:00
|
|
|
var element,
|
2012-11-16 19:24:57 +00:00
|
|
|
options = {
|
2015-08-24 12:59:54 +00:00
|
|
|
buttons: [ {
|
2012-11-16 19:24:57 +00:00
|
|
|
text: "Ok",
|
|
|
|
click: $.noop
|
2015-08-24 12:59:54 +00:00
|
|
|
} ]
|
2012-11-16 19:24:57 +00:00
|
|
|
};
|
|
|
|
|
2012-12-10 20:31:56 +00:00
|
|
|
function checkFocus( markup, options, testFn, next ) {
|
2013-10-02 15:27:43 +00:00
|
|
|
|
|
|
|
// Support: IE8
|
|
|
|
// For some reason the focus doesn't get set properly if we don't
|
|
|
|
// focus the body first.
|
2015-05-14 01:57:04 +00:00
|
|
|
$( "body" ).trigger( "focus" );
|
2013-10-02 15:27:43 +00:00
|
|
|
|
2013-01-31 05:38:20 +00:00
|
|
|
element = $( markup ).dialog( options );
|
2015-08-24 12:59:54 +00:00
|
|
|
setTimeout( function() {
|
|
|
|
testFn( function done() {
|
2015-03-10 19:16:27 +00:00
|
|
|
element.remove();
|
|
|
|
setTimeout( next );
|
2015-08-24 12:59:54 +00:00
|
|
|
} );
|
|
|
|
} );
|
2012-12-10 20:31:56 +00:00
|
|
|
}
|
2012-11-16 19:24:57 +00:00
|
|
|
|
2012-12-10 20:31:56 +00:00
|
|
|
function step1() {
|
2015-03-10 19:16:27 +00:00
|
|
|
checkFocus( "<div><input><input></div>", options, function( done ) {
|
2015-05-14 01:57:04 +00:00
|
|
|
var input = element.find( "input:last" ).trigger( "focus" ).trigger( "blur" );
|
2013-10-02 15:27:43 +00:00
|
|
|
element.dialog( "instance" )._focusTabbable();
|
2015-08-24 12:59:54 +00:00
|
|
|
setTimeout( function() {
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.equal( document.activeElement, input[ 0 ],
|
2013-10-02 15:27:43 +00:00
|
|
|
"1. an element that was focused previously." );
|
2015-03-10 19:16:27 +00:00
|
|
|
done();
|
2015-08-24 12:59:54 +00:00
|
|
|
} );
|
2015-03-10 19:16:27 +00:00
|
|
|
}, step2 );
|
2013-10-02 15:27:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function step2() {
|
2015-03-10 19:16:27 +00:00
|
|
|
checkFocus( "<div><input><input autofocus></div>", options, function( done ) {
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.equal( document.activeElement, element.find( "input" )[ 1 ],
|
2013-10-02 15:27:43 +00:00
|
|
|
"2. first element inside the dialog matching [autofocus]" );
|
2015-03-10 19:16:27 +00:00
|
|
|
done();
|
2013-10-02 15:27:43 +00:00
|
|
|
}, step3 );
|
2012-12-10 20:31:56 +00:00
|
|
|
}
|
2012-11-17 17:04:10 +00:00
|
|
|
|
2013-10-02 15:27:43 +00:00
|
|
|
function step3() {
|
2015-03-10 19:16:27 +00:00
|
|
|
checkFocus( "<div><input><input></div>", options, function( done ) {
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.equal( document.activeElement, element.find( "input" )[ 0 ],
|
2013-10-02 15:27:43 +00:00
|
|
|
"3. tabbable element inside the content element" );
|
2015-03-10 19:16:27 +00:00
|
|
|
done();
|
2013-10-02 15:27:43 +00:00
|
|
|
}, step4 );
|
2012-12-10 20:31:56 +00:00
|
|
|
}
|
2012-11-17 17:04:10 +00:00
|
|
|
|
2013-10-02 15:27:43 +00:00
|
|
|
function step4() {
|
2015-03-10 19:16:27 +00:00
|
|
|
checkFocus( "<div>text</div>", options, function( done ) {
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.equal( document.activeElement,
|
2013-01-31 05:38:20 +00:00
|
|
|
element.dialog( "widget" ).find( ".ui-dialog-buttonpane button" )[ 0 ],
|
2013-10-02 15:27:43 +00:00
|
|
|
"4. tabbable element inside the buttonpane" );
|
2015-03-10 19:16:27 +00:00
|
|
|
done();
|
2013-10-02 15:27:43 +00:00
|
|
|
}, step5 );
|
2012-12-10 20:31:56 +00:00
|
|
|
}
|
|
|
|
|
2013-10-02 15:27:43 +00:00
|
|
|
function step5() {
|
2015-03-10 19:16:27 +00:00
|
|
|
checkFocus( "<div>text</div>", {}, function( done ) {
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.equal( document.activeElement,
|
2013-01-31 05:38:20 +00:00
|
|
|
element.dialog( "widget" ).find( ".ui-dialog-titlebar .ui-dialog-titlebar-close" )[ 0 ],
|
2013-10-02 15:27:43 +00:00
|
|
|
"5. the close button" );
|
2015-03-10 19:16:27 +00:00
|
|
|
done();
|
2013-10-02 15:27:43 +00:00
|
|
|
}, step6 );
|
2012-12-10 20:31:56 +00:00
|
|
|
}
|
2012-11-17 17:04:10 +00:00
|
|
|
|
2013-10-02 15:27:43 +00:00
|
|
|
function step6() {
|
2015-03-10 19:16:27 +00:00
|
|
|
checkFocus( "<div>text</div>", { autoOpen: false }, function( done ) {
|
|
|
|
element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).hide();
|
|
|
|
element.dialog( "open" );
|
2015-08-24 12:59:54 +00:00
|
|
|
setTimeout( function() {
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.equal( document.activeElement, element.parent()[ 0 ], "6. the dialog itself" );
|
2015-03-10 19:16:27 +00:00
|
|
|
done();
|
2015-08-24 12:59:54 +00:00
|
|
|
} );
|
2015-03-10 19:16:27 +00:00
|
|
|
}, step7 );
|
2014-06-10 11:51:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function step7() {
|
2015-03-10 19:16:27 +00:00
|
|
|
checkFocus(
|
|
|
|
"<div><input><input autofocus></div>",
|
|
|
|
{
|
|
|
|
open: function() {
|
|
|
|
var inputs = $( this ).find( "input" );
|
2015-08-24 12:59:54 +00:00
|
|
|
inputs.last().on( "keydown", function( event ) {
|
2015-03-10 19:16:27 +00:00
|
|
|
event.preventDefault();
|
2015-05-14 01:57:04 +00:00
|
|
|
inputs.first().trigger( "focus" );
|
2015-08-24 12:59:54 +00:00
|
|
|
} );
|
2015-03-10 19:16:27 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
function( done ) {
|
2016-04-03 16:10:09 +00:00
|
|
|
var inputs = element.find( "input"
|
|
|
|
);
|
|
|
|
assert.equal
|
|
|
|
( document.activeElement, inputs[ 1 ], "Focus starts on second input" );
|
2015-08-24 12:59:54 +00:00
|
|
|
inputs.last().simulate( "keydown", { keyCode: $.ui.keyCode.TAB } );
|
|
|
|
setTimeout( function() {
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.equal( document.activeElement, inputs[ 0 ],
|
2015-03-10 19:16:27 +00:00
|
|
|
"Honor preventDefault, allowing custom focus management" );
|
|
|
|
done();
|
|
|
|
}, 50 );
|
|
|
|
},
|
2016-04-03 16:10:09 +00:00
|
|
|
ready
|
2015-03-10 19:16:27 +00:00
|
|
|
);
|
2012-12-10 20:31:56 +00:00
|
|
|
}
|
2012-11-17 17:04:10 +00:00
|
|
|
|
2012-12-10 20:31:56 +00:00
|
|
|
step1();
|
2015-08-24 12:59:54 +00:00
|
|
|
} );
|
2012-11-16 19:24:57 +00:00
|
|
|
|
2016-04-03 16:10:09 +00:00
|
|
|
QUnit.test( "#7960: resizable handles below modal overlays", function( assert ) {
|
|
|
|
assert.expect( 1 );
|
2012-11-26 21:27:18 +00:00
|
|
|
|
|
|
|
var resizable = $( "<div>" ).resizable(),
|
2015-08-24 12:59:54 +00:00
|
|
|
dialog = $( "<div>" ).dialog( { modal: true } ),
|
2012-11-26 21:27:18 +00:00
|
|
|
resizableZindex = parseInt( resizable.find( ".ui-resizable-handle" ).css( "zIndex" ), 10 ),
|
|
|
|
overlayZindex = parseInt( $( ".ui-widget-overlay" ).css( "zIndex" ), 10 );
|
|
|
|
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.ok( resizableZindex < overlayZindex, "Resizable handles have lower z-index than modal overlay" );
|
2012-11-26 21:27:18 +00:00
|
|
|
dialog.dialog( "destroy" );
|
2015-08-24 12:59:54 +00:00
|
|
|
} );
|
2012-11-26 21:27:18 +00:00
|
|
|
|
2016-04-03 16:10:09 +00:00
|
|
|
QUnit.test( "Prevent tabbing out of dialogs", function( assert ) {
|
|
|
|
var ready = assert.async();
|
|
|
|
assert.expect( 3 );
|
2012-12-08 01:06:29 +00:00
|
|
|
|
2014-06-10 10:38:26 +00:00
|
|
|
var element = $( "<div><input name='0'><input name='1'></div>" ).dialog(),
|
|
|
|
inputs = element.find( "input" );
|
|
|
|
|
|
|
|
// Remove close button to test focus on just the two buttons
|
2015-08-24 12:59:54 +00:00
|
|
|
element.dialog( "widget" ).find( ".ui-button" ).remove();
|
2012-12-08 01:06:29 +00:00
|
|
|
|
|
|
|
function checkTab() {
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.equal( document.activeElement, inputs[ 0 ], "Tab key event move d focus within the modal" );
|
2012-12-08 01:06:29 +00:00
|
|
|
|
2015-08-21 04:11:21 +00:00
|
|
|
// Check shift tab
|
2015-08-24 12:59:54 +00:00
|
|
|
$( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB, shiftKey: true } );
|
2012-12-10 20:31:56 +00:00
|
|
|
setTimeout( checkShiftTab );
|
2012-12-08 01:06:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function checkShiftTab() {
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.equal( document.activeElement, inputs[ 1 ], "Shift-Tab key event moved focus back to second input" );
|
2012-12-08 01:06:29 +00:00
|
|
|
|
2013-01-31 05:38:20 +00:00
|
|
|
element.remove();
|
2016-04-03 16:10:09 +00:00
|
|
|
setTimeout( ready );
|
2012-12-08 01:06:29 +00:00
|
|
|
}
|
|
|
|
|
2014-06-10 10:38:26 +00:00
|
|
|
inputs[ 1 ].focus();
|
2015-08-24 12:59:54 +00:00
|
|
|
setTimeout( function() {
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.equal( document.activeElement, inputs[ 1 ], "Focus set on second input" );
|
2015-08-24 12:59:54 +00:00
|
|
|
inputs.eq( 1 ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB } );
|
2012-12-08 01:06:29 +00:00
|
|
|
|
2012-12-10 20:31:56 +00:00
|
|
|
setTimeout( checkTab );
|
2015-08-24 12:59:54 +00:00
|
|
|
} );
|
|
|
|
} );
|
2012-12-08 01:06:29 +00:00
|
|
|
|
2016-04-03 16:10:09 +00:00
|
|
|
QUnit.test( "#9048: multiple modal dialogs opened and closed in different order",
|
|
|
|
function( assert ) {
|
|
|
|
var ready = assert.async();
|
|
|
|
assert.expect( 1 );
|
2015-08-24 12:59:54 +00:00
|
|
|
$( "#dialog1, #dialog2" ).dialog( { autoOpen: false, modal:true } );
|
2013-02-03 00:32:42 +00:00
|
|
|
$( "#dialog1" ).dialog( "open" );
|
|
|
|
$( "#dialog2" ).dialog( "open" );
|
|
|
|
$( "#dialog1" ).dialog( "close" );
|
2015-08-24 12:59:54 +00:00
|
|
|
setTimeout( function() {
|
2013-02-03 00:32:42 +00:00
|
|
|
$( "#dialog2" ).dialog( "close" );
|
2015-05-14 01:57:04 +00:00
|
|
|
$( "#favorite-animal" ).trigger( "focus" );
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.ok( true, "event handlers cleaned up (no errors thrown)" );
|
|
|
|
ready();
|
2015-08-24 12:59:54 +00:00
|
|
|
} );
|
|
|
|
} );
|
2013-11-16 11:21:02 +00:00
|
|
|
|
2016-04-03 16:10:09 +00:00
|
|
|
QUnit.test( "interaction between overlay and other dialogs", function( assert ) {
|
|
|
|
var ready = assert.async();
|
2013-11-16 11:21:02 +00:00
|
|
|
$.widget( "ui.testWidget", $.ui.dialog, {
|
|
|
|
options: {
|
|
|
|
modal: true,
|
|
|
|
autoOpen: false
|
|
|
|
}
|
2015-08-24 12:59:54 +00:00
|
|
|
} );
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.expect( 2 );
|
2015-08-24 12:59:54 +00:00
|
|
|
var first = $( "<div><input id='input-1'></div>" ).dialog( {
|
2013-11-16 11:21:02 +00:00
|
|
|
modal: true
|
2015-08-24 12:59:54 +00:00
|
|
|
} ),
|
2013-11-16 11:21:02 +00:00
|
|
|
firstInput = first.find( "input" ),
|
|
|
|
second = $( "<div><input id='input-2'></div>" ).testWidget(),
|
|
|
|
secondInput = second.find( "input" );
|
|
|
|
|
|
|
|
// Support: IE8
|
|
|
|
// For some reason the focus doesn't get set properly if we don't
|
|
|
|
// focus the body first.
|
2015-05-14 01:57:04 +00:00
|
|
|
$( "body" ).trigger( "focus" );
|
2013-11-16 11:21:02 +00:00
|
|
|
|
|
|
|
// Wait for the modal to init
|
2015-08-24 12:59:54 +00:00
|
|
|
setTimeout( function() {
|
2013-11-16 11:21:02 +00:00
|
|
|
|
2016-04-03 16:10:09 +00:00
|
|
|
second.
|
|
|
|
testWidget
|
|
|
|
( "open" );
|
|
|
|
|
|
|
|
// Simulate user tabbing from address bar to an element outside the dialog
|
2015-05-14 01:57:04 +00:00
|
|
|
$( "#favorite-animal" ).trigger( "focus" );
|
2015-08-24 12:59:54 +00:00
|
|
|
setTimeout( function() {
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.equal( document.activeElement, secondInput[ 0 ] );
|
2013-11-16 11:21:02 +00:00
|
|
|
|
|
|
|
// Last active dialog must receive focus
|
2015-05-14 01:57:04 +00:00
|
|
|
firstInput.trigger( "focus" );
|
|
|
|
$( "#favorite-animal" ).trigger( "focus" );
|
2015-08-24 12:59:54 +00:00
|
|
|
setTimeout( function() {
|
2016-04-03 16:10:09 +00:00
|
|
|
assert.equal( document.activeElement, firstInput[ 0 ] );
|
2013-11-16 11:21:02 +00:00
|
|
|
|
|
|
|
// Cleanup
|
|
|
|
first.remove();
|
|
|
|
second.remove();
|
|
|
|
delete $.ui.testWidget;
|
|
|
|
delete $.fn.testWidget;
|
2016-04-03 16:10:09 +00:00
|
|
|
ready();
|
2015-08-24 12:59:54 +00:00
|
|
|
} );
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
} );
|
2013-11-16 11:21:02 +00:00
|
|
|
|
2015-04-07 00:23:50 +00:00
|
|
|
} );
|