diff options
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/accordion/core.js | 51 | ||||
-rw-r--r-- | tests/unit/datepicker/events.js | 1 | ||||
-rw-r--r-- | tests/unit/datepicker/options.js | 2 | ||||
-rw-r--r-- | tests/unit/dialog/methods.js | 18 | ||||
-rw-r--r-- | tests/unit/draggable/core.js | 16 | ||||
-rw-r--r-- | tests/unit/draggable/helper.js | 7 | ||||
-rw-r--r-- | tests/unit/draggable/options.js | 25 | ||||
-rw-r--r-- | tests/unit/resizable/options.js | 15 | ||||
-rw-r--r-- | tests/unit/subsuite.js | 10 | ||||
-rw-r--r-- | tests/unit/tabs/core.js | 23 |
10 files changed, 28 insertions, 140 deletions
diff --git a/tests/unit/accordion/core.js b/tests/unit/accordion/core.js index 7436ba7a9..4e899439f 100644 --- a/tests/unit/accordion/core.js +++ b/tests/unit/accordion/core.js @@ -133,75 +133,36 @@ QUnit.test( "keyboard support", function( assert ) { function step1() { assert.hasClasses( headers.eq( 0 ), "ui-state-focus", "first header has focus" ); headers.eq( 0 ).simulate( "keydown", { keyCode: keyCode.DOWN } ); - setTimeout( step2 ); - } - - // Support: IE 11 with jQuery 1.8 only - // All of the setTimeouts() from keydowns aren't necessary with newer jQuery. - // Only the explicit focus simulations require them. - function step2() { assert.hasClasses( headers.eq( 1 ), "ui-state-focus", "DOWN moves focus to next header" ); headers.eq( 1 ).simulate( "keydown", { keyCode: keyCode.RIGHT } ); - setTimeout( step3 ); - } - - function step3() { assert.hasClasses( headers.eq( 2 ), "ui-state-focus", "RIGHT moves focus to next header" ); headers.eq( 2 ).simulate( "keydown", { keyCode: keyCode.DOWN } ); - setTimeout( step4 ); - } - - function step4() { assert.hasClasses( headers.eq( 0 ), "ui-state-focus", "DOWN wraps focus to first header" ); - headers.eq( 0 ).simulate( "keydown", { keyCode: keyCode.UP } ); - setTimeout( step5 ); - } - function step5() { + headers.eq( 0 ).simulate( "keydown", { keyCode: keyCode.UP } ); assert.hasClasses( headers.eq( 2 ), "ui-state-focus", "UP wraps focus to last header" ); headers.eq( 2 ).simulate( "keydown", { keyCode: keyCode.LEFT } ); - setTimeout( step6 ); - } - - function step6() { assert.hasClasses( headers.eq( 1 ), "ui-state-focus", "LEFT moves focus to previous header" ); - headers.eq( 1 ).simulate( "keydown", { keyCode: keyCode.HOME } ); - setTimeout( step7 ); - } - function step7() { + headers.eq( 1 ).simulate( "keydown", { keyCode: keyCode.HOME } ); assert.hasClasses( headers.eq( 0 ), "ui-state-focus", "HOME moves focus to first header" ); headers.eq( 0 ).simulate( "keydown", { keyCode: keyCode.END } ); - setTimeout( step8 ); - } - - function step8() { assert.hasClasses( headers.eq( 2 ), "ui-state-focus", "END moves focus to last header" ); - headers.eq( 2 ).simulate( "keydown", { keyCode: keyCode.ENTER } ); - setTimeout( step9 ); - } - function step9() { + headers.eq( 2 ).simulate( "keydown", { keyCode: keyCode.ENTER } ); assert.equal( element.accordion( "option", "active" ), 2, "ENTER activates panel" ); headers.eq( 1 ).simulate( "keydown", { keyCode: keyCode.SPACE } ); - setTimeout( step10 ); - } - - function step10() { assert.equal( element.accordion( "option", "active" ), 1, "SPACE activates panel" ); + anchor.simulate( "focus" ); - setTimeout( step11 ); + setTimeout( step2 ); } - function step11() { + function step2() { assert.lacksClasses( headers.eq( 1 ), "ui-state-focus", "header loses focus when focusing inside the panel" ); anchor.simulate( "keydown", { keyCode: keyCode.UP, ctrlKey: true } ); - setTimeout( step12 ); - } - - function step12() { assert.hasClasses( headers.eq( 1 ), "ui-state-focus", "CTRL+UP moves focus to header" ); ready(); } diff --git a/tests/unit/datepicker/events.js b/tests/unit/datepicker/events.js index 50ee07b86..c49e0603c 100644 --- a/tests/unit/datepicker/events.js +++ b/tests/unit/datepicker/events.js @@ -148,7 +148,6 @@ QUnit.test( "beforeShowDay-getDate", function( assert ) { // Contains non-breaking space assert.equal( $( "div.ui-datepicker-title" ).text(), - // Support: IE <9, jQuery <1.8 // In IE7/8 with jQuery <1.8, encoded spaces behave in strange ways $( "<span>January 2010</span>" ).text(), "Initial month" ); $( "a.ui-datepicker-next", dp ).trigger( "click" ); diff --git a/tests/unit/datepicker/options.js b/tests/unit/datepicker/options.js index bf2fccc1f..5d03cd61f 100644 --- a/tests/unit/datepicker/options.js +++ b/tests/unit/datepicker/options.js @@ -246,7 +246,6 @@ QUnit.test( "otherMonths", function( assert ) { inp.val( "06/01/2009" ).datepicker( "show" ); assert.equal( pop.find( "tbody" ).text(), - // Support: IE <9, jQuery <1.8 // In IE7/8 with jQuery <1.8, encoded spaces behave in strange ways $( "<span>\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0</span>" ).text(), "Other months - none" ); @@ -262,7 +261,6 @@ QUnit.test( "otherMonths", function( assert ) { inp.datepicker( "hide" ).datepicker( "option", "showOtherMonths", false ).datepicker( "show" ); assert.equal( pop.find( "tbody" ).text(), - // Support: IE <9, jQuery <1.8 // In IE7/8 with jQuery <1.8, encoded spaces behave in strange ways $( "<span>\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0</span>" ).text(), "Other months - none" ); diff --git a/tests/unit/dialog/methods.js b/tests/unit/dialog/methods.js index 90a6a6455..1de32194b 100644 --- a/tests/unit/dialog/methods.js +++ b/tests/unit/dialog/methods.js @@ -217,8 +217,6 @@ QUnit.test( "#8958: dialog can be opened while opening", function( assert ) { var ready = assert.async( 3 ); assert.expect( 1 ); - var jQuery1Dot8 = jQuery.fn.jquery.indexOf( "1.8" ) === 0; - var element = $( "<div>" ).dialog( { autoOpen: false, modal: true, @@ -248,15 +246,6 @@ QUnit.test( "#8958: dialog can be opened while opening", function( assert ) { // handle a call to the open() method during the process of the dialog // being opened. .on( "blur", function() { - - // Support: jQuery 1.8 only - // The test never fully worked in jQuery 1.8 since the input's blur - // handler never fired. It's only been uncovered when `ready()` calls - // have been added to all handlers. Skip this handler in jQuery 1.8. - if ( jQuery1Dot8 ) { - return; - } - element.dialog( "open" ); // Detach the handlers to avoid firing them outside of this @@ -266,13 +255,6 @@ QUnit.test( "#8958: dialog can be opened while opening", function( assert ) { ready(); } ) .trigger( "focus" ); - - // Support: jQuery 1.8 only - // Account for the skipped `ready()` call above. To make sure the count - // is constant, call it here instead. - if ( jQuery1Dot8 ) { - ready(); - } } ); QUnit.test( "#5531: dialog width should be at least minWidth on creation", function( assert ) { diff --git a/tests/unit/draggable/core.js b/tests/unit/draggable/core.js index debbcfba7..46c856d4e 100644 --- a/tests/unit/draggable/core.js +++ b/tests/unit/draggable/core.js @@ -96,17 +96,11 @@ QUnit.test( "#8269: Removing draggable element on drop", function( assert ) { } } ); - // Support: Opera 12.10, Safari 5.1, jQuery <1.8 - if ( testHelper.unreliableContains ) { - assert.ok( true, "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" ); - assert.ok( true, "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" ); - } else { - element.simulate( "drag", { - handle: "corner", - x: dropOffset.left, - y: dropOffset.top - } ); - } + element.simulate( "drag", { + handle: "corner", + x: dropOffset.left, + y: dropOffset.top + } ); } ); // https://bugs.jqueryui.com/ticket/7778 diff --git a/tests/unit/draggable/helper.js b/tests/unit/draggable/helper.js index c1920f23b..292b75bf0 100644 --- a/tests/unit/draggable/helper.js +++ b/tests/unit/draggable/helper.js @@ -11,13 +11,6 @@ return $.extend( helper, { // TODO: remove the unreliable offset hacks unreliableOffset: $.ui.ie && ( !document.documentMode || document.documentMode < 8 ) ? 2 : 0, - // Support: Opera 12.10, Safari 5.1, jQuery <1.8 - - unreliableContains: ( function() { - var element = $( "<div>" ); - return $.contains( element[ 0 ].ownerDocument, element[ 0 ] ); - } )(), - testDragPosition: function( assert, el, dx, dy, expectedDX, expectedDY, msg ) { msg = msg ? msg + "." : ""; diff --git a/tests/unit/draggable/options.js b/tests/unit/draggable/options.js index c98c9f9d8..79aac27c2 100644 --- a/tests/unit/draggable/options.js +++ b/tests/unit/draggable/options.js @@ -695,15 +695,10 @@ QUnit.test( "#6889: Cursor doesn't revert to pre-dragging state after revert act } ), expected = getCursor(); - if ( testHelper.unreliableContains ) { - assert.ok( true, "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" ); - assert.ok( true, "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" ); - } else { - element.simulate( "drag", { - dx: -1, - dy: -1 - } ); - } + element.simulate( "drag", { + dx: -1, + dy: -1 + } ); } ); QUnit.test( "cursor, default, switching after initialization", function( assert ) { @@ -1357,16 +1352,8 @@ QUnit.test( "#8459: element can snap to an element that was removed during drag" moves: 1 } ); - // Support: Opera 12.10, Safari 5.1, jQuery <1.8 - if ( testHelper.unreliableContains ) { - assert.ok( true, "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" ); - assert.ok( true, "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" ); - } else { - - // TODO: fix IE8 testswarm IFRAME positioning bug so assert.close can be turned back to equal - assert.close( element.offset().left, newX, 1, "doesn't snap to a removed element" ); - assert.close( element.offset().top, newY, 1, "doesn't snap to a removed element" ); - } + assert.strictEqual( element.offset().left, newX, "doesn't snap to a removed element" ); + assert.strictEqual( element.offset().top, newY, "doesn't snap to a removed element" ); } ); QUnit.test( "#8165: Snapping large rectangles to small rectangles doesn't snap properly", function( assert ) { diff --git a/tests/unit/resizable/options.js b/tests/unit/resizable/options.js index 50b30ce7f..add8d8034 100644 --- a/tests/unit/resizable/options.js +++ b/tests/unit/resizable/options.js @@ -525,20 +525,17 @@ QUnit.test( "alsoResize + multiple selection", function( assert ) { testHelper.drag( ".ui-resizable-se", 400, 400 ); - // Support: IE <=11+, jQuery 3.0 - 3.1 only - // IE sizing under jQuery 3.0 & 3.1 has a small delta compared to expected values. - // This delta is small so accept it. - assert.close( element.width(), 300, 0.01, + assert.strictEqual( element.width(), 300, "resizable constrained width at containment edge" ); - assert.close( element.height(), 200, 0.01, + assert.strictEqual( element.height(), 200, "resizable constrained height at containment edge" ); - assert.close( other1.width(), 250, 0.01, + assert.strictEqual( other1.width(), 250, "alsoResize o1 constrained width at containment edge" ); - assert.close( other1.height(), 150, 0.01, + assert.strictEqual( other1.height(), 150, "alsoResize o1 constrained height at containment edge" ); - assert.close( other2.width(), 250, 0.01, + assert.strictEqual( other2.width(), 250, "alsoResize o2 constrained width at containment edge" ); - assert.close( other2.height(), 150, 0.01, + assert.strictEqual( other2.height(), 150, "alsoResize o2 constrained height at containment edge" ); } ); diff --git a/tests/unit/subsuite.js b/tests/unit/subsuite.js index fa1533e51..d9766cf33 100644 --- a/tests/unit/subsuite.js +++ b/tests/unit/subsuite.js @@ -2,14 +2,8 @@ "use strict"; var versions = [ - "1.8.0", "1.8.1", "1.8.2", "1.8.3", - "1.9.0", "1.9.1", - "1.10.0", "1.10.1", "1.10.2", - "1.11.0", "1.11.1", "1.11.2", "1.11.3", - "1.12.0", "1.12.1", "1.12.2", "1.12.3", "1.12.4", - "2.0.0", "2.0.1", "2.0.2", "2.0.3", - "2.1.0", "2.1.1", "2.1.2", "2.1.3", "2.1.4", - "2.2.0", "2.2.1", "2.2.2", "2.2.3", "2.2.4", + "1.12.4", + "2.2.4", "3.0.0", "3.1.0", "3.1.1", "3.2.0", "3.2.1", diff --git a/tests/unit/tabs/core.js b/tests/unit/tabs/core.js index 0f9e7acbb..ae670ff43 100644 --- a/tests/unit/tabs/core.js +++ b/tests/unit/tabs/core.js @@ -180,13 +180,7 @@ QUnit.test( "accessibility - ajax", function( assert ) { } ); } ); -QUnit[ - - // Support: IE 11+, jQuery 3.6 only - // jQuery 3.6 has issues with focus handling in IE which breaks this test. - // The issues were fixed in jQuery 3.7, so we just accept them here. - jQuery.fn.jquery.indexOf( "3.6." ) === 0 && document.documentMode ? "skip" : "test" -]( "keyboard support - LEFT, RIGHT, UP, DOWN, HOME, END, SPACE, ENTER", function( assert ) { +QUnit.test( "keyboard support - LEFT, RIGHT, UP, DOWN, HOME, END, SPACE, ENTER", function( assert ) { var ready = assert.async(); assert.expect( 92 ); var element = $( "#tabs1" ).tabs( { @@ -194,13 +188,7 @@ QUnit[ } ), tabs = element.find( ".ui-tabs-nav li" ), panels = element.find( ".ui-tabs-panel" ), - 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 ); + keyCode = $.ui.keyCode; element.tabs( "instance" ).delay = 1; @@ -215,9 +203,7 @@ QUnit[ tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.DOWN } ); assert.hasClasses( tabs.eq( 1 ), "ui-state-focus", "DOWN moves focus to next tab" ); - if ( isFocusoutImmediate ) { - assert.lacksClasses( tabs.eq( 0 ), "ui-state-focus", "first tab is no longer focused" ); - } + 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" ); @@ -262,9 +248,6 @@ QUnit[ // 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" ); |