Skip to content

Commit 9380d27

Browse files
authored
Tests: Accept delayed focusout in IE with jQuery 1.8
In IE with jQuery 1.8 focusout may not happen immediately so some checks need to be done later. Closes gh-1952
1 parent dff0dc0 commit 9380d27

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tests/unit/tabs/core.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,13 @@ QUnit.test( "keyboard support - LEFT, RIGHT, UP, DOWN, HOME, END, SPACE, ENTER",
187187
} ),
188188
tabs = element.find( ".ui-tabs-nav li" ),
189189
panels = element.find( ".ui-tabs-panel" ),
190-
keyCode = $.ui.keyCode;
190+
keyCode = $.ui.keyCode,
191+
192+
// Support: IE 11 with jQuery 1.8.
193+
// In IE with jQuery 1.8 focusout may not happen immediately so some checks
194+
// need to be done later.
195+
isFocusoutImmediate = !( document.documentMode &&
196+
jQuery.fn.jquery.indexOf( "1.8." ) === 0 );
191197

192198
element.tabs( "instance" ).delay = 1;
193199

@@ -202,7 +208,9 @@ QUnit.test( "keyboard support - LEFT, RIGHT, UP, DOWN, HOME, END, SPACE, ENTER",
202208

203209
tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.DOWN } );
204210
assert.hasClasses( tabs.eq( 1 ), "ui-state-focus", "DOWN moves focus to next tab" );
205-
assert.lacksClasses( tabs.eq( 0 ), "ui-state-focus", "first tab is no longer focused" );
211+
if ( isFocusoutImmediate ) {
212+
assert.lacksClasses( tabs.eq( 0 ), "ui-state-focus", "first tab is no longer focused" );
213+
}
206214
assert.equal( tabs.eq( 1 ).attr( "aria-selected" ), "true", "second tab has aria-selected=true" );
207215
assert.equal( tabs.eq( 0 ).attr( "aria-selected" ), "false", "first tab has aria-selected=false" );
208216
assert.ok( panels.eq( 1 ).is( ":hidden" ), "second panel is still hidden" );
@@ -247,6 +255,9 @@ QUnit.test( "keyboard support - LEFT, RIGHT, UP, DOWN, HOME, END, SPACE, ENTER",
247255

248256
// Left, home, space
249257
function step2() {
258+
if ( !isFocusoutImmediate ) {
259+
assert.lacksClasses( tabs.eq( 0 ), "ui-state-focus", "first tab is no longer focused" );
260+
}
250261
assert.equal( tabs.eq( 2 ).attr( "aria-selected" ), "true", "third tab has aria-selected=true" );
251262
assert.equal( tabs.eq( 0 ).attr( "aria-selected" ), "false", "first tab has aria-selected=false" );
252263
assert.ok( panels.eq( 2 ).is( ":visible" ), "third panel is visible" );

0 commit comments

Comments
 (0)