simple-navigation 3.12.2 → 3.13.0
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG
CHANGED
@@ -32,16 +32,7 @@ module SimpleNavigation
|
|
32
32
|
def initialize
|
33
33
|
@autogenerate_item_ids = true
|
34
34
|
@auto_highlight = true
|
35
|
-
@consider_item_names_as_safe =
|
36
|
-
|
37
|
-
if defined?(ActiveSupport::Deprecation)
|
38
|
-
ActiveSupport::Deprecation.warn 'simple-navigation: ' \
|
39
|
-
'consider_item_names_as_safe will be set to false ' \
|
40
|
-
'by default in 3.13.0 release, hence item names ' \
|
41
|
-
'will be considered unsafe by default. ' \
|
42
|
-
'See https://github.com/codeplant/simple-navigation/wiki',
|
43
|
-
caller
|
44
|
-
end
|
35
|
+
@consider_item_names_as_safe = false
|
45
36
|
end
|
46
37
|
|
47
38
|
def active_leaf_class
|
@@ -212,11 +212,27 @@ module SimpleNavigation
|
|
212
212
|
context "when the adapter's template is set" do
|
213
213
|
before { adapter.stub(template: template, html_safe: 'safe_text') }
|
214
214
|
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
215
|
+
context 'with considering item names as safe' do
|
216
|
+
before { SimpleNavigation.config.consider_item_names_as_safe = true }
|
217
|
+
after { SimpleNavigation.config.consider_item_names_as_safe = false }
|
218
|
+
|
219
|
+
it 'delegates the call to the template (with html_safe text)' do
|
220
|
+
expect(template).to receive(:link_to)
|
221
|
+
.with('safe_text', 'url', options)
|
222
|
+
adapter.link_to('text', 'url', options)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
context 'with considering item names as UNsafe (default)' do
|
227
|
+
|
228
|
+
it 'delegates the call to the template (with html_safe text)' do
|
229
|
+
expect(template).to receive(:link_to)
|
230
|
+
.with('text', 'url', options)
|
231
|
+
adapter.link_to('text', 'url', options)
|
232
|
+
end
|
219
233
|
end
|
234
|
+
|
235
|
+
|
220
236
|
end
|
221
237
|
|
222
238
|
context "when the adapter's template is not set" do
|
@@ -291,13 +307,16 @@ module SimpleNavigation
|
|
291
307
|
let(:safe) { double(:safe) }
|
292
308
|
|
293
309
|
context 'when config option consider_item_names_as_safe is true' do
|
310
|
+
before { SimpleNavigation.config.consider_item_names_as_safe = true }
|
311
|
+
after { SimpleNavigation.config.consider_item_names_as_safe = false }
|
312
|
+
|
294
313
|
it 'uses the html_safe version of the name' do
|
295
314
|
expect(adapter.send(:link_title, name)).to be safe
|
296
315
|
end
|
297
316
|
end
|
298
317
|
|
299
318
|
# TODO: Does it make sense ?
|
300
|
-
context 'when config option consider_item_names_as_safe is false' do
|
319
|
+
context 'when config option consider_item_names_as_safe is false (default)' do
|
301
320
|
before do
|
302
321
|
SimpleNavigation.config.consider_item_names_as_safe = false
|
303
322
|
adapter.stub(template: template)
|
@@ -63,6 +63,10 @@ module SimpleNavigation
|
|
63
63
|
it 'should set the name_generator' do
|
64
64
|
expect(config.name_generator).not_to be_nil
|
65
65
|
end
|
66
|
+
|
67
|
+
it 'should set the consider_item_names_as_safe to false' do
|
68
|
+
expect(config.consider_item_names_as_safe).to be_false
|
69
|
+
end
|
66
70
|
end
|
67
71
|
|
68
72
|
describe '#items' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-navigation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.13.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-03-
|
13
|
+
date: 2014-03-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|