aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/dialog
diff options
context:
space:
mode:
authorAlexander Schmitz <arschmitz@gmail.com>2015-01-30 09:57:04 -0500
committerAlexander Schmitz <arschmitz@gmail.com>2015-03-11 16:05:39 -0400
commita9fa490418c911ff8a170c5d2e87e5dbc3be3ea3 (patch)
tree1d5449288b599ec15b9f64e13221a6f365c948fd /tests/unit/dialog
parent415675eca122c6fcc635bb41838f303bdb8fa6f8 (diff)
downloadjquery-ui-a9fa490418c911ff8a170c5d2e87e5dbc3be3ea3.tar.gz
jquery-ui-a9fa490418c911ff8a170c5d2e87e5dbc3be3ea3.zip
Dialog: Use new has/lacksClasses assertions for all class checks
Diffstat (limited to 'tests/unit/dialog')
-rw-r--r--tests/unit/dialog/dialog_common_deprecated.js2
-rw-r--r--tests/unit/dialog/dialog_deprecated.html2
-rw-r--r--tests/unit/dialog/dialog_deprecated.js15
-rw-r--r--tests/unit/dialog/dialog_methods.js7
-rw-r--r--tests/unit/dialog/dialog_options.js13
5 files changed, 18 insertions, 21 deletions
diff --git a/tests/unit/dialog/dialog_common_deprecated.js b/tests/unit/dialog/dialog_common_deprecated.js
index 9ecf6a459..30658696e 100644
--- a/tests/unit/dialog/dialog_common_deprecated.js
+++ b/tests/unit/dialog/dialog_common_deprecated.js
@@ -8,7 +8,7 @@ TestHelpers.commonWidgetTests( "dialog", {
"ui-dialog-titlebar": "ui-corner-all"
},
closeOnEscape: true,
- closeText: "close",
+ closeText: "Close",
dialogClass: "",
disabled: false,
draggable: true,
diff --git a/tests/unit/dialog/dialog_deprecated.html b/tests/unit/dialog/dialog_deprecated.html
index b26c38e9a..5bcdf75e5 100644
--- a/tests/unit/dialog/dialog_deprecated.html
+++ b/tests/unit/dialog/dialog_deprecated.html
@@ -30,7 +30,7 @@
});
</script>
- <script src="dialog_common_derecated.js"></script>
+ <script src="dialog_common_deprecated.js"></script>
<script src="dialog_core.js"></script>
<script src="dialog_events.js"></script>
<script src="dialog_methods.js"></script>
diff --git a/tests/unit/dialog/dialog_deprecated.js b/tests/unit/dialog/dialog_deprecated.js
index 6a26c229e..55c180457 100644
--- a/tests/unit/dialog/dialog_deprecated.js
+++ b/tests/unit/dialog/dialog_deprecated.js
@@ -2,26 +2,25 @@
module( "dialog (deprecated): options" );
-test( "dialogClass", function() {
- expect( 6 );
+test( "dialogClass", function( assert ) {
+ expect( 5 );
var element = $( "<div>" ).dialog(),
widget = element.dialog( "widget" );
- equal( widget.is( ".foo" ), false, "dialogClass not specified. class not added" );
+ assert.lacksClasses( widget, "foo", "dialogClass not specified. class not added" );
element.remove();
element = $( "<div>" ).dialog({ dialogClass: "foo" });
widget = element.dialog( "widget" );
- equal( widget.is( ".foo" ), true, "dialogClass in init, foo class added" );
+ assert.hasClasses( widget, "foo", "dialogClass in init, foo class added" );
element.dialog( "option", "dialogClass", "foobar" );
- equal( widget.is( ".foo" ), false, "dialogClass changed, previous one was removed" );
- equal( widget.is( ".foobar" ), true, "dialogClass changed, new one was added" );
+ assert.lacksClasses( widget, "foo", "dialogClass changed, previous one was removed" );
+ assert.hasClasses( widget, "foobar", "dialogClass changed, new one was added" );
element.remove();
element = $( "<div>" ).dialog({ dialogClass: "foo bar" });
widget = element.dialog( "widget" );
- equal( widget.is( ".foo" ), true, "dialogClass in init, two classes. foo class added" );
- equal( widget.is( ".bar" ), true, "dialogClass in init, two classes. bar class added" );
+ assert.hasClasses( widget, "foo bar", "dialogClass in init, two classes." );
element.remove();
});
diff --git a/tests/unit/dialog/dialog_methods.js b/tests/unit/dialog/dialog_methods.js
index ea4a7002a..c012f80a5 100644
--- a/tests/unit/dialog/dialog_methods.js
+++ b/tests/unit/dialog/dialog_methods.js
@@ -100,13 +100,12 @@ test("#4980: Destroy should place element back in original DOM position", functi
ok($.contains(container[0], modal[0]), "dialog(destroy) should place element back in original DOM position");
});
-test( "enable/disable disabled", function() {
- expect( 4 );
+test( "enable/disable disabled", function( assert ) {
+ expect( 3 );
var element = $( "<div></div>" ).dialog();
element.dialog( "disable" );
equal(element.dialog( "option", "disabled" ), false, "disable method doesn't do anything" );
- ok( !element.dialog( "widget" ).hasClass( "ui-dialog-disabled" ), "disable method doesn't add ui-dialog-disabled class" );
- ok( !element.dialog( "widget" ).hasClass( "ui-state-disabled" ), "disable method doesn't add ui-state-disabled class" );
+ assert.lacksClasses( element, "ui-dialog-disabled ui-state-disabled" );
ok( !element.dialog( "widget" ).attr( "aria-disabled" ), "disable method doesn't add aria-disabled" );
});
diff --git a/tests/unit/dialog/dialog_options.js b/tests/unit/dialog/dialog_options.js
index d9920b9fc..6cc309ca4 100644
--- a/tests/unit/dialog/dialog_options.js
+++ b/tests/unit/dialog/dialog_options.js
@@ -78,7 +78,7 @@ test("autoOpen", function() {
element.remove();
});
-test("buttons", function() {
+test("buttons", function( assert ) {
expect(21);
var btn, i, newButtons,
@@ -105,8 +105,8 @@ test("buttons", function() {
i++;
});
- ok(btn.parent().hasClass("ui-dialog-buttonset"), "buttons in container");
- ok(element.parent().hasClass("ui-dialog-buttons"), "dialog wrapper adds class about having buttons");
+ assert.hasClasses( btn.parent(), "ui-dialog-buttonset" );
+ assert.hasClasses( element.parent(), "ui-dialog-buttons" );
btn.trigger("click");
@@ -136,12 +136,11 @@ test("buttons", function() {
btn = element.dialog( "widget" ).find( ".ui-dialog-buttonpane button" );
equal(btn.length, 0, "all buttons have been removed");
equal(element.find(".ui-dialog-buttonset").length, 0, "buttonset has been removed");
- equal(element.parent().hasClass("ui-dialog-buttons"), false, "dialog wrapper removes class about having buttons");
-
+ assert.lacksClasses( element.parent(), "ui-dialog-buttons" );
element.remove();
});
-test("buttons - advanced", function() {
+test("buttons - advanced", function( assert ) {
expect( 7 );
var buttons,
@@ -166,7 +165,7 @@ test("buttons - advanced", function() {
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");
+ assert.hasClasses( buttons, "additional-class" );
deepEqual( buttons.button("option", "icons"), { primary: "ui-icon-cancel", secondary: null } );
equal( buttons.button( "option", "text" ), false );
buttons.click();