diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2024-05-01 00:54:19 +0200 |
---|---|---|
committer | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2024-05-15 00:38:40 +0200 |
commit | bb49bd794bc8ea4238162725b518fb46234f3cf9 (patch) | |
tree | db7b6152daac9f2c6b5fd051ab5d3b7ec7382791 /tests/unit | |
parent | daa6fb55b35065c49c0ffc879c94627bbf85404c (diff) | |
download | jquery-ui-bb49bd794bc8ea4238162725b518fb46234f3cf9.tar.gz jquery-ui-bb49bd794bc8ea4238162725b518fb46234f3cf9.zip |
All: Drop support for IE & some other browsers (but mostly IE)
Closes gh-2249
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/autocomplete/events.js | 6 | ||||
-rw-r--r-- | tests/unit/button/core.js | 5 | ||||
-rw-r--r-- | tests/unit/checkboxradio/core.js | 10 | ||||
-rw-r--r-- | tests/unit/core/core.js | 7 | ||||
-rw-r--r-- | tests/unit/datepicker/core.js | 3 | ||||
-rw-r--r-- | tests/unit/datepicker/options.js | 249 | ||||
-rw-r--r-- | tests/unit/dialog/core.js | 42 | ||||
-rw-r--r-- | tests/unit/dialog/methods.js | 5 | ||||
-rw-r--r-- | tests/unit/draggable/core.js | 51 | ||||
-rw-r--r-- | tests/unit/draggable/helper.js | 3 | ||||
-rw-r--r-- | tests/unit/draggable/options.js | 38 | ||||
-rw-r--r-- | tests/unit/menu/events.js | 24 | ||||
-rw-r--r-- | tests/unit/sortable/options.js | 13 | ||||
-rw-r--r-- | tests/unit/widget/core.js | 4 |
14 files changed, 170 insertions, 290 deletions
diff --git a/tests/unit/autocomplete/events.js b/tests/unit/autocomplete/events.js index d08fe9828..9ee3a92e4 100644 --- a/tests/unit/autocomplete/events.js +++ b/tests/unit/autocomplete/events.js @@ -75,11 +75,7 @@ $.each( [ assert.ok( menu.is( ":visible" ), "menu is visible after delay" ); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ); - - // Blur must be async for IE to handle it properly - setTimeout( function() { - element.simulate( "blur" ); - } ); + element.simulate( "blur" ); } ); } ); } ); diff --git a/tests/unit/button/core.js b/tests/unit/button/core.js index 7b696631e..ae4b870ed 100644 --- a/tests/unit/button/core.js +++ b/tests/unit/button/core.js @@ -2,7 +2,6 @@ define( [ "qunit", "jquery", "lib/helper", - "ui/safe-active-element", "ui/widgets/button" ], function( QUnit, $, helper ) { "use strict"; @@ -17,10 +16,10 @@ QUnit.test( "Disabled button loses focus", function( assert ) { element.trigger( "focus" ); setTimeout( function() { - assert.equal( element[ 0 ], $.ui.safeActiveElement( document ), "Button is focused" ); + assert.equal( element[ 0 ], document.activeElement, "Button is focused" ); element.button( "disable" ); - assert.notEqual( element[ 0 ], $.ui.safeActiveElement( document ), "Button has had focus removed" ); + assert.notEqual( element[ 0 ], document.activeElement, "Button has had focus removed" ); ready(); } ); } ); diff --git a/tests/unit/checkboxradio/core.js b/tests/unit/checkboxradio/core.js index ad27f1be0..f218cc1cd 100644 --- a/tests/unit/checkboxradio/core.js +++ b/tests/unit/checkboxradio/core.js @@ -33,7 +33,6 @@ QUnit.test( "Radios - Initial class structure", function( assert ) { } ); QUnit.test( "Ensure checked after single click on checkbox label button", function( assert ) { - var ready = assert.async(); assert.expect( 2 ); $( "#check2" ).checkboxradio().on( "change", function() { @@ -43,14 +42,7 @@ QUnit.test( "Ensure checked after single click on checkbox label button", functi assert.hasClasses( label, "ui-state-active" ); } ); - // Support: Opera - // Opera doesn't trigger a change event when this is done synchronously. - // This seems to be a side effect of another test, but until that can be - // tracked down, this delay will have to do. - setTimeout( function() { - $( "#check2" ).checkboxradio( "widget" ).simulate( "click" ); - ready(); - } ); + $( "#check2" ).checkboxradio( "widget" ).simulate( "click" ); } ); QUnit.test( "Handle form association via form attribute", function( assert ) { diff --git a/tests/unit/core/core.js b/tests/unit/core/core.js index d9677a406..5d9eee07c 100644 --- a/tests/unit/core/core.js +++ b/tests/unit/core/core.js @@ -3,7 +3,6 @@ define( [ "jquery", "lib/common", "lib/helper", - "ui/form", "ui/labels", "ui/unique-id" ], function( QUnit, $, common, helper ) { @@ -150,10 +149,6 @@ QUnit.test( "Labels", function( assert ) { function testLabels( testType ) { var labels = dom.find( "#test" ).labels(); var found = labels.map( function() { - - // Support: Core 1.9 Only - // We use String.prototype.trim because core 1.9.x silently fails - // when white space is present return String.prototype.trim.call( $( this ).text() ); } ).get(); @@ -183,7 +178,7 @@ QUnit.test( "Labels", function( assert ) { QUnit.test( name + this.id.replace( /_/g, " " ), function( assert ) { var ready = assert.async(); assert.expect( 1 ); - var form = input._form(); + var form = $( input.prop( "form" ) ); // If input has a form the value should reset to "" if not it should be "changed" var value = form.length ? "" : "changed"; diff --git a/tests/unit/datepicker/core.js b/tests/unit/datepicker/core.js index 74320931e..edc16d005 100644 --- a/tests/unit/datepicker/core.js +++ b/tests/unit/datepicker/core.js @@ -311,9 +311,6 @@ QUnit.test( "customStructure", function( assert ) { } ); } - // TODO: figure out why this setTimeout is needed in IE, - // it only is necessary when the previous baseStructure tests runs first - // Support: IE setTimeout( step1 ); } ); diff --git a/tests/unit/datepicker/options.js b/tests/unit/datepicker/options.js index 5d03cd61f..3055bc199 100644 --- a/tests/unit/datepicker/options.js +++ b/tests/unit/datepicker/options.js @@ -5,8 +5,7 @@ define( [ "ui/widgets/datepicker", "ui/i18n/datepicker-fr", "ui/i18n/datepicker-he", - "ui/i18n/datepicker-zh-CN", - "ui/ie" + "ui/i18n/datepicker-zh-CN" ], function( QUnit, $, testHelper ) { "use strict"; @@ -97,147 +96,131 @@ QUnit.test( "change", function( assert ) { assert.equal( $.datepicker._defaults.showOn, "focus", "Retain default showOn" ); } ); -( function() { - var url = window.location.search; - url = decodeURIComponent( url.slice( url.indexOf( "swarmURL=" ) + 9 ) ); +QUnit.test( "invocation", function( assert ) { + var ready = assert.async(); + var button, image, + body = $( "body" ); - // TODO: This test occassionally fails in IE in TestSwarm - if ( $.ui.ie && url && url.indexOf( "http" ) === 0 ) { - return; - } + assert.expect( 29 ); - QUnit.test( "invocation", function( assert ) { - var ready = assert.async(); - var button, image, - isOldIE = $.ui.ie && ( !document.documentMode || document.documentMode < 9 ), - body = $( "body" ); - - assert.expect( isOldIE ? 25 : 29 ); - - function step0() { - var inp = testHelper.initNewInput(), - dp = $( "#ui-datepicker-div" ); - - button = inp.siblings( "button" ); - assert.ok( button.length === 0, "Focus - button absent" ); - image = inp.siblings( "img" ); - assert.ok( image.length === 0, "Focus - image absent" ); - - testHelper.onFocus( inp, function() { - assert.ok( dp.is( ":visible" ), "Focus - rendered on focus" ); - inp.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } ); - assert.ok( !dp.is( ":visible" ), "Focus - hidden on exit" ); - step1(); - } ); - } + function step0() { + var inp = testHelper.initNewInput(), + dp = $( "#ui-datepicker-div" ); - function step1() { + button = inp.siblings( "button" ); + assert.ok( button.length === 0, "Focus - button absent" ); + image = inp.siblings( "img" ); + assert.ok( image.length === 0, "Focus - image absent" ); - var inp = testHelper.initNewInput(), - dp = $( "#ui-datepicker-div" ); + testHelper.onFocus( inp, function() { + assert.ok( dp.is( ":visible" ), "Focus - rendered on focus" ); + inp.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } ); + assert.ok( !dp.is( ":visible" ), "Focus - hidden on exit" ); + step1(); + } ); + } - testHelper.onFocus( inp, function() { - assert.ok( dp.is( ":visible" ), "Focus - rendered on focus" ); - body.simulate( "mousedown", {} ); - assert.ok( !dp.is( ":visible" ), "Focus - hidden on external click" ); - inp.datepicker( "hide" ).datepicker( "destroy" ); + function step1() { - step2(); - } ); - } + var inp = testHelper.initNewInput(), + dp = $( "#ui-datepicker-div" ); - function step2() { - var inp = testHelper.initNewInput( { - showOn: "button", - buttonText: "Popup" - } ), - dp = $( "#ui-datepicker-div" ); - - assert.ok( !dp.is( ":visible" ), "Button - initially hidden" ); - button = inp.siblings( "button" ); - image = inp.siblings( "img" ); - assert.ok( button.length === 1, "Button - button present" ); - assert.ok( image.length === 0, "Button - image absent" ); - assert.equal( button.text(), "Popup", "Button - button text" ); - - testHelper.onFocus( inp, function() { - assert.ok( !dp.is( ":visible" ), "Button - not rendered on focus" ); - button.trigger( "click" ); - assert.ok( dp.is( ":visible" ), "Button - rendered on button click" ); - button.trigger( "click" ); - assert.ok( !dp.is( ":visible" ), "Button - hidden on second button click" ); - inp.datepicker( "hide" ).datepicker( "destroy" ); - - step3(); - } ); - } + testHelper.onFocus( inp, function() { + assert.ok( dp.is( ":visible" ), "Focus - rendered on focus" ); + body.simulate( "mousedown", {} ); + assert.ok( !dp.is( ":visible" ), "Focus - hidden on external click" ); + inp.datepicker( "hide" ).datepicker( "destroy" ); - function step3() { - var inp = testHelper.initNewInput( { - showOn: "button", - buttonImageOnly: true, - buttonImage: "images/calendar.gif", - buttonText: "Cal" - } ), - dp = $( "#ui-datepicker-div" ); - - assert.ok( !dp.is( ":visible" ), "Image button - initially hidden" ); - button = inp.siblings( "button" ); - assert.ok( button.length === 0, "Image button - button absent" ); - image = inp.siblings( "img" ); - assert.ok( image.length === 1, "Image button - image present" ); - assert.ok( /images\/calendar\.gif$/.test( image.attr( "src" ) ), "Image button - image source" ); - assert.equal( image.attr( "title" ), "Cal", "Image button - image text" ); - - testHelper.onFocus( inp, function() { - assert.ok( !dp.is( ":visible" ), "Image button - not rendered on focus" ); - image.trigger( "click" ); - assert.ok( dp.is( ":visible" ), "Image button - rendered on image click" ); - image.trigger( "click" ); - assert.ok( !dp.is( ":visible" ), "Image button - hidden on second image click" ); - inp.datepicker( "hide" ).datepicker( "destroy" ); - - step4(); - } ); - } + step2(); + } ); + } - function step4() { - var inp = testHelper.initNewInput( { - showOn: "both", - buttonImage: "images/calendar.gif" - } ), - dp = $( "#ui-datepicker-div" ); - - assert.ok( !dp.is( ":visible" ), "Both - initially hidden" ); - button = inp.siblings( "button" ); - assert.ok( button.length === 1, "Both - button present" ); - image = inp.siblings( "img" ); - assert.ok( image.length === 0, "Both - image absent" ); - image = button.children( "img" ); - assert.ok( image.length === 1, "Both - button image present" ); - - // TODO: This test occasionally fails to focus in IE8 in BrowserStack - if ( !isOldIE ) { - testHelper.onFocus( inp, function() { - assert.ok( dp.is( ":visible" ), "Both - rendered on focus" ); - body.simulate( "mousedown", {} ); - assert.ok( !dp.is( ":visible" ), "Both - hidden on external click" ); - button.trigger( "click" ); - assert.ok( dp.is( ":visible" ), "Both - rendered on button click" ); - button.trigger( "click" ); - assert.ok( !dp.is( ":visible" ), "Both - hidden on second button click" ); - inp.datepicker( "hide" ).datepicker( "destroy" ); - - ready(); - } ); - } else { - ready(); - } - } + function step2() { + var inp = testHelper.initNewInput( { + showOn: "button", + buttonText: "Popup" + } ), + dp = $( "#ui-datepicker-div" ); + + assert.ok( !dp.is( ":visible" ), "Button - initially hidden" ); + button = inp.siblings( "button" ); + image = inp.siblings( "img" ); + assert.ok( button.length === 1, "Button - button present" ); + assert.ok( image.length === 0, "Button - image absent" ); + assert.equal( button.text(), "Popup", "Button - button text" ); + + testHelper.onFocus( inp, function() { + assert.ok( !dp.is( ":visible" ), "Button - not rendered on focus" ); + button.trigger( "click" ); + assert.ok( dp.is( ":visible" ), "Button - rendered on button click" ); + button.trigger( "click" ); + assert.ok( !dp.is( ":visible" ), "Button - hidden on second button click" ); + inp.datepicker( "hide" ).datepicker( "destroy" ); + + step3(); + } ); + } - step0(); - } ); -} )(); + function step3() { + var inp = testHelper.initNewInput( { + showOn: "button", + buttonImageOnly: true, + buttonImage: "images/calendar.gif", + buttonText: "Cal" + } ), + dp = $( "#ui-datepicker-div" ); + + assert.ok( !dp.is( ":visible" ), "Image button - initially hidden" ); + button = inp.siblings( "button" ); + assert.ok( button.length === 0, "Image button - button absent" ); + image = inp.siblings( "img" ); + assert.ok( image.length === 1, "Image button - image present" ); + assert.ok( /images\/calendar\.gif$/.test( image.attr( "src" ) ), "Image button - image source" ); + assert.equal( image.attr( "title" ), "Cal", "Image button - image text" ); + + testHelper.onFocus( inp, function() { + assert.ok( !dp.is( ":visible" ), "Image button - not rendered on focus" ); + image.trigger( "click" ); + assert.ok( dp.is( ":visible" ), "Image button - rendered on image click" ); + image.trigger( "click" ); + assert.ok( !dp.is( ":visible" ), "Image button - hidden on second image click" ); + inp.datepicker( "hide" ).datepicker( "destroy" ); + + step4(); + } ); + } + + function step4() { + var inp = testHelper.initNewInput( { + showOn: "both", + buttonImage: "images/calendar.gif" + } ), + dp = $( "#ui-datepicker-div" ); + + assert.ok( !dp.is( ":visible" ), "Both - initially hidden" ); + button = inp.siblings( "button" ); + assert.ok( button.length === 1, "Both - button present" ); + image = inp.siblings( "img" ); + assert.ok( image.length === 0, "Both - image absent" ); + image = button.children( "img" ); + assert.ok( image.length === 1, "Both - button image present" ); + + testHelper.onFocus( inp, function() { + assert.ok( dp.is( ":visible" ), "Both - rendered on focus" ); + body.simulate( "mousedown", {} ); + assert.ok( !dp.is( ":visible" ), "Both - hidden on external click" ); + button.trigger( "click" ); + assert.ok( dp.is( ":visible" ), "Both - rendered on button click" ); + button.trigger( "click" ); + assert.ok( !dp.is( ":visible" ), "Both - hidden on second button click" ); + inp.datepicker( "hide" ).datepicker( "destroy" ); + + ready(); + } ); + } + + step0(); +} ); QUnit.test( "otherMonths", function( assert ) { assert.expect( 8 ); diff --git a/tests/unit/dialog/core.js b/tests/unit/dialog/core.js index cb0ee53e0..d307504b8 100644 --- a/tests/unit/dialog/core.js +++ b/tests/unit/dialog/core.js @@ -103,12 +103,6 @@ QUnit.test( "focus tabbable", function( assert ) { }; function checkFocus( markup, options, testFn, next ) { - - // Support: IE8 - // For some reason the focus doesn't get set properly if we don't - // focus the body first. - $( "body" ).trigger( "focus" ); - element = $( markup ).dialog( options ); setTimeout( function() { testFn( function done() { @@ -122,31 +116,12 @@ QUnit.test( "focus tabbable", function( assert ) { checkFocus( "<div><input><input></div>", options, function( done ) { var input = element.find( "input" ).last().trigger( "focus" ).trigger( "blur" ); - // Support: IE 11+ - // In IE in jQuery 3.4+ a sequence: - // $( inputNode ).trigger( "focus" ).trigger( "blur" ).trigger( "focus" ) - // doesn't end up with a focused input. See: - // https://github.com/jquery/jquery/issues/4856 - // However, in this test we only want to check that the last focused - // input receives the focus back when `_focusTabbable()` is called - // which in reality doesn't happen so quickly so let's avoid the issue - // by waiting a bit. - if ( document.documentMode ) { - setTimeout( function() { - focusTabbableAndAssert(); - }, 500 ); - } else { - focusTabbableAndAssert(); - } - - function focusTabbableAndAssert() { - element.dialog( "instance" )._focusTabbable(); - setTimeout( function() { - assert.equal( document.activeElement, input[ 0 ], - "1. an element that was focused previously." ); - done(); - } ); - } + element.dialog( "instance" )._focusTabbable(); + setTimeout( function() { + assert.equal( document.activeElement, input[ 0 ], + "1. an element that was focused previously." ); + done(); + } ); }, step2 ); } @@ -303,11 +278,6 @@ QUnit.test( "interaction between overlay and other dialogs", function( assert ) 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. - $( "body" ).trigger( "focus" ); - // Wait for the modal to init setTimeout( function() { diff --git a/tests/unit/dialog/methods.js b/tests/unit/dialog/methods.js index 1de32194b..c3f360fb9 100644 --- a/tests/unit/dialog/methods.js +++ b/tests/unit/dialog/methods.js @@ -226,11 +226,6 @@ QUnit.test( "#8958: dialog can be opened while opening", function( assert ) { } } ); - // Support: IE8 - // For some reason the #favorite-animal input doesn't get focus if we don't - // focus the body first, causing the test to hang. - $( "body" ).trigger( "focus" ); - $( "#favorite-animal" ) // We focus the input to start the test. Once it receives focus, the diff --git a/tests/unit/draggable/core.js b/tests/unit/draggable/core.js index 46c856d4e..d7f786c93 100644 --- a/tests/unit/draggable/core.js +++ b/tests/unit/draggable/core.js @@ -38,8 +38,8 @@ QUnit.test( "element types", function( assert ) { } ); offsetAfter = el.offset(); - // Support: FF, Chrome, and IE9, - // there are some rounding errors in so we can't say equal, we have to settle for close enough + // Support: Firefox, Chrome + // There are some rounding errors, so we can't say equal, we have to settle for close enough assert.close( offsetBefore.left, offsetAfter.left - 50, 1, "dragged[50, 50] " + "<" + typeName + "> left" ); assert.close( offsetBefore.top, offsetAfter.top - 50, 1, "dragged[50, 50] " + "<" + typeName + "> top" ); el.draggable( "destroy" ); @@ -112,7 +112,6 @@ QUnit.test( "Stray mousemove after mousedown still drags", function( assert ) { // In IE8, when content is placed under the mouse (e.g. when draggable content is replaced // on mousedown), mousemove is triggered on those elements even though the mouse hasn't moved. - // Support: IE <9 element.on( "mousedown", function() { $( document ).simulate( "mousemove", { button: -1 } ); } ); @@ -341,11 +340,13 @@ QUnit.test( "blur behavior - off handle", function( assert ) { var element = $( "#draggable2" ).draggable( { handle: "span" } ), focusElement = $( "<div tabindex='1'></div>" ).appendTo( element ); - // Mock $.ui.safeBlur with a spy - var _safeBlur = $.ui.safeBlur; + // Mock $.ui.trigger with a spy + var _trigger = $.fn.trigger; var blurCalledCount = 0; - $.ui.safeBlur = function() { - blurCalledCount++; + $.fn.trigger = function( eventName ) { + if ( eventName === "blur" ) { + blurCalledCount++; + } }; testHelper.onFocus( focusElement, function() { @@ -357,8 +358,8 @@ QUnit.test( "blur behavior - off handle", function( assert ) { testHelper.move( element.find( "span" ), 1, 1 ); assert.strictEqual( blurCalledCount, 1, "draggable blurs when mousing down on handle" ); - // Restore safeBlur - $.ui.safeBlur = _safeBlur; + // Restore trigger + $.fn.trigger = _trigger; ready(); } ); @@ -394,27 +395,21 @@ QUnit.test( "ui-draggable-handle managed correctly in nested draggables", functi assert.hasClasses( child, "ui-draggable-handle", "child retains class name on destroy" ); } ); -// Support: IE 8 only -// IE 8 implements DOM Level 2 Events which only has events bubble up to the document. -// We skip this test since it would be impossible for it to pass in such an environment. -QUnit[ document.documentMode === 8 ? "skip" : "test" ]( - "does not stop propagation to window", - function( assert ) { - assert.expect( 1 ); - var element = $( "#draggable1" ).draggable(); +QUnit.test( "does not stop propagation to window", function( assert ) { + assert.expect( 1 ); + var element = $( "#draggable1" ).draggable(); - var handler = function() { - assert.ok( true, "mouseup propagates to window" ); - }; - $( window ).on( "mouseup", handler ); + var handler = function() { + assert.ok( true, "mouseup propagates to window" ); + }; + $( window ).on( "mouseup", handler ); - element.simulate( "drag", { - dx: 10, - dy: 10 - } ); + element.simulate( "drag", { + dx: 10, + dy: 10 + } ); - $( window ).off( "mouseup", handler ); - } -); + $( window ).off( "mouseup", handler ); +} ); } ); diff --git a/tests/unit/draggable/helper.js b/tests/unit/draggable/helper.js index 292b75bf0..2fd637a24 100644 --- a/tests/unit/draggable/helper.js +++ b/tests/unit/draggable/helper.js @@ -8,9 +8,6 @@ define( [ return $.extend( helper, { - // TODO: remove the unreliable offset hacks - unreliableOffset: $.ui.ie && ( !document.documentMode || document.documentMode < 8 ) ? 2 : 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 79aac27c2..f97696920 100644 --- a/tests/unit/draggable/options.js +++ b/tests/unit/draggable/options.js @@ -743,11 +743,11 @@ QUnit.test( "cursorAt", function( assert ) { assert.equal( ui.position.left - ui.originalPosition.left, deltaX, testName + " " + position + " left" ); assert.equal( ui.position.top - ui.originalPosition.top, deltaY, testName + " " + position + " top" ); } else if ( testData.cursorAt.right ) { - assert.equal( ui.helper.width() - ( event.clientX - ui.offset.left ), testData.x - testHelper.unreliableOffset, testName + " " + position + " left" ); - assert.equal( ui.helper.height() - ( event.clientY - ui.offset.top ), testData.y - testHelper.unreliableOffset, testName + " " + position + " top" ); + assert.equal( ui.helper.width() - ( event.clientX - ui.offset.left ), testData.x, testName + " " + position + " left" ); + assert.equal( ui.helper.height() - ( event.clientY - ui.offset.top ), testData.y, testName + " " + position + " top" ); } else { - assert.equal( event.clientX - ui.offset.left, testData.x + testHelper.unreliableOffset, testName + " " + position + " left" ); - assert.equal( event.clientY - ui.offset.top, testData.y + testHelper.unreliableOffset, testName + " " + position + " top" ); + assert.equal( event.clientX - ui.offset.left, testData.x, testName + " " + position + " left" ); + assert.equal( event.clientY - ui.offset.top, testData.y, testName + " " + position + " top" ); } } } ); @@ -785,11 +785,11 @@ QUnit.test( "cursorAt, switching after initialization", function( assert ) { assert.equal( ui.position.left - ui.originalPosition.left, deltaX, testName + " " + position + " left" ); assert.equal( ui.position.top - ui.originalPosition.top, deltaY, testName + " " + position + " top" ); } else if ( testData.cursorAt.right ) { - assert.equal( ui.helper.width() - ( event.clientX - ui.offset.left ), testData.x - testHelper.unreliableOffset, testName + " " + position + " left" ); - assert.equal( ui.helper.height() - ( event.clientY - ui.offset.top ), testData.y - testHelper.unreliableOffset, testName + " " + position + " top" ); + assert.equal( ui.helper.width() - ( event.clientX - ui.offset.left ), testData.x, testName + " " + position + " left" ); + assert.equal( ui.helper.height() - ( event.clientY - ui.offset.top ), testData.y, testName + " " + position + " top" ); } else { - assert.equal( event.clientX - ui.offset.left, testData.x + testHelper.unreliableOffset, testName + " " + position + " left" ); - assert.equal( event.clientY - ui.offset.top, testData.y + testHelper.unreliableOffset, testName + " " + position + " top" ); + assert.equal( event.clientX - ui.offset.left, testData.x, testName + " " + position + " left" ); + assert.equal( event.clientY - ui.offset.top, testData.y, testName + " " + position + " top" ); } } } ); @@ -1136,15 +1136,6 @@ QUnit.test( "scroll ignores containers that are overflow: hidden", function( ass dy: 1300 } ); - // IE8 natively scrolls when dragging an element inside a overflow:hidden - // container, so skip this test if native scroll occurs. - // Support: IE <9 - if ( scrollParent.scrollTop() > 0 ) { - assert.ok( true, "overflow:hidden container natively scrolls" ); - assert.ok( true, "overflow:hidden container natively scrolls" ); - return; - } - element.css( { top: 0, left: 0 } ).draggable( "option", "scroll", true ); element.simulate( "drag", { @@ -1458,7 +1449,7 @@ QUnit.test( "zIndex, default, switching after initialization", function( assert } ); QUnit.test( "iframeFix", function( assert ) { - assert.expect( 6 ); + assert.expect( 5 ); var element = $( "<div>" ).appendTo( "#qunit-fixture" ).draggable( { iframeFix: true } ), element2 = $( "<div>" ).appendTo( "#qunit-fixture" ).draggable( { iframeFix: ".iframe" } ), @@ -1474,8 +1465,7 @@ QUnit.test( "iframeFix", function( assert ) { } ); element.one( "drag", function() { - var divOffset, iframeOffset, - div = $( this ).children().not( "iframe" ); + var div = $( this ).children().not( "iframe" ); // https://bugs.jqueryui.com/ticket/9671 // iframeFix doesn't handle iframes that move @@ -1483,13 +1473,7 @@ QUnit.test( "iframeFix", function( assert ) { assert.equal( div.outerWidth(), iframe.outerWidth(), "blocking div is wide enough" ); assert.equal( div.outerHeight(), iframe.outerHeight(), "blocking div is tall enough" ); - divOffset = div.offset(); - iframeOffset = iframe.offset(); - - // Support: Edge <79 only - // In Edge Legacy these values differ a little. - assert.ok( Math.abs( divOffset.top - iframeOffset.top ) < 0.25, "Check top within 0.25 of expected" ); - assert.ok( Math.abs( divOffset.left - iframeOffset.left ) < 0.25, "Check left within 0.25 of expected" ); + assert.deepEqual( div.offset(), iframe.offset(), "blocking div is tall enough" ); } ); element.simulate( "drag", { diff --git a/tests/unit/menu/events.js b/tests/unit/menu/events.js index caac7e741..f03ba333c 100644 --- a/tests/unit/menu/events.js +++ b/tests/unit/menu/events.js @@ -54,17 +54,11 @@ QUnit.test( "handle click on custom item menu", function( assert ) { QUnit.test( "handle blur", function( assert ) { var ready = assert.async(); assert.expect( 2 ); - var blurHandled = false, - index = 1, + var index = 1, element = $( "#menu1" ).menu( { blur: function( event, ui ) { - - // Ignore duplicate blur event fired by IE - if ( !blurHandled ) { - blurHandled = true; - assert.equal( event.type, "menublur", "blur event.type is 'menublur'" ); - assert.strictEqual( ui.item[ 0 ], element.children()[ index ], "ui.item" ); - } + assert.equal( event.type, "menublur", "blur event.type is 'menublur'" ); + assert.strictEqual( ui.item[ 0 ], element.children()[ index ], "ui.item" ); } } ); @@ -80,17 +74,11 @@ QUnit.test( "handle blur", function( assert ) { QUnit.test( "handle blur via click outside", function( assert ) { var ready = assert.async(); assert.expect( 2 ); - var blurHandled = false, - index = 1, + var index = 1, element = $( "#menu1" ).menu( { blur: function( event, ui ) { - - // Ignore duplicate blur event fired by IE - if ( !blurHandled ) { - blurHandled = true; - assert.equal( event.type, "menublur", "blur event.type is 'menublur'" ); - assert.strictEqual( ui.item[ 0 ], element.children()[ index ], "ui.item" ); - } + assert.equal( event.type, "menublur", "blur event.type is 'menublur'" ); + assert.strictEqual( ui.item[ 0 ], element.children()[ index ], "ui.item" ); } } ); diff --git a/tests/unit/sortable/options.js b/tests/unit/sortable/options.js index 0905de73c..3792d433f 100644 --- a/tests/unit/sortable/options.js +++ b/tests/unit/sortable/options.js @@ -294,17 +294,8 @@ QUnit.test( "{ forcePlaceholderSize: true } table rows", function( assert ) { placeholder: "test", forcePlaceholderSize: true, start: function( event, ui ) { - - // Support: IE 11+, Edge <79 only - // In IE & Edge Legacy these values may differ a little - // when jQuery >=3.0 <3.2 is used. - if ( jqMinor === "3.0." || jqMinor === "3.1." ) { - assert.ok( Math.abs( ui.placeholder.height() - ui.item.height() ) < 0.25, - "placeholder height is within 0.25 px of item's" ); - } else { - assert.equal( ui.placeholder.height(), ui.item.height(), - "placeholder is same height as item" ); - } + assert.equal( ui.placeholder.height(), ui.item.height(), + "placeholder is same height as item" ); } } ); diff --git a/tests/unit/widget/core.js b/tests/unit/widget/core.js index 1054bf092..fe74e18e9 100644 --- a/tests/unit/widget/core.js +++ b/tests/unit/widget/core.js @@ -293,9 +293,7 @@ QUnit.test( "._getCreateOptions()", function( assert ) { assert.deepEqual( superOptions, {}, "Base implementation returns empty object" ); - // Support: IE8 - // Strict equality fails when comparing this.window in ie8 - assert.equal( this.window[ 0 ], window, "this.window is properly defined" ); + assert.strictEqual( this.window[ 0 ], window, "this.window is properly defined" ); assert.strictEqual( this.document[ 0 ], document, "this.document is properly defined" ); return { |