test/helper_test.rb in menu_builder-0.4.2 vs test/helper_test.rb in menu_builder-0.4.3
- old
+ new
@@ -38,11 +38,22 @@
concat m.contact "Store", "/store"
})
assert_select "li.current", 1
end
+
+ test "customize the current item class" do
+ @menu_items = [:home]
+ concat(menu({:current_class => "active"}) { |m|
+ concat m.home "Home", "/"
+ concat m.contact "Store", "/store"
+ })
+ assert_select "li.current", 0
+ assert_select "li.active", 1
+ end
+
test "accept more than one menu item" do
@menu_items = [:settings, :notifications]
concat(menu { |m|
concat m.home "Home", "/"
@@ -50,11 +61,25 @@
concat m.settings "Settings", "/settings"
})
assert_select "li.current", 2
end
+
+ test "accept more than one menu item for a custom current item class" do
+ @menu_items = [:settings, :notifications]
+ concat(menu({:current_class => "active"}) { |m|
+ concat m.home "Home", "/"
+ concat m.notifications "Notifications", "/notifications"
+ concat m.settings "Settings", "/settings"
+ })
+
+ assert_select "li.current", 0
+ assert_select "li.active", 2
+ end
+
+
test "accept more than one menu" do
@menu_items = [:settings, :notifications]
concat(menu { |m|
concat m.home "Home", "/"
@@ -93,6 +118,7 @@
})
})
assert_select "ul > li > a > img"
end
+
end