Skip to content

Commit 22cf318

Browse files
committed
Dialog position tests: Use Math.round() instead of Math.floor().
1 parent 51695f8 commit 22cf318

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/unit/dialog/dialog_options.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,16 +265,16 @@ test("position, default center on window", function() {
265265
var el = $('<div></div>').dialog();
266266
var dialog = el.dialog('widget');
267267
var offset = dialog.offset();
268-
same(offset.left, Math.floor($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft());
269-
same(offset.top, Math.floor($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop());
268+
same(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft());
269+
same(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop());
270270
el.remove();
271271
});
272272

273273
test("position, top on window", function() {
274274
var el = $('<div></div>').dialog({ position: "top" });
275275
var dialog = el.dialog('widget');
276276
var offset = dialog.offset();
277-
same(offset.left, Math.floor($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft());
277+
same(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft());
278278
same(offset.top, $(window).scrollTop());
279279
el.remove();
280280
});
@@ -284,7 +284,7 @@ test("position, left on window", function() {
284284
var dialog = el.dialog('widget');
285285
var offset = dialog.offset();
286286
same(offset.left, 0);
287-
same(offset.top, Math.floor($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop());
287+
same(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop());
288288
el.remove();
289289
});
290290

0 commit comments

Comments
 (0)