aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/dialog/helper.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2016-08-30 14:58:39 -0400
committerScott González <scott.gonzalez@gmail.com>2016-08-31 11:01:39 -0400
commitd2ce363200bd1e1801a9b2c5a0a77e1097b39daa (patch)
treebf34a426c4618296429d3af7114bbbfb155b55d7 /tests/unit/dialog/helper.js
parent398bd8dd36518ef04ffc9b7afb3a66195e78ec08 (diff)
downloadjquery-ui-d2ce363200bd1e1801a9b2c5a0a77e1097b39daa.tar.gz
jquery-ui-d2ce363200bd1e1801a9b2c5a0a77e1097b39daa.zip
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
Diffstat (limited to 'tests/unit/dialog/helper.js')
-rw-r--r--tests/unit/dialog/helper.js15
1 files 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 );
}
} );