diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2021-04-16 23:33:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-16 23:33:57 +0200 |
commit | 9380d2734e9f3674ca1fcf1ba5981c3c5a858576 (patch) | |
tree | ea2016aac413cd9062dd5f82dc21f03f2b779c93 | |
parent | dff0dc0d6af9834f03902fe260b51a15de3ab498 (diff) | |
download | jquery-ui-9380d2734e9f3674ca1fcf1ba5981c3c5a858576.tar.gz jquery-ui-9380d2734e9f3674ca1fcf1ba5981c3c5a858576.zip |
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
-rw-r--r-- | tests/unit/tabs/core.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/unit/tabs/core.js b/tests/unit/tabs/core.js index 49496dc37..43392bdb4 100644 --- a/tests/unit/tabs/core.js +++ b/tests/unit/tabs/core.js @@ -187,7 +187,13 @@ QUnit.test( "keyboard support - LEFT, RIGHT, UP, DOWN, HOME, END, SPACE, ENTER", } ), tabs = element.find( ".ui-tabs-nav li" ), panels = element.find( ".ui-tabs-panel" ), - keyCode = $.ui.keyCode; + keyCode = $.ui.keyCode, + + // Support: IE 11 with jQuery 1.8. + // In IE with jQuery 1.8 focusout may not happen immediately so some checks + // need to be done later. + isFocusoutImmediate = !( document.documentMode && + jQuery.fn.jquery.indexOf( "1.8." ) === 0 ); element.tabs( "instance" ).delay = 1; @@ -202,7 +208,9 @@ QUnit.test( "keyboard support - LEFT, RIGHT, UP, DOWN, HOME, END, SPACE, ENTER", tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.DOWN } ); assert.hasClasses( tabs.eq( 1 ), "ui-state-focus", "DOWN moves focus to next tab" ); - assert.lacksClasses( tabs.eq( 0 ), "ui-state-focus", "first tab is no longer focused" ); + if ( isFocusoutImmediate ) { + assert.lacksClasses( tabs.eq( 0 ), "ui-state-focus", "first tab is no longer focused" ); + } assert.equal( tabs.eq( 1 ).attr( "aria-selected" ), "true", "second tab has aria-selected=true" ); assert.equal( tabs.eq( 0 ).attr( "aria-selected" ), "false", "first tab has aria-selected=false" ); 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", // Left, home, space function step2() { + if ( !isFocusoutImmediate ) { + assert.lacksClasses( tabs.eq( 0 ), "ui-state-focus", "first tab is no longer focused" ); + } assert.equal( tabs.eq( 2 ).attr( "aria-selected" ), "true", "third tab has aria-selected=true" ); assert.equal( tabs.eq( 0 ).attr( "aria-selected" ), "false", "first tab has aria-selected=false" ); assert.ok( panels.eq( 2 ).is( ":visible" ), "third panel is visible" ); |