xebec 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/xebec/nav_bar_proxy.rb +2 -2
- data/test/nav_bar_proxy_test.rb +16 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
data/lib/xebec/nav_bar_proxy.rb
CHANGED
@@ -69,8 +69,8 @@ module Xebec
|
|
69
69
|
def render_nav_item(item)
|
70
70
|
text = text_for_nav_item item
|
71
71
|
href = href_for_nav_item item
|
72
|
-
|
73
|
-
helper.content_tag :li,
|
72
|
+
options = is_current_nav_item?(item, href) ? { :class => :current } : {}
|
73
|
+
helper.content_tag :li, options do
|
74
74
|
helper.link_to_unless_current text, href
|
75
75
|
end
|
76
76
|
end
|
data/test/nav_bar_proxy_test.rb
CHANGED
@@ -74,7 +74,22 @@ class NavBarProxyTest < Test::Unit::TestCase
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
77
|
-
|
77
|
+
|
78
|
+
context 'with a NavBar that has a navigation item not set as current' do
|
79
|
+
setup do
|
80
|
+
@bar.nav_item :foo, '/foo'
|
81
|
+
@bar.current = :baz
|
82
|
+
end
|
83
|
+
should 'render a navigation bar with the item not marked as current' do
|
84
|
+
assert_select_from @proxy.to_s, 'ul.navbar' do
|
85
|
+
assert_select 'li', 'Foo'
|
86
|
+
assert_select 'li.current', { :count => 0, :text=> 'Foo' }
|
87
|
+
end
|
88
|
+
end
|
89
|
+
should 'not render an empty "class" attribute' do
|
90
|
+
assert(!(/class\s*=\s*["']\s*["']/ === @proxy.to_s))
|
91
|
+
end
|
92
|
+
end
|
78
93
|
|
79
94
|
context 'with a NavBar that has a navigation item declared as a name and URL' do
|
80
95
|
setup do
|