diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-06-18 13:26:46 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-06-18 13:26:46 -0400 |
commit | f92f8bb56bf9e01ccc5d0c84e0f089c3660283d8 (patch) | |
tree | abc95c092557972edb1d3bddf4c6d3b946164a9e /tests/unit/menu/menu_methods.js | |
parent | 35f7a67c09fc0862b5a639ec867b061d248927a7 (diff) | |
download | jquery-ui-f92f8bb56bf9e01ccc5d0c84e0f089c3660283d8.tar.gz jquery-ui-f92f8bb56bf9e01ccc5d0c84e0f089c3660283d8.zip |
Menu tests: Cleanup.
Diffstat (limited to 'tests/unit/menu/menu_methods.js')
-rw-r--r-- | tests/unit/menu/menu_methods.js | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/tests/unit/menu/menu_methods.js b/tests/unit/menu/menu_methods.js index 3a7b2d8fe..faaa7609f 100644 --- a/tests/unit/menu/menu_methods.js +++ b/tests/unit/menu/menu_methods.js @@ -1,61 +1,63 @@ -/* - * menu_methods.js - */ -(function($) { +(function( $ ) { var log = TestHelpers.menu.log, + logOutput = TestHelpers.menu.logOutput, click = TestHelpers.menu.click; -module("menu: methods"); +module( "menu: methods", { + setup: function() { + TestHelpers.menu.clearLog(); + } +}); test( "enable/disable", function() { expect( 3 ); var menu = $( "#menu1" ).menu({ - select: function(event, ui) { + select: function( event, ui ) { log(); } }); - menu.menu("disable"); - ok(menu.is(".ui-state-disabled"),"Missing ui-state-disabled class"); - log("click",true); - click(menu,"1"); - log("afterclick"); - menu.menu("enable"); - ok(menu.not(".ui-state-disabled"),"Has ui-state-disabled class"); - log("click"); - click(menu,"1"); - log("afterclick"); - equal( $("#log").html(), "afterclick,1,click,afterclick,click,", "Click order not valid."); + menu.menu( "disable" ); + ok(menu.is( ".ui-state-disabled" ),"Missing ui-state-disabled class" ); + log( "click", true ); + click( menu, "1" ); + log( "afterclick" ); + menu.menu( "enable" ); + ok(menu.not( ".ui-state-disabled" ),"Has ui-state-disabled class" ); + log( "click" ); + click( menu, "1" ); + log( "afterclick" ); + equal( logOutput(), "afterclick,1,click,afterclick,click,", "Click order not valid." ); }); test( "refresh", function() { expect( 5 ); var menu = $( "#menu1" ).menu(); - equal(menu.find(".ui-menu-item").length,5,"Incorrect number of menu items"); - menu.append("<li><a href='#'>test item</a></li>").menu("refresh"); - equal(menu.find(".ui-menu-item").length,6,"Incorrect number of menu items"); - menu.find(".ui-menu-item:last").remove().end().menu("refresh"); - equal(menu.find(".ui-menu-item").length,5,"Incorrect number of menu items"); - menu.append("<li>---</li>").menu("refresh"); - equal(menu.find(".ui-menu-item").length,5,"Incorrect number of menu items"); - menu.children(":last").remove().end().menu("refresh"); - equal(menu.find(".ui-menu-item").length,5,"Incorrect number of menu items"); + equal( menu.find( ".ui-menu-item" ).length, 5, "Incorrect number of menu items" ); + menu.append( "<li><a href='#'>test item</a></li>" ).menu( "refresh" ); + equal( menu.find( ".ui-menu-item" ).length, 6, "Incorrect number of menu items" ); + menu.find( ".ui-menu-item:last" ).remove().end().menu( "refresh" ); + equal( menu.find( ".ui-menu-item" ).length, 5, "Incorrect number of menu items" ); + menu.append( "<li>---</li>" ).menu( "refresh" ); + equal( menu.find( ".ui-menu-item" ).length, 5, "Incorrect number of menu items" ); + menu.children( ":last" ).remove().end().menu( "refresh" ); + equal( menu.find( ".ui-menu-item" ).length, 5, "Incorrect number of menu items" ); }); -test("destroy", function() { - domEqual("#menu1", function() { - $("#menu1").menu().menu("destroy"); +test( "destroy", function() { + expect( 4 ); + domEqual( "#menu1", function() { + $( "#menu1" ).menu().menu( "destroy" ); }); - domEqual("#menu2", function() { - $("#menu2").menu().menu("destroy"); + domEqual( "#menu2", function() { + $( "#menu2" ).menu().menu( "destroy" ); }); - domEqual("#menu5", function() { - $("#menu5").menu().menu("destroy"); + domEqual( "#menu5", function() { + $( "#menu5").menu().menu( "destroy" ); }); - domEqual("#menu6", function() { - $("#menu6").menu().menu("destroy"); + domEqual( "#menu6", function() { + $( "#menu6" ).menu().menu( "destroy" ); }); }); - -})(jQuery); +})( jQuery ); |