diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-02-28 15:56:32 +0100 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-02-29 18:36:40 +0100 |
commit | 72023dd045a7fead5a3136ec2400ad4743a190d2 (patch) | |
tree | 4999a287a815e6a4200498a2a0241abc349fe599 /tests/unit/dialog | |
parent | e6b7486abf2e0f98837e76027084fad6fe908cff (diff) | |
download | jquery-ui-72023dd045a7fead5a3136ec2400ad4743a190d2.tar.gz jquery-ui-72023dd045a7fead5a3136ec2400ad4743a190d2.zip |
Update to QUnit 1.3. Replace usage of same with deepEqual and equals with equal.
Diffstat (limited to 'tests/unit/dialog')
-rw-r--r-- | tests/unit/dialog/dialog_core.js | 18 | ||||
-rw-r--r-- | tests/unit/dialog/dialog_events.js | 84 | ||||
-rw-r--r-- | tests/unit/dialog/dialog_methods.js | 30 | ||||
-rw-r--r-- | tests/unit/dialog/dialog_options.js | 154 | ||||
-rw-r--r-- | tests/unit/dialog/dialog_tickets.js | 16 |
5 files changed, 151 insertions, 151 deletions
diff --git a/tests/unit/dialog/dialog_core.js b/tests/unit/dialog/dialog_core.js index 2003689e9..4a671968e 100644 --- a/tests/unit/dialog/dialog_core.js +++ b/tests/unit/dialog/dialog_core.js @@ -42,7 +42,7 @@ function moved(dx, dy, msg) { msg = msg ? msg + "." : ""; var actual = { left: Math.round(offsetAfter.left), top: Math.round(offsetAfter.top) }; var expected = { left: Math.round(offsetBefore.left + dx), top: Math.round(offsetBefore.top + dy) }; - same(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); + deepEqual(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); } function shouldmove(why) { @@ -61,7 +61,7 @@ function resized(dw, dh, msg) { msg = msg ? msg + "." : ""; var actual = { width: widthAfter, height: heightAfter }; var expected = { width: widthBefore + dw, height: heightBefore + dh }; - same(actual, expected, 'resized[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); + deepEqual(actual, expected, 'resized[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); } function shouldresize(why) { @@ -98,17 +98,17 @@ test("title id", function() { el = $('<div></div>').dialog(); titleId = dlg().find('.ui-dialog-title').attr('id'); - equals(titleId, 'ui-dialog-title-1', 'auto-numbered title id'); + equal(titleId, 'ui-dialog-title-1', 'auto-numbered title id'); el.remove(); el = $('<div></div>').dialog(); titleId = dlg().find('.ui-dialog-title').attr('id'); - equals(titleId, 'ui-dialog-title-2', 'auto-numbered title id'); + equal(titleId, 'ui-dialog-title-2', 'auto-numbered title id'); el.remove(); el = $('<div id="foo">').dialog(); titleId = dlg().find('.ui-dialog-title').attr('id'); - equals(titleId, 'ui-dialog-title-foo', 'carried over title id'); + equal(titleId, 'ui-dialog-title-foo', 'carried over title id'); el.remove(); }); @@ -117,14 +117,14 @@ test("ARIA", function() { el = $('<div></div>').dialog(); - equals(dlg().attr('role'), 'dialog', 'dialog role'); + equal(dlg().attr('role'), 'dialog', 'dialog role'); var labelledBy = dlg().attr('aria-labelledby'); ok(labelledBy.length > 0, 'has aria-labelledby attribute'); - equals(dlg().find('.ui-dialog-title').attr('id'), labelledBy, + equal(dlg().find('.ui-dialog-title').attr('id'), labelledBy, 'proper aria-labelledby attribute'); - equals(dlg().find('.ui-dialog-titlebar-close').attr('role'), 'button', + equal(dlg().find('.ui-dialog-titlebar-close').attr('role'), 'button', 'close link role'); el.remove(); @@ -132,7 +132,7 @@ test("ARIA", function() { test("widget method", function() { var dialog = $("<div>").appendTo("#main").dialog(); - same(dialog.parent()[0], dialog.dialog("widget")[0]); + deepEqual(dialog.parent()[0], dialog.dialog("widget")[0]); }); })(jQuery); diff --git a/tests/unit/dialog/dialog_events.js b/tests/unit/dialog/dialog_events.js index 40a8575b6..4b769bafc 100644 --- a/tests/unit/dialog/dialog_events.js +++ b/tests/unit/dialog/dialog_events.js @@ -13,9 +13,9 @@ test("open", function() { open: function(ev, ui) { ok(el.data("dialog")._isOpen, "interal _isOpen flag is set"); ok(true, 'autoOpen: true fires open callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogopen', 'event type in callback'); - same(ui, {}, 'ui hash in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogopen', 'event type in callback'); + deepEqual(ui, {}, 'ui hash in callback'); } }); el.remove(); @@ -25,15 +25,15 @@ test("open", function() { autoOpen: false, open: function(ev, ui) { ok(true, '.dialog("open") fires open callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogopen', 'event type in callback'); - same(ui, {}, 'ui hash in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogopen', 'event type in callback'); + deepEqual(ui, {}, 'ui hash in callback'); } }).bind('dialogopen', function(ev, ui) { ok(el.data("dialog")._isOpen, "interal _isOpen flag is set"); ok(true, 'dialog("open") fires open event'); - equals(this, el[0], 'context of event'); - same(ui, {}, 'ui hash in event'); + equal(this, el[0], 'context of event'); + deepEqual(ui, {}, 'ui hash in event'); }); el.dialog("open"); el.remove(); @@ -45,14 +45,14 @@ test("dragStart", function() { el = $('<div></div>').dialog({ dragStart: function(ev, ui) { ok(true, 'dragging fires dragStart callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogdragstart', 'event type in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogdragstart', 'event type in callback'); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.offset !== undefined, "ui.offset in callback"); } }).bind('dialogdragstart', function(ev, ui) { ok(true, 'dragging fires dialogdragstart event'); - equals(this, el[0], 'context of event'); + equal(this, el[0], 'context of event'); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.offset !== undefined, "ui.offset in callback"); }); @@ -64,22 +64,22 @@ test("dragStart", function() { test("drag", function() { expect(9); var hasDragged = false; - + el = $('<div></div>').dialog({ drag: function(ev, ui) { if (!hasDragged) { ok(true, 'dragging fires drag callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogdrag', 'event type in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogdrag', 'event type in callback'); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.offset !== undefined, "ui.offset in callback"); - + hasDragged = true; } } }).one('dialogdrag', function(ev, ui) { ok(true, 'dragging fires dialogdrag event'); - equals(this, el[0], 'context of event'); + equal(this, el[0], 'context of event'); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.offset !== undefined, "ui.offset in callback"); }); @@ -94,14 +94,14 @@ test("dragStop", function() { el = $('<div></div>').dialog({ dragStop: function(ev, ui) { ok(true, 'dragging fires dragStop callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogdragstop', 'event type in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogdragstop', 'event type in callback'); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.offset !== undefined, "ui.offset in callback"); } }).bind('dialogdragstop', function(ev, ui) { ok(true, 'dragging fires dialogdragstop event'); - equals(this, el[0], 'context of event'); + equal(this, el[0], 'context of event'); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.offset !== undefined, "ui.offset in callback"); }); @@ -116,8 +116,8 @@ test("resizeStart", function() { el = $('<div></div>').dialog({ resizeStart: function(ev, ui) { ok(true, 'resizing fires resizeStart callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogresizestart', 'event type in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogresizestart', 'event type in callback'); ok(ui.originalPosition !== undefined, "ui.originalPosition in callback"); ok(ui.originalSize !== undefined, "ui.originalSize in callback"); ok(ui.position !== undefined, "ui.position in callback"); @@ -125,7 +125,7 @@ test("resizeStart", function() { } }).bind('dialogresizestart', function(ev, ui) { ok(true, 'resizing fires dialogresizestart event'); - equals(this, el[0], 'context of event'); + equal(this, el[0], 'context of event'); ok(ui.originalPosition !== undefined, "ui.originalPosition in callback"); ok(ui.originalSize !== undefined, "ui.originalSize in callback"); ok(ui.position !== undefined, "ui.position in callback"); @@ -144,19 +144,19 @@ test("resize", function() { resize: function(ev, ui) { if (!hasResized) { ok(true, 'resizing fires resize callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogresize', 'event type in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogresize', 'event type in callback'); ok(ui.originalPosition !== undefined, "ui.originalPosition in callback"); ok(ui.originalSize !== undefined, "ui.originalSize in callback"); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.size !== undefined, "ui.size in callback"); - + hasResized = true; } } }).one('dialogresize', function(ev, ui) { ok(true, 'resizing fires dialogresize event'); - equals(this, el[0], 'context of event'); + equal(this, el[0], 'context of event'); ok(ui.originalPosition !== undefined, "ui.originalPosition in callback"); ok(ui.originalSize !== undefined, "ui.originalSize in callback"); ok(ui.position !== undefined, "ui.position in callback"); @@ -173,8 +173,8 @@ test("resizeStop", function() { el = $('<div></div>').dialog({ resizeStop: function(ev, ui) { ok(true, 'resizing fires resizeStop callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogresizestop', 'event type in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogresizestop', 'event type in callback'); ok(ui.originalPosition !== undefined, "ui.originalPosition in callback"); ok(ui.originalSize !== undefined, "ui.originalSize in callback"); ok(ui.position !== undefined, "ui.position in callback"); @@ -182,7 +182,7 @@ test("resizeStop", function() { } }).bind('dialogresizestop', function(ev, ui) { ok(true, 'resizing fires dialogresizestop event'); - equals(this, el[0], 'context of event'); + equal(this, el[0], 'context of event'); ok(ui.originalPosition !== undefined, "ui.originalPosition in callback"); ok(ui.originalSize !== undefined, "ui.originalSize in callback"); ok(ui.position !== undefined, "ui.position in callback"); @@ -199,14 +199,14 @@ test("close", function() { el = $('<div></div>').dialog({ close: function(ev, ui) { ok(true, '.dialog("close") fires close callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogclose', 'event type in callback'); - same(ui, {}, 'ui hash in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogclose', 'event type in callback'); + deepEqual(ui, {}, 'ui hash in callback'); } }).bind('dialogclose', function(ev, ui) { ok(true, '.dialog("close") fires dialogclose event'); - equals(this, el[0], 'context of event'); - same(ui, {}, 'ui hash in event'); + equal(this, el[0], 'context of event'); + deepEqual(ui, {}, 'ui hash in event'); }); el.dialog('close'); el.remove(); @@ -218,9 +218,9 @@ test("beforeClose", function() { el = $('<div></div>').dialog({ beforeClose: function(ev, ui) { ok(true, '.dialog("close") fires beforeClose callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogbeforeclose', 'event type in callback'); - same(ui, {}, 'ui hash in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogbeforeclose', 'event type in callback'); + deepEqual(ui, {}, 'ui hash in callback'); return false; } }); @@ -231,9 +231,9 @@ test("beforeClose", function() { el = $('<div></div>').dialog(); el.dialog('option', 'beforeClose', function(ev, ui) { ok(true, '.dialog("close") fires beforeClose callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogbeforeclose', 'event type in callback'); - same(ui, {}, 'ui hash in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogbeforeclose', 'event type in callback'); + deepEqual(ui, {}, 'ui hash in callback'); return false; }); el.dialog('close'); @@ -242,8 +242,8 @@ test("beforeClose", function() { el = $('<div></div>').dialog().bind('dialogbeforeclose', function(ev, ui) { ok(true, '.dialog("close") triggers dialogbeforeclose event'); - equals(this, el[0], "context of event"); - same(ui, {}, 'ui hash in event'); + equal(this, el[0], "context of event"); + deepEqual(ui, {}, 'ui hash in event'); return false; }); el.dialog('close'); diff --git a/tests/unit/dialog/dialog_methods.js b/tests/unit/dialog/dialog_methods.js index a961b4e03..645baa9f5 100644 --- a/tests/unit/dialog/dialog_methods.js +++ b/tests/unit/dialog/dialog_methods.js @@ -45,36 +45,36 @@ test("destroy", function() { var expected = $('<div></div>').dialog(), actual = expected.dialog('destroy'); - equals(actual, expected, 'destroy is chainable'); + equal(actual, expected, 'destroy is chainable'); }); test("enable", function() { var expected = $('<div></div>').dialog(), actual = expected.dialog('enable'); - equals(actual, expected, 'enable is chainable'); - + equal(actual, expected, 'enable is chainable'); + el = $('<div></div>').dialog({ disabled: true }); el.dialog('enable'); - equals(el.dialog('option', 'disabled'), false, 'enable method sets disabled option to false'); + equal(el.dialog('option', 'disabled'), false, 'enable method sets disabled option to false'); ok(!dlg().hasClass('ui-dialog-disabled'), 'enable method removes ui-dialog-disabled class from ui-dialog element'); }); test("disable", function() { var expected = $('<div></div>').dialog(), actual = expected.dialog('disable'); - equals(actual, expected, 'disable is chainable'); - + equal(actual, expected, 'disable is chainable'); + el = $('<div></div>').dialog({ disabled: false }); el.dialog('disable'); - equals(el.dialog('option', 'disabled'), true, 'disable method sets disabled option to true'); + equal(el.dialog('option', 'disabled'), true, 'disable method sets disabled option to true'); ok(dlg().hasClass('ui-dialog-disabled'), 'disable method adds ui-dialog-disabled class to ui-dialog element'); }); test("close", function() { var expected = $('<div></div>').dialog(), actual = expected.dialog('close'); - equals(actual, expected, 'close is chainable'); - + equal(actual, expected, 'close is chainable'); + el = $('<div></div>').dialog(); ok(dlg().is(':visible') && !dlg().is(':hidden'), 'dialog visible before close method called'); el.dialog('close'); @@ -85,22 +85,22 @@ test("isOpen", function() { expect(4); el = $('<div></div>').dialog(); - equals(el.dialog('isOpen'), true, "dialog is open after init"); + equal(el.dialog('isOpen'), true, "dialog is open after init"); el.dialog('close'); - equals(el.dialog('isOpen'), false, "dialog is closed"); + equal(el.dialog('isOpen'), false, "dialog is closed"); el.remove(); el = $('<div></div>').dialog({autoOpen: false}); - equals(el.dialog('isOpen'), false, "dialog is closed after init"); + equal(el.dialog('isOpen'), false, "dialog is closed after init"); el.dialog('open'); - equals(el.dialog('isOpen'), true, "dialog is open"); + equal(el.dialog('isOpen'), true, "dialog is open"); el.remove(); }); test("moveToTop", function() { var expected = $('<div></div>').dialog(), actual = expected.dialog('moveToTop'); - equals(actual, expected, 'moveToTop is chainable'); + equal(actual, expected, 'moveToTop is chainable'); var d1 = $('<div></div>').dialog(), dlg1 = d1.parents('.ui-dialog'); d1.dialog('close'); @@ -116,7 +116,7 @@ test("moveToTop", function() { test("open", function() { var expected = $('<div></div>').dialog(), actual = expected.dialog('open'); - equals(actual, expected, 'open is chainable'); + equal(actual, expected, 'open is chainable'); el = $('<div></div>').dialog({ autoOpen: false }); ok(dlg().is(':hidden') && !dlg().is(':visible'), 'dialog hidden before open method called'); diff --git a/tests/unit/dialog/dialog_options.js b/tests/unit/dialog/dialog_options.js index 264c2fb6e..10443892b 100644 --- a/tests/unit/dialog/dialog_options.js +++ b/tests/unit/dialog/dialog_options.js @@ -23,58 +23,58 @@ test("buttons", function() { var buttons = { "Ok": function(ev, ui) { ok(true, "button click fires callback"); - equals(this, el[0], "context of callback"); - equals(ev.target, btn[0], "event target"); + equal(this, el[0], "context of callback"); + equal(ev.target, btn[0], "event target"); }, "Cancel": function(ev, ui) { ok(true, "button click fires callback"); - equals(this, el[0], "context of callback"); - equals(ev.target, btn[1], "event target"); + equal(this, el[0], "context of callback"); + equal(ev.target, btn[1], "event target"); } }; el = $('<div></div>').dialog({ buttons: buttons }); var btn = $("button", dlg()); - equals(btn.length, 2, "number of buttons"); + equal(btn.length, 2, "number of buttons"); var i = 0; $.each(buttons, function(key, val) { - equals(btn.eq(i).text(), key, "text of button " + (i+1)); + equal(btn.eq(i).text(), key, "text of button " + (i+1)); i++; }); ok(btn.parent().hasClass('ui-dialog-buttonset'), "buttons in container"); ok(el.parent().hasClass('ui-dialog-buttons'), "dialog wrapper adds class about having buttons"); - + btn.trigger("click"); var newButtons = { "Close": function(ev, ui) { ok(true, "button click fires callback"); - equals(this, el[0], "context of callback"); - equals(ev.target, btn[0], "event target"); + equal(this, el[0], "context of callback"); + equal(ev.target, btn[0], "event target"); } }; - same(el.dialog("option", "buttons"), buttons, '.dialog("option", "buttons") getter'); + deepEqual(el.dialog("option", "buttons"), buttons, '.dialog("option", "buttons") getter'); el.dialog("option", "buttons", newButtons); - same(el.dialog("option", "buttons"), newButtons, '.dialog("option", "buttons", ...) setter'); + deepEqual(el.dialog("option", "buttons"), newButtons, '.dialog("option", "buttons", ...) setter'); btn = $("button", dlg()); - equals(btn.length, 1, "number of buttons after setter"); + equal(btn.length, 1, "number of buttons after setter"); btn.trigger('click'); i = 0; $.each(newButtons, function(key, val) { - equals(btn.eq(i).text(), key, "text of button " + (i+1)); + equal(btn.eq(i).text(), key, "text of button " + (i+1)); i += 1; }); - + el.dialog("option", "buttons", null); btn = $("button", dlg()); - equals(btn.length, 0, "all buttons have been removed"); - equals(el.find(".ui-dialog-buttonset").length, 0, "buttonset has been removed"); - equals(el.parent().hasClass('ui-dialog-buttons'), false, "dialog wrapper removes class about having buttons"); + equal(btn.length, 0, "all buttons have been removed"); + equal(el.find(".ui-dialog-buttonset").length, 0, "buttonset has been removed"); + equal(el.parent().hasClass('ui-dialog-buttons'), false, "dialog wrapper removes class about having buttons"); el.remove(); }); @@ -89,15 +89,15 @@ test("buttons - advanced", function() { "class": "additional-class", id: "my-button-id", click: function() { - equals(this, el[0], "correct context"); + equal(this, el[0], "correct context"); } } ] }); var buttons = dlg().find("button"); - equals(buttons.length, 1, "correct number of buttons"); - equals(buttons.attr("id"), "my-button-id", "correct id"); - equals(buttons.text(), "a button", "correct label"); + equal(buttons.length, 1, "correct number of buttons"); + equal(buttons.attr("id"), "my-button-id", "correct id"); + equal(buttons.text(), "a button", "correct label"); ok(buttons.hasClass("additional-class"), "additional classes added"); buttons.click(); @@ -112,9 +112,9 @@ test("closeOnEscape", function() { .simulate('keypress', { keyCode: $.ui.keyCode.ESCAPE }) .simulate('keyup', { keyCode: $.ui.keyCode.ESCAPE }); ok(dlg().is(':visible') && !dlg().is(':hidden'), 'dialog is open after ESC'); - + el.remove(); - + el = $('<div></div>').dialog({ closeOnEscape: true }); ok(true, 'closeOnEscape: true'); ok(dlg().is(':visible') && !dlg().is(':hidden'), 'dialog is open before ESC'); @@ -128,17 +128,17 @@ test("closeText", function() { expect(3); el = $('<div></div>').dialog(); - equals(dlg().find('.ui-dialog-titlebar-close span').text(), 'close', + equal(dlg().find('.ui-dialog-titlebar-close span').text(), 'close', 'default close text'); el.remove(); el = $('<div></div>').dialog({ closeText: "foo" }); - equals(dlg().find('.ui-dialog-titlebar-close span').text(), 'foo', + equal(dlg().find('.ui-dialog-titlebar-close span').text(), 'foo', 'closeText on init'); el.remove(); el = $('<div></div>').dialog().dialog('option', 'closeText', 'bar'); - equals(dlg().find('.ui-dialog-titlebar-close span').text(), 'bar', + equal(dlg().find('.ui-dialog-titlebar-close span').text(), 'bar', 'closeText via option method'); el.remove(); }); @@ -147,16 +147,16 @@ test("dialogClass", function() { expect(4); el = $('<div></div>').dialog(); - equals(dlg().is(".foo"), false, 'dialogClass not specified. foo class added'); + equal(dlg().is(".foo"), false, 'dialogClass not specified. foo class added'); el.remove(); el = $('<div></div>').dialog({ dialogClass: "foo" }); - equals(dlg().is(".foo"), true, 'dialogClass in init. foo class added'); + equal(dlg().is(".foo"), true, 'dialogClass in init. foo class added'); el.remove(); el = $('<div></div>').dialog({ dialogClass: "foo bar" }); - equals(dlg().is(".foo"), true, 'dialogClass in init, two classes. foo class added'); - equals(dlg().is(".bar"), true, 'dialogClass in init, two classes. bar class added'); + equal(dlg().is(".foo"), true, 'dialogClass in init, two classes. foo class added'); + equal(dlg().is(".bar"), true, 'dialogClass in init, two classes. bar class added'); el.remove(); }); @@ -180,21 +180,21 @@ test("height", function() { expect(4); el = $('<div></div>').dialog(); - equals(dlg().outerHeight(), 150, "default height"); + equal(dlg().outerHeight(), 150, "default height"); el.remove(); el = $('<div></div>').dialog({ height: 237 }); - equals(dlg().outerHeight(), 237, "explicit height"); + equal(dlg().outerHeight(), 237, "explicit height"); el.remove(); el = $('<div></div>').dialog(); el.dialog('option', 'height', 238); - equals(dlg().outerHeight(), 238, "explicit height set after init"); + equal(dlg().outerHeight(), 238, "explicit height set after init"); el.remove(); - + el = $('<div></div>').css("padding", "20px") .dialog({ height: 240 }); - equals(dlg().outerHeight(), 240, "explicit height with padding"); + equal(dlg().outerHeight(), 240, "explicit height with padding"); el.remove(); }); @@ -203,17 +203,17 @@ test("maxHeight", function() { el = $('<div></div>').dialog({ maxHeight: 200 }); drag('.ui-resizable-s', 1000, 1000); - equals(heightAfter, 200, "maxHeight"); + equal(heightAfter, 200, "maxHeight"); el.remove(); el = $('<div></div>').dialog({ maxHeight: 200 }); drag('.ui-resizable-n', -1000, -1000); - equals(heightAfter, 200, "maxHeight"); + equal(heightAfter, 200, "maxHeight"); el.remove(); el = $('<div></div>').dialog({ maxHeight: 200 }).dialog('option', 'maxHeight', 300); drag('.ui-resizable-s', 1000, 1000); - equals(heightAfter, 300, "maxHeight"); + equal(heightAfter, 300, "maxHeight"); el.remove(); }); @@ -222,17 +222,17 @@ test("maxWidth", function() { el = $('<div></div>').dialog({ maxWidth: 200 }); drag('.ui-resizable-e', 1000, 1000); - equals(widthAfter, 200, "maxWidth"); + equal(widthAfter, 200, "maxWidth"); el.remove(); el = $('<div></div>').dialog({ maxWidth: 200 }); drag('.ui-resizable-w', -1000, -1000); - equals(widthAfter, 200, "maxWidth"); + equal(widthAfter, 200, "maxWidth"); el.remove(); el = $('<div></div>').dialog({ maxWidth: 200 }).dialog('option', 'maxWidth', 300); drag('.ui-resizable-w', -1000, -1000); - equals(widthAfter, 300, "maxWidth"); + equal(widthAfter, 300, "maxWidth"); el.remove(); }); @@ -241,17 +241,17 @@ test("minHeight", function() { el = $('<div></div>').dialog({ minHeight: 10 }); drag('.ui-resizable-s', -1000, -1000); - equals(heightAfter, 10, "minHeight"); + equal(heightAfter, 10, "minHeight"); el.remove(); el = $('<div></div>').dialog({ minHeight: 10 }); drag('.ui-resizable-n', 1000, 1000); - equals(heightAfter, 10, "minHeight"); + equal(heightAfter, 10, "minHeight"); el.remove(); el = $('<div></div>').dialog({ minHeight: 10 }).dialog('option', 'minHeight', 30); drag('.ui-resizable-n', 1000, 1000); - equals(heightAfter, 30, "minHeight"); + equal(heightAfter, 30, "minHeight"); el.remove(); }); @@ -260,17 +260,17 @@ test("minWidth", function() { el = $('<div></div>').dialog({ minWidth: 10 }); drag('.ui-resizable-e', -1000, -1000); - equals(widthAfter, 10, "minWidth"); + equal(widthAfter, 10, "minWidth"); el.remove(); el = $('<div></div>').dialog({ minWidth: 10 }); drag('.ui-resizable-w', 1000, 1000); - equals(widthAfter, 10, "minWidth"); + equal(widthAfter, 10, "minWidth"); el.remove(); el = $('<div></div>').dialog({ minWidth: 30 }).dialog('option', 'minWidth', 30); drag('.ui-resizable-w', 1000, 1000); - equals(widthAfter, 30, "minWidth"); + equal(widthAfter, 30, "minWidth"); el.remove(); }); @@ -278,8 +278,8 @@ 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.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft()); - same(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop()); + deepEqual(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft()); + deepEqual(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop()); el.remove(); }); @@ -287,8 +287,8 @@ 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.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft()); - same(offset.top, $(window).scrollTop()); + deepEqual(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft()); + deepEqual(offset.top, $(window).scrollTop()); el.remove(); }); @@ -296,8 +296,8 @@ test("position, left on window", function() { var el = $('<div></div>').dialog({ position: "left" }); var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, 0); - same(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop()); + deepEqual(offset.left, 0); + deepEqual(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop()); el.remove(); }); @@ -305,8 +305,8 @@ test("position, right bottom on window", function() { var el = $('<div></div>').dialog({ position: "right bottom" }); var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft()); - same(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop()); + deepEqual(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft()); + deepEqual(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop()); el.remove(); }); @@ -314,8 +314,8 @@ test("position, right bottom on window w/array", function() { var el = $('<div></div>').dialog({ position: ["right", "bottom"] }); var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft()); - same(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop()); + deepEqual(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft()); + deepEqual(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop()); el.remove(); }); @@ -323,8 +323,8 @@ test("position, offset from top left w/array", function() { var el = $('<div></div>').dialog({ position: [10, 10] }); var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, 10 + $(window).scrollLeft()); - same(offset.top, 10 + $(window).scrollTop()); + deepEqual(offset.left, 10 + $(window).scrollLeft()); + deepEqual(offset.top, 10 + $(window).scrollTop()); el.remove(); }); @@ -339,8 +339,8 @@ test("position, right bottom at right bottom via ui.position args", function() { var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft()); - same(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop()); + deepEqual(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft()); + deepEqual(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop()); el.remove(); }); @@ -364,8 +364,8 @@ test("position, at another element", function() { var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, 600); - same(offset.top, 400); + deepEqual(offset.left, 600); + deepEqual(offset.top, 400); el.dialog('option', 'position', { my: "left top", @@ -375,8 +375,8 @@ test("position, at another element", function() { var offset = dialog.offset(); - same(offset.left, 610); - same(offset.top, 410); + deepEqual(offset.left, 610); + deepEqual(offset.top, 410); el.remove(); parent.remove(); @@ -408,27 +408,27 @@ test("title", function() { el = $('<div></div>').dialog(); // some browsers return a non-breaking space and some return " " // so we get the text to normalize to the actual non-breaking space - equals(dlg().find(".ui-dialog-title").text(), " ", "[default]"); - equals(el.dialog("option", "title"), "", "option not changed"); + equal(dlg().find(".ui-dialog-title").text(), " ", "[default]"); + equal(el.dialog("option", "title"), "", "option not changed"); el.remove(); el = $('<div title="foo">').dialog(); - equals(titleText(), "foo", "title in element attribute"); - equals(el.dialog("option", "title"), "foo", "option updated from attribute"); + equal(titleText(), "foo", "title in element attribute"); + equal(el.dialog("option", "title"), "foo", "option updated from attribute"); el.remove(); el = $('<div></div>').dialog({ title: 'foo' }); - equals(titleText(), "foo", "title in init options"); - equals(el.dialog("option", "title"), "foo", "opiton set from options hash"); + equal(titleText(), "foo", "title in init options"); + equal(el.dialog("option", "title"), "foo", "opiton set from options hash"); el.remove(); el = $('<div title="foo">').dialog({ title: 'bar' }); - equals(titleText(), "bar", "title in init options should override title in element attribute"); - equals(el.dialog("option", "title"), "bar", "opiton set from options hash"); + equal(titleText(), "bar", "title in init options should override title in element attribute"); + equal(el.dialog("option", "title"), "bar", "opiton set from options hash"); el.remove(); el = $('<div></div>').dialog().dialog('option', 'title', 'foo'); - equals(titleText(), 'foo', 'title after init'); + equal(titleText(), 'foo', 'title after init'); el.remove(); }); @@ -436,13 +436,13 @@ test("width", function() { expect(3); el = $('<div></div>').dialog(); - equals(dlg().width(), 300, "default width"); + equal(dlg().width(), 300, "default width"); el.remove(); el = $('<div></div>').dialog({width: 437 }); - equals(dlg().width(), 437, "explicit width"); + equal(dlg().width(), 437, "explicit width"); el.dialog('option', 'width', 438); - equals(dlg().width(), 438, 'explicit width after init'); + equal(dlg().width(), 438, 'explicit width after init'); el.remove(); }); diff --git a/tests/unit/dialog/dialog_tickets.js b/tests/unit/dialog/dialog_tickets.js index f8ab8b423..bd9056153 100644 --- a/tests/unit/dialog/dialog_tickets.js +++ b/tests/unit/dialog/dialog_tickets.js @@ -41,7 +41,7 @@ test("#4826: setting resizable false toggles resizable on dialog", function() { shouldnotresize("[default]"); for (var i=0; i<2; i++) { el.dialog('close').dialog('open'); - shouldnotresize('initialized with resizable false toggle ('+ (i+1) +')'); + shouldnotresize('initialized with resizable false toggle ('+ (i+1) +')'); } el.remove(); @@ -49,10 +49,10 @@ test("#4826: setting resizable false toggles resizable on dialog", function() { shouldresize("[default]"); for (var i=0; i<2; i++) { el.dialog('close').dialog('option', 'resizable', false).dialog('open'); - shouldnotresize('set option resizable false toggle ('+ (i+1) +')'); + shouldnotresize('set option resizable false toggle ('+ (i+1) +')'); } el.remove(); - + }); test("#5184: isOpen in dialogclose event is true", function() { @@ -75,11 +75,11 @@ test("#5531: dialog width should be at least minWidth on creation", function () minWidth: 300 }); - equals(el.dialog('option', 'width'), 300, "width is minWidth"); + equal(el.dialog('option', 'width'), 300, "width is minWidth"); el.dialog('option', 'width', 200); - equals(el.dialog('option', 'width'), 300, "width unchanged when set to < minWidth"); + equal(el.dialog('option', 'width'), 300, "width unchanged when set to < minWidth"); el.dialog('option', 'width', 320); - equals(el.dialog('option', 'width'), 320, "width changed if set to > minWidth"); + equal(el.dialog('option', 'width'), 320, "width changed if set to > minWidth"); el.remove(); el = $('<div></div>').dialog({ @@ -109,9 +109,9 @@ test("#6645: Missing element not found check in overlay", function(){ expect(2); d1 = $('<div title="dialog 1">Dialog 1</div>').dialog({modal: true}); d2 = $('<div title="dialog 2">Dialog 2</div>').dialog({modal: true, close: function(){ d2.remove()}}); - equals($.ui.dialog.overlay.instances.length, 2, 'two overlays created'); + equal($.ui.dialog.overlay.instances.length, 2, 'two overlays created'); d2.dialog('close'); - equals($.ui.dialog.overlay.instances.length, 1, 'one overlay remains after closing the 2nd overlay'); + equal($.ui.dialog.overlay.instances.length, 1, 'one overlay remains after closing the 2nd overlay'); d1.add(d2).remove(); }); |