xebec 2.5.1 → 2.5.2
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_renderer.rb +3 -3
- data/test/nav_bar_renderer_test.rb +17 -0
- data/xebec.gemspec +2 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.5.
|
1
|
+
2.5.2
|
@@ -91,7 +91,7 @@ module Xebec
|
|
91
91
|
text = text_for_nav_item item
|
92
92
|
href = href_for_nav_item item
|
93
93
|
is_current = is_current_nav_item?(item, href)
|
94
|
-
klass = item.name.to_s
|
94
|
+
klass = '' << item.name.to_s
|
95
95
|
klass << " #{Xebec.currently_selected_nav_item_class}" if is_current
|
96
96
|
helper.content_tag(*list_item_tag(item, klass, text, href, is_current)) do
|
97
97
|
if is_current
|
@@ -124,8 +124,8 @@ module Xebec
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def is_current_nav_item?(item, href)
|
127
|
-
current = bar.current
|
128
|
-
current == item.name || current.blank? && helper.current_page?(href)
|
127
|
+
current = bar.current.to_s
|
128
|
+
current == item.name.to_s || current.blank? && helper.current_page?(href)
|
129
129
|
end
|
130
130
|
|
131
131
|
end
|
@@ -111,6 +111,23 @@ class NavBarRendererTest < Test::Unit::TestCase
|
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
|
+
context 'with a NavBar that has a NavItem with a String name' do
|
115
|
+
setup do
|
116
|
+
@bar.nav_item 'foo', '/foo'
|
117
|
+
@bar.current = :foo
|
118
|
+
end
|
119
|
+
should 'still mark the item as current if a Symbol is used' do
|
120
|
+
assert_select_from @renderer.to_s, 'ul' do
|
121
|
+
assert_select 'li.foo.current span', 'Foo'
|
122
|
+
end
|
123
|
+
end
|
124
|
+
should 'not modify the NavItem itself' do
|
125
|
+
original_text = @bar.items.first.name.dup
|
126
|
+
@renderer.to_s
|
127
|
+
assert_equal original_text, @bar.items.first.name.dup
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
114
131
|
context 'with a NavBar that has a navigation item not set as current' do
|
115
132
|
setup do
|
116
133
|
@bar.nav_item :foo, '/foo'
|
data/xebec.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{xebec}
|
8
|
-
s.version = "2.5.
|
8
|
+
s.version = "2.5.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["James A. Rosen"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-04-01}
|
13
13
|
s.description = %q{Helpers for generating navigation bars}
|
14
14
|
s.email = %q{james.a.rosen@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 2
|
7
7
|
- 5
|
8
|
-
-
|
9
|
-
version: 2.5.
|
8
|
+
- 2
|
9
|
+
version: 2.5.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- James A. Rosen
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-04-01 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|