Skip to content

Commit d2ce363

Browse files
committed
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 jquerygh-1737
1 parent 398bd8d commit d2ce363

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

tests/unit/dialog/helper.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,8 @@ return $.extend( helper, {
3333
assert.ok( expectedDX - actualDX <= 1 && expectedDY - actualDY <= 1, "dragged[" + expectedDX + ", " + expectedDY + "] " + msg );
3434
},
3535

36-
// TODO switch back to checking the size of the .ui-dialog element (var d)
37-
// once we switch to using box-sizing: border-box (#9845) that should work fine
38-
// using the element's dimensions to avoid subpixel errors
3936
shouldResize: function( assert, element, dw, dh, msg ) {
40-
var heightAfter, widthAfter, actual, expected,
37+
var actualDH, actualDW, heightAfter, widthAfter
4138
d = element.dialog( "widget" ),
4239
handle = $( ".ui-resizable-se", d ),
4340
heightBefore = element.height(),
@@ -49,9 +46,13 @@ return $.extend( helper, {
4946
widthAfter = element.width();
5047

5148
msg = msg ? msg + "." : "";
52-
actual = { width: widthAfter, height: heightAfter },
53-
expected = { width: widthBefore + dw, height: heightBefore + dh };
54-
assert.deepEqual( actual, expected, "resized[" + 50 + ", " + 50 + "] " + msg );
49+
50+
actualDH = heightAfter - heightBefore;
51+
actualDW = widthAfter - widthBefore;
52+
53+
// TODO: Switch to assert.close().
54+
// Also change the testDrag() helper.
55+
assert.ok( Math.abs(actualDH - dh) <= 1 && Math.abs(actualDW - dw) <= 1, "resized[50, 50] " + msg );
5556
}
5657
} );
5758

0 commit comments

Comments
 (0)