aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlexander Schmitz <arschmitz@gmail.com>2015-01-30 10:59:50 -0500
committerAlexander Schmitz <arschmitz@gmail.com>2015-03-11 16:05:40 -0400
commitf7645783bf6c224f75a796ed146154559152e4cb (patch)
tree7547863de4ce25db0c451fbabd4c8de31ce08da2 /tests
parent8f26f0ad1ab384ca7a2308ce5128c2bb28fea2ce (diff)
downloadjquery-ui-f7645783bf6c224f75a796ed146154559152e4cb.tar.gz
jquery-ui-f7645783bf6c224f75a796ed146154559152e4cb.zip
Spinner: Use new has/lacksClasses assertions for all class checks
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/spinner/spinner_methods.js15
-rw-r--r--tests/unit/spinner/spinner_options.js20
2 files changed, 19 insertions, 16 deletions
diff --git a/tests/unit/spinner/spinner_methods.js b/tests/unit/spinner/spinner_methods.js
index cc4bc5a16..61ff21d1c 100644
--- a/tests/unit/spinner/spinner_methods.js
+++ b/tests/unit/spinner/spinner_methods.js
@@ -11,17 +11,16 @@ test( "destroy", function() {
});
});
-test( "disable", function() {
- expect( 16 );
+test( "disable", function( assert ) {
+ expect( 15 );
var element = $( "#spin" ).val( 2 ).spinner(),
wrapper = $( "#spin" ).spinner( "widget" );
- ok( !wrapper.hasClass( "ui-spinner-disabled" ), "before: wrapper does not have ui-spinner-disabled class" );
+ assert.lacksClasses( wrapper, "ui-spinner-disabled" );
ok( !element.is( ":disabled" ), "before: input does not have disabled attribute" );
element.spinner( "disable" );
- ok( wrapper.hasClass( "ui-spinner-disabled" ), "after: wrapper has ui-spinner-disabled class" );
- ok( wrapper.hasClass( "ui-state-disabled" ), "after: wrapper has ui-state-disabled class" );
+ assert.hasClasses( wrapper, "ui-state-disabled ui-spinner-disabled" );
ok( !wrapper.attr( "aria-disabled" ), "after: wrapper does not have aria-disabled attr" );
ok( element.is( ":disabled"), "after: input has disabled attribute" );
@@ -56,17 +55,17 @@ test( "disable", function() {
equal( 7, element.val(), "script - pageDown 1 page changes value" );
});
-test( "enable", function() {
+test( "enable", function( assert ) {
expect( 5 );
var element = $( "#spin" ).val( 1 ).spinner({ disabled: true }),
wrapper = element.spinner( "widget" );
- ok( wrapper.hasClass( "ui-spinner-disabled" ), "before: wrapper has ui-spinner-disabled class" );
+ assert.hasClasses( wrapper, "ui-spinner-disabled" );
ok( element.is( ":disabled" ), "before: input has disabled attribute" );
element.spinner( "enable" );
- ok( !wrapper.hasClass( ".ui-spinner-disabled" ), "after: wrapper does not have ui-spinner-disabled class" );
+ assert.lacksClasses( wrapper, "ui-spinner-disabled" );
ok( !element.is( ":disabled" ), "after: input does not have disabled attribute" );
simulateKeyDownUp( element, $.ui.keyCode.UP );
diff --git a/tests/unit/spinner/spinner_options.js b/tests/unit/spinner/spinner_options.js
index 65bbd2602..160b600c6 100644
--- a/tests/unit/spinner/spinner_options.js
+++ b/tests/unit/spinner/spinner_options.js
@@ -4,21 +4,25 @@ module( "spinner: options" );
// culture is tested after numberFormat, since it depends on numberFormat
-test( "icons: default ", function() {
+test( "icons: default ", function( assert ) {
expect( 4 );
var element = $( "#spin" ).val( 0 ).spinner();
- equal( element.spinner( "widget" ).find( ".ui-icon:first" ).attr( "class" ), "ui-icon ui-icon-triangle-1-n" );
- equal( element.spinner( "widget" ).find( ".ui-icon:last" ).attr( "class" ), "ui-icon ui-icon-triangle-1-s" );
+ assert.hasClasses( element.spinner( "widget" ).find( ".ui-icon:first" ),
+ "ui-icon ui-icon-triangle-1-n" );
+ assert.hasClasses( element.spinner( "widget" ).find( ".ui-icon:last" ),
+ "ui-icon ui-icon-triangle-1-s" );
element.spinner( "option", "icons", {
up: "ui-icon-caret-1-n",
down: "ui-icon-caret-1-s"
});
- equal( element.spinner( "widget" ).find( ".ui-icon:first" ).attr( "class" ), "ui-icon ui-icon-caret-1-n" );
- equal( element.spinner( "widget" ).find( ".ui-icon:last" ).attr( "class" ), "ui-icon ui-icon-caret-1-s" );
+ assert.hasClasses( element.spinner( "widget" ).find( ".ui-icon:first" ),
+ "ui-icon ui-icon-caret-1-n" );
+ assert.hasClasses( element.spinner( "widget" ).find( ".ui-icon:last" ),
+ "ui-icon ui-icon-caret-1-s" );
});
-test( "icons: custom ", function() {
+test( "icons: custom ", function( assert ) {
expect( 2 );
var element = $( "#spin" ).val( 0 ).spinner({
icons: {
@@ -26,8 +30,8 @@ test( "icons: custom ", function() {
up: "custom-up"
}
}).spinner( "widget" );
- equal( element.find( ".ui-icon:first" ).attr( "class" ), "ui-icon custom-up" );
- equal( element.find( ".ui-icon:last" ).attr( "class" ), "ui-icon custom-down" );
+ assert.hasClasses( element.find( ".ui-icon:first" ), "ui-icon custom-up" );
+ assert.hasClasses( element.find( ".ui-icon:last" ), "ui-icon custom-down" );
});
test( "incremental, false", function() {