aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Schmitz <arschmitz@gmail.com>2015-01-30 10:00:56 -0500
committerAlexander Schmitz <arschmitz@gmail.com>2015-03-11 16:05:40 -0400
commit8eb29fd90c6a05aaabe499097dd5d5a0073ddb13 (patch)
treeac37b05c1e59c6907afe5ae5cec7258dc774fd5a
parent9af91bcfa9ddfa91e0d80aa652455f9b437deb75 (diff)
downloadjquery-ui-8eb29fd90c6a05aaabe499097dd5d5a0073ddb13.tar.gz
jquery-ui-8eb29fd90c6a05aaabe499097dd5d5a0073ddb13.zip
Selectmenu: Use new has/lacksClasses assertions for all class checks
-rw-r--r--tests/unit/selectmenu/selectmenu_core.js8
-rw-r--r--tests/unit/selectmenu/selectmenu_methods.js15
-rw-r--r--tests/unit/selectmenu/selectmenu_options.js17
3 files changed, 19 insertions, 21 deletions
diff --git a/tests/unit/selectmenu/selectmenu_core.js b/tests/unit/selectmenu/selectmenu_core.js
index 1116bd604..c4e987751 100644
--- a/tests/unit/selectmenu/selectmenu_core.js
+++ b/tests/unit/selectmenu/selectmenu_core.js
@@ -294,7 +294,7 @@ $.each([
}
});
- asyncTest( "empty option - " + settings.type, function() {
+ asyncTest( "empty option - " + settings.type, function( assert ) {
expect( 7 );
var button, menu, wrappers, wrapper,
@@ -316,10 +316,8 @@ $.each([
"correct amount of list elements" );
ok( wrapper.outerHeight() > 10, "empty item seems to have reasonable height" );
ok( wrapper.attr( "id" ), "empty item has id attribute" );
- ok( wrapper.parent().hasClass( "ui-menu-item" ),
- "empty item has ui-menu-item class" );
- ok( !wrapper.hasClass( "ui-menu-divider" ),
- "empty item does not have ui-menu-divider class" );
+ assert.hasClasses( wrapper.parent(), "ui-menu-item" );
+ assert.lacksClasses( wrapper, "ui-menu-divider" );
equal( wrapper.attr( "tabindex" ), -1, "empty item has tabindex" );
equal( wrapper.attr( "role" ), "option", "empty item has role option" );
diff --git a/tests/unit/selectmenu/selectmenu_methods.js b/tests/unit/selectmenu/selectmenu_methods.js
index 0ff0f95c2..8f5454b15 100644
--- a/tests/unit/selectmenu/selectmenu_methods.js
+++ b/tests/unit/selectmenu/selectmenu_methods.js
@@ -114,7 +114,7 @@ test( "refresh - disabled select", function() {
equal( menu.attr( "aria-disabled" ), "true", "menu ARIA" );
});
-test( "refresh - disabled option", function() {
+test( "refresh - disabled option", function( assert ) {
expect( 1 );
var disabledItem,
@@ -125,10 +125,10 @@ test( "refresh - disabled option", function() {
element.selectmenu( "refresh" );
disabledItem = menu.find( "li" ).not( ".ui-selectmenu-optgroup" ).eq( 2 );
- ok( disabledItem.hasClass( "ui-state-disabled" ), "class" );
+ assert.hasClasses( disabledItem, "ui-state-disabled" );
});
-test( "refresh - disabled optgroup", function() {
+test( "refresh - disabled optgroup", function( assert ) {
var i, item,
element = $( "#files" ).selectmenu(),
menu = element.selectmenu( "menuWidget" ).parent(),
@@ -141,7 +141,8 @@ test( "refresh - disabled optgroup", function() {
element.selectmenu( "refresh" );
item = menu.find( "li.ui-selectmenu-optgroup" ).first();
- ok( item.hasClass( "ui-state-disabled" ), "class" );
+
+ assert.hasClasses( item, "ui-state-disabled" );
equal(
menu.find( "li" ).not( ".ui-selectmenu-optgroup" ).filter( ".ui-state-disabled" ).length,
@@ -150,7 +151,7 @@ test( "refresh - disabled optgroup", function() {
);
for ( i = 0; i < originalDisabledOptions.length; i++ ) {
item = item.next( "li" );
- ok( item.hasClass( "ui-state-disabled" ), "item #" + i + ": class" );
+ assert.hasClasses( item, "ui-state-disabled" );
}
});
@@ -168,7 +169,7 @@ test( "refresh - remove all options", function() {
equal( menu.children().length, 0, "Empty menu" );
});
-test( "widget and menuWidget", function() {
+test( "widget and menuWidget", function( assert ) {
expect( 4 );
var element = $( "#speed" ).selectmenu(),
@@ -176,7 +177,7 @@ test( "widget and menuWidget", function() {
menu = element.selectmenu( "menuWidget" );
equal( button.length, 1, "button: one element" );
- ok( button.is( ".ui-selectmenu-button" ), "button: class" );
+ assert.hasClasses( button, "ui-selectmenu-button" );
equal( menu.length, 1, "Menu Widget: one element" );
ok( menu.is( "ul.ui-menu" ), "Menu Widget: element and class" );
diff --git a/tests/unit/selectmenu/selectmenu_options.js b/tests/unit/selectmenu/selectmenu_options.js
index 08555a1af..7ed841a90 100644
--- a/tests/unit/selectmenu/selectmenu_options.js
+++ b/tests/unit/selectmenu/selectmenu_options.js
@@ -67,21 +67,20 @@ test( "appendTo: ui-front", function() {
$( "#selectmenu-wrap2" )[ 0 ], "empty jQuery object, inside .ui-front" );
});
-test( "CSS styles", function() {
- expect( 2 );
+test( "CSS styles", function( assert ) {
+ expect( 5 );
var element = $( "#speed" ).selectmenu(),
button = element.selectmenu( "widget" ),
menu = element.selectmenu( "menuWidget" );
element.selectmenu( "open" );
- ok(
- button.hasClass( "ui-corner-top" ) && !button.hasClass( "ui-corner-all" ) &&
- button.find( "span.ui-icon" ).hasClass( "ui-icon-triangle-1-s" ),
- "button styles dropdown"
- );
- ok( menu.hasClass( "ui-corner-bottom" ) && !menu.hasClass( "ui-corner-all" ),
- "menu styles dropdown" );
+
+ assert.hasClasses( button, "ui-corner-top" );
+ assert.lacksClasses( button, "ui-corner-all" );
+ assert.hasClasses( button.find( "span.ui-icon" ), "ui-icon-triangle-1-s" );
+ assert.hasClasses( menu, "ui-corner-bottom" );
+ assert.lacksClasses( button, "ui-corner-all" );
});
test( "width", function() {