Skip to content
Permalink
Browse files

Dialog position tests: Use Math.round() instead of Math.floor().

  • Loading branch information
scottgonzalez committed Dec 3, 2010
1 parent 51695f8 commit 22cf318e40e0ee1996ac27d8877ef2ec19e84ca2
Showing with 4 additions and 4 deletions.
  1. +4 −4 tests/unit/dialog/dialog_options.js
@@ -265,16 +265,16 @@ test("position, default center on window", function() {
var el = $('<div></div>').dialog();
var dialog = el.dialog('widget');
var offset = dialog.offset();
same(offset.left, Math.floor($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft());
same(offset.top, Math.floor($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop());
same(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft());
same(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop());
el.remove();
});

test("position, top on window", function() {
var el = $('<div></div>').dialog({ position: "top" });
var dialog = el.dialog('widget');
var offset = dialog.offset();
same(offset.left, Math.floor($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft());
same(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft());
same(offset.top, $(window).scrollTop());
el.remove();
});
@@ -284,7 +284,7 @@ test("position, left on window", function() {
var dialog = el.dialog('widget');
var offset = dialog.offset();
same(offset.left, 0);
same(offset.top, Math.floor($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop());
same(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop());
el.remove();
});

0 comments on commit 22cf318

Please sign in to comment.
You can’t perform that action at this time.