aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/menu/menu_methods.js
diff options
context:
space:
mode:
authorkborchers <kris.borchers@gmail.com>2012-01-22 11:26:41 -0600
committerkborchers <kris.borchers@gmail.com>2012-01-22 11:26:41 -0600
commit4f15e66f5373170caf307237b9a8b2c505ae3dbf (patch)
tree681877516d8766de3d9210c9ced9a08d3e9c20e6 /tests/unit/menu/menu_methods.js
parent8c5c6e0a32a1e87cab575cbb265873fccbd416df (diff)
downloadjquery-ui-4f15e66f5373170caf307237b9a8b2c505ae3dbf.tar.gz
jquery-ui-4f15e66f5373170caf307237b9a8b2c505ae3dbf.zip
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.
Diffstat (limited to 'tests/unit/menu/menu_methods.js')
-rw-r--r--tests/unit/menu/menu_methods.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/unit/menu/menu_methods.js b/tests/unit/menu/menu_methods.js
index 0ecaf7328..3bcab3361 100644
--- a/tests/unit/menu/menu_methods.js
+++ b/tests/unit/menu/menu_methods.js
@@ -5,6 +5,36 @@
module("menu: methods");
+test( "enable/disable", function() {
+ expect( 3 );
+ var menu = $( "#menu1" ).menu({
+ select: function(event, ui) {
+ menu_log();
+ }
+ });
+ menu.menu("disable");
+ ok(menu.is(".ui-state-disabled"),"Missing ui-state-disabled class");
+ menu_log("click",true);
+ menu_click(menu,"1");
+ menu_log("afterclick");
+ menu.menu("enable");
+ ok(menu.not(".ui-state-disabled"),"Has ui-state-disabled class");
+ menu_log("click");
+ menu_click(menu,"1");
+ menu_log("afterclick");
+ equals( $("#log").html(), "afterclick,1,click,afterclick,click,", "Click order not valid.");
+});
+
+test( "refresh", function() {
+ expect( 3 );
+ var menu = $( "#menu1" ).menu();
+ equals(menu.find(".ui-menu-item").length,5,"Incorrect number of menu items");
+ menu.append("<li><a href='#'>test item</a></li>").menu("refresh");
+ equals(menu.find(".ui-menu-item").length,6,"Incorrect number of menu items");
+ menu.find(".ui-menu-item:last").remove().end().menu("refresh");
+ equals(menu.find(".ui-menu-item").length,5,"Incorrect number of menu items");
+});
+
test("destroy", function() {
domEqual("#menu1", function() {
$("#menu1").menu().menu("destroy");