mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Calendar: Use document.activeElement for retrieving focused element
Fixes unit tests in phantom.
This commit is contained in:
parent
33b1820958
commit
cc91adf4b6
@ -139,7 +139,7 @@ asyncTest( "keyboard handling", function() {
|
||||
.focusGrid( element )
|
||||
.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
|
||||
setTimeout(function() {
|
||||
$( ":focus" ).simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||
$( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||
TestHelpers.calendar.equalsDate(
|
||||
element.calendar( "valueAsDate" ),
|
||||
new Date( 2013, 12 - 1, 31 ),
|
||||
@ -170,7 +170,7 @@ asyncTest( "keyboard handling", function() {
|
||||
|
||||
TestHelpers.calendar.focusGrid( element ).simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
|
||||
setTimeout(function() {
|
||||
$( ":focus" ).simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||
$( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||
TestHelpers.calendar.equalsDate(
|
||||
element.calendar( "valueAsDate" ),
|
||||
new Date( 2013, 12 - 1, 25 ),
|
||||
@ -186,7 +186,7 @@ asyncTest( "keyboard handling", function() {
|
||||
|
||||
TestHelpers.calendar.focusGrid( element ).simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
|
||||
setTimeout(function() {
|
||||
$( ":focus" ).simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||
$( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||
TestHelpers.calendar.equalsDate(
|
||||
element.calendar( "valueAsDate" ),
|
||||
new Date( 2014, 1 - 1, 8 ),
|
||||
@ -202,7 +202,7 @@ asyncTest( "keyboard handling", function() {
|
||||
|
||||
TestHelpers.calendar.focusGrid( element ).simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
|
||||
setTimeout(function() {
|
||||
$( ":focus" ).simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||
$( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||
TestHelpers.calendar.equalsDate(
|
||||
element.calendar( "valueAsDate" ),
|
||||
new Date( 2013, 12 - 1, 1 ),
|
||||
@ -219,7 +219,7 @@ asyncTest( "keyboard handling", function() {
|
||||
TestHelpers.calendar.focusGrid( element )
|
||||
.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP, altKey: true } );
|
||||
setTimeout(function() {
|
||||
$( ":focus" ).simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||
$( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||
TestHelpers.calendar.equalsDate(
|
||||
element.calendar( "valueAsDate" ),
|
||||
new Date( 2013, 1 - 1, 1 ),
|
||||
@ -235,7 +235,7 @@ asyncTest( "keyboard handling", function() {
|
||||
|
||||
TestHelpers.calendar.focusGrid( element ).simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
|
||||
setTimeout(function() {
|
||||
$( ":focus" ).simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||
$( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||
TestHelpers.calendar.equalsDate(
|
||||
element.calendar( "valueAsDate" ),
|
||||
new Date( 2014, 2 - 1, 1 ),
|
||||
@ -252,7 +252,7 @@ asyncTest( "keyboard handling", function() {
|
||||
TestHelpers.calendar.focusGrid( element )
|
||||
.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN, altKey: true } );
|
||||
setTimeout(function() {
|
||||
$( ":focus" ).simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||
$( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||
TestHelpers.calendar.equalsDate(
|
||||
element.calendar( "valueAsDate" ),
|
||||
new Date( 2015, 1 - 1, 1 ),
|
||||
@ -269,7 +269,7 @@ asyncTest( "keyboard handling", function() {
|
||||
|
||||
TestHelpers.calendar.focusGrid( element ).simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
|
||||
setTimeout(function() {
|
||||
$( ":focus" ).simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||
$( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||
TestHelpers.calendar.equalsDate(
|
||||
element.calendar( "valueAsDate" ),
|
||||
new Date( 2014, 2 - 1, 28 ),
|
||||
@ -285,7 +285,7 @@ asyncTest( "keyboard handling", function() {
|
||||
|
||||
TestHelpers.calendar.focusGrid( element ).simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
|
||||
setTimeout(function() {
|
||||
$( ":focus" ).simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||
$( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||
TestHelpers.calendar.equalsDate(
|
||||
element.calendar( "valueAsDate" ),
|
||||
new Date( 2016, 2 - 1, 29 ),
|
||||
|
@ -16,9 +16,9 @@ TestHelpers.calendar = {
|
||||
},
|
||||
focusGrid: function( element ) {
|
||||
element.find( ":tabbable" ).last().simulate( "focus" );
|
||||
$( ":focus" ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB } );
|
||||
$( ":focus" ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB } );
|
||||
$( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB } );
|
||||
$( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB } );
|
||||
|
||||
return $( ":focus" );
|
||||
return $( document.activeElement );
|
||||
}
|
||||
};
|
||||
|
@ -108,7 +108,7 @@ asyncTest( "select", function() {
|
||||
.simulate( "focus" )
|
||||
.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
|
||||
setTimeout(function() {
|
||||
$( ":focus" )
|
||||
$( document.activeElement )
|
||||
.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } )
|
||||
.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||
input.datepicker( "close" );
|
||||
@ -122,7 +122,7 @@ asyncTest( "select", function() {
|
||||
.simulate( "focus" )
|
||||
.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
|
||||
setTimeout(function() {
|
||||
$( ":focus" ).simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
|
||||
$( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
|
||||
input.datepicker( "close" );
|
||||
start();
|
||||
}, 100 );
|
||||
|
Loading…
Reference in New Issue
Block a user