aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/menu/menu_core.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/menu/menu_core.js')
-rw-r--r--tests/unit/menu/menu_core.js24
1 files changed, 17 insertions, 7 deletions
diff --git a/tests/unit/menu/menu_core.js b/tests/unit/menu/menu_core.js
index 5be717a66..955424477 100644
--- a/tests/unit/menu/menu_core.js
+++ b/tests/unit/menu/menu_core.js
@@ -2,13 +2,23 @@
module( "menu: core" );
-test( "markup structure", function() {
- expect( 6 );
- var element = $( "#menu1" ).menu();
- ok( element.hasClass( "ui-menu" ), "main element is .ui-menu" );
- element.children().each(function( index ) {
- ok( $( this ).hasClass( "ui-menu-item" ), "child " + index + " is .ui-menu-item" );
- });
+test( "markup structure", function( assert ) {
+ expect( 11 );
+ var element = $( "#menu9" ).menu(),
+ items = element.children(),
+ firstItemChildren = items.eq( 0 ).children();
+
+ assert.hasClasses( element, "ui-menu ui-widget ui-widget-content" );
+ assert.hasClasses( items[ 0 ], "ui-menu-item" );
+ equal( items.eq( 0 ).children().length, 2, "Item has exactly 2 children when it has a sub menu" );
+ assert.hasClasses( firstItemChildren[ 0 ], "ui-menu-item-wrapper" );
+ assert.hasClasses( firstItemChildren[ 1 ], "ui-menu ui-widget ui-widget-content" );
+ assert.hasClasses( firstItemChildren.eq( 1 ).children()[ 0 ], "ui-menu-item" );
+ assert.hasClasses( firstItemChildren.eq( 1 ).children().eq( 0 ).children(), "ui-menu-item-wrapper" );
+ assert.hasClasses( items[ 1 ], "ui-menu-item" );
+ equal( items.eq( 1 ).children().length, 1, "Item has exactly 1 child when it does not have a sub menu" );
+ assert.hasClasses( items[ 2 ], "ui-menu-item" );
+ equal( items.eq( 2 ).children().length, 1, "Item has exactly 1 child when it does not have a sub menu" );
});
test( "accessibility", function () {