From d2ce363200bd1e1801a9b2c5a0a77e1097b39daa Mon Sep 17 00:00:00 2001 From: Scott González Date: Tue, 30 Aug 2016 14:58:39 -0400 Subject: Dialog: Allow for subpixel calculation errors in tests Tests were failing in IE 10-11 with values that were off by 0.01 pixels. Closes gh-1737 --- tests/unit/dialog/helper.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/unit/dialog/helper.js b/tests/unit/dialog/helper.js index 04c23202e..ede326156 100644 --- a/tests/unit/dialog/helper.js +++ b/tests/unit/dialog/helper.js @@ -33,11 +33,8 @@ return $.extend( helper, { assert.ok( expectedDX - actualDX <= 1 && expectedDY - actualDY <= 1, "dragged[" + expectedDX + ", " + expectedDY + "] " + msg ); }, - // TODO switch back to checking the size of the .ui-dialog element (var d) - // once we switch to using box-sizing: border-box (#9845) that should work fine - // using the element's dimensions to avoid subpixel errors shouldResize: function( assert, element, dw, dh, msg ) { - var heightAfter, widthAfter, actual, expected, + var actualDH, actualDW, heightAfter, widthAfter d = element.dialog( "widget" ), handle = $( ".ui-resizable-se", d ), heightBefore = element.height(), @@ -49,9 +46,13 @@ return $.extend( helper, { widthAfter = element.width(); msg = msg ? msg + "." : ""; - actual = { width: widthAfter, height: heightAfter }, - expected = { width: widthBefore + dw, height: heightBefore + dh }; - assert.deepEqual( actual, expected, "resized[" + 50 + ", " + 50 + "] " + msg ); + + actualDH = heightAfter - heightBefore; + actualDW = widthAfter - widthBefore; + + // TODO: Switch to assert.close(). + // Also change the testDrag() helper. + assert.ok( Math.abs(actualDH - dh) <= 1 && Math.abs(actualDW - dw) <= 1, "resized[50, 50] " + msg ); } } ); -- cgit v1.2.3