From 4f15e66f5373170caf307237b9a8b2c505ae3dbf Mon Sep 17 00:00:00 2001 From: kborchers Date: Sun, 22 Jan 2012 11:26:41 -0600 Subject: Menu: Added unit tests for the enable, disable and refresh methods as well as the disabled option. Cleaned up some variable names in unit tests. --- tests/unit/menu/menu_options.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'tests/unit/menu/menu_options.js') diff --git a/tests/unit/menu/menu_options.js b/tests/unit/menu/menu_options.js index 03822fd74..479aab0d1 100644 --- a/tests/unit/menu/menu_options.js +++ b/tests/unit/menu/menu_options.js @@ -5,6 +5,34 @@ module("menu: options"); +test( "{ disabled: true }", function() { + expect( 2 ); + var menu = $( "#menu1" ).menu({ + disabled: true, + select: function(event, ui) { + menu_log(); + } + }); + ok(menu.is(".ui-state-disabled"),"Missing ui-state-disabled class"); + menu_log("click",true); + menu_click(menu,"1"); + menu_log("afterclick"); + equals( $("#log").html(), "afterclick,click,", "Click order not valid."); +}); +test( "{ disabled: false }", function() { + expect( 2 ); + var menu = $( "#menu1" ).menu({ + disabled: false, + select: function(event, ui) { + menu_log(); + } + }); + ok(menu.not(".ui-state-disabled"),"Has ui-state-disabled class"); + menu_log("click",true); + menu_click(menu,"1"); + menu_log("afterclick"); + equals( $("#log").html(), "afterclick,1,click,", "Click order not valid."); +}); })(jQuery); -- cgit v1.2.3