bootstrap-navbar 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee57fde2f640775cbb3cbae9df69ae7932b60f0b
|
4
|
+
data.tar.gz: b098b58bb91ded0c2a9af753c48d371048310c41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 350e000fa6733c652464e35402059ce1601e9cc6d1ca396e864014102a9dd4b7dda9bcbc61d77f1239a4de75f86deaf754a1f56a35e384561c6a87ac043227fc
|
7
|
+
data.tar.gz: 63ce3f7f33c9f93330f9a76c29e5ae7faad029182e013d2bcc0a3e6fb0fd64c0827f1918a46d2d06ab5fb835ea183e964fb41117ab2424e4076562d9b60037e6
|
@@ -123,10 +123,15 @@ HTML
|
|
123
123
|
HTML
|
124
124
|
end
|
125
125
|
|
126
|
-
def navbar_dropdown(text, &block)
|
126
|
+
def navbar_dropdown(text, list_item_options = {}, link_options = {}, &block)
|
127
|
+
list_item_options, link_options = list_item_options.dup, link_options.dup
|
128
|
+
list_item_options[:class] = [list_item_options[:class], 'dropdown'].compact.join(' ')
|
129
|
+
list_item_attributes = attributes_for_tag(list_item_options)
|
130
|
+
link_options[:class] = [link_options[:class], 'dropdown-toggle'].compact.join(' ')
|
131
|
+
link_attributes = attributes_for_tag(link_options)
|
127
132
|
prepare_html <<-HTML.chomp!
|
128
|
-
<li
|
129
|
-
<a href="#"
|
133
|
+
<li#{list_item_attributes}>
|
134
|
+
<a href="#" data-toggle="dropdown"#{link_attributes}>#{text} <b class="caret"></b></a>
|
130
135
|
<ul class="dropdown-menu">
|
131
136
|
#{capture(&block) if block_given?}
|
132
137
|
</ul>
|
@@ -176,7 +181,6 @@ HTML
|
|
176
181
|
css_classes << "navbar-#{options.delete(:inverse) ? 'inverse' : 'default'}"
|
177
182
|
css_classes << "navbar-fixed-#{options.delete(:fixed)}" if options.has_key?(:fixed)
|
178
183
|
css_classes << 'navbar-static-top' if options.delete(:static)
|
179
|
-
css_classes << 'navbar-inverse' if options.delete(:inverse)
|
180
184
|
css_classes << options.delete(:class) if options.has_key?(:class)
|
181
185
|
end
|
182
186
|
role = options.delete(:role) || 'navigation'
|
@@ -114,13 +114,51 @@ describe BootstrapNavbar::Helpers::Bootstrap3 do
|
|
114
114
|
end
|
115
115
|
|
116
116
|
describe '#navbar_dropdown' do
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
117
|
+
context 'without parameters' do
|
118
|
+
it 'generates the correct HTML' do
|
119
|
+
expect(renderer.navbar_dropdown('foo') { 'bar' }).to have_tag(:li, with: { class: 'dropdown' }) do
|
120
|
+
with_tag :a, with: { href: '#', class: 'dropdown-toggle', :'data-toggle' => 'dropdown' } do
|
121
|
+
with_text 'foo '
|
122
|
+
with_tag :b, with: { class: 'caret' }
|
123
|
+
end
|
124
|
+
with_tag :ul, with: { class: 'dropdown-menu' }, text: /bar/
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
context 'with list item parameters' do
|
130
|
+
it 'generates the correct HTML' do
|
131
|
+
expect(renderer.navbar_dropdown('foo', class: 'list-item-class', id: 'list-item-id') { 'bar' }).to have_tag(:li, with: { class: 'dropdown list-item-class', id: 'list-item-id' }) do
|
132
|
+
with_tag :a, with: { href: '#', class: 'dropdown-toggle', :'data-toggle' => 'dropdown' } do
|
133
|
+
with_text 'foo '
|
134
|
+
with_tag :b, with: { class: 'caret' }
|
135
|
+
end
|
136
|
+
with_tag :ul, with: { class: 'dropdown-menu' }, text: /bar/
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
context 'with link parameters' do
|
142
|
+
it 'generates the correct HTML' do
|
143
|
+
expect(renderer.navbar_dropdown('foo', {}, class: 'link-class', id: 'link-id') { 'bar' }).to have_tag(:li, with: { class: 'dropdown' }) do
|
144
|
+
with_tag :a, with: { href: '#', class: 'dropdown-toggle link-class', id: 'link-id', :'data-toggle' => 'dropdown' } do
|
145
|
+
with_text 'foo '
|
146
|
+
with_tag :b, with: { class: 'caret' }
|
147
|
+
end
|
148
|
+
with_tag :ul, with: { class: 'dropdown-menu' }, text: /bar/
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
context 'with list item parameters and link parameters' do
|
154
|
+
it 'generates the correct HTML' do
|
155
|
+
expect(renderer.navbar_dropdown('foo', { class: 'list-item-class', id: 'list-item-id' }, class: 'link-class', id: 'link-id') { 'bar' }).to have_tag(:li, with: { class: 'dropdown list-item-class', id: 'list-item-id' }) do
|
156
|
+
with_tag :a, with: { href: '#', class: 'dropdown-toggle link-class', id: 'link-id', :'data-toggle' => 'dropdown' } do
|
157
|
+
with_text 'foo '
|
158
|
+
with_tag :b, with: { class: 'caret' }
|
159
|
+
end
|
160
|
+
with_tag :ul, with: { class: 'dropdown-menu' }, text: /bar/
|
122
161
|
end
|
123
|
-
with_tag :ul, with: { class: 'dropdown-menu' }, text: /bar/
|
124
162
|
end
|
125
163
|
end
|
126
164
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap-navbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel Meurer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|