blacklight 6.3.1 → 6.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -1
- data/README.md +2 -2
- data/VERSION +1 -1
- data/app/views/catalog/_bookmark_control.html.erb +2 -2
- data/blacklight.gemspec +1 -1
- data/lib/generators/blacklight/solr5_generator.rb +1 -1
- data/lib/generators/blacklight/user_generator.rb +2 -2
- data/spec/controllers/alternate_controller_spec.rb +0 -1
- data/spec/controllers/application_controller_spec.rb +0 -1
- data/spec/controllers/blacklight/base_spec.rb +0 -1
- data/spec/controllers/blacklight/catalog/component_configuration_spec.rb +0 -1
- data/spec/controllers/blacklight/facet_spec.rb +0 -1
- data/spec/controllers/blacklight/search_fields_spec.rb +0 -1
- data/spec/controllers/blacklight/search_helper_spec.rb +0 -1
- data/spec/controllers/blacklight/suggest_search_spec.rb +0 -1
- data/spec/controllers/bookmarks_controller_spec.rb +0 -1
- data/spec/controllers/catalog_controller_spec.rb +0 -1
- data/spec/controllers/saved_searches_controller_spec.rb +0 -1
- data/spec/controllers/search_history_controller_spec.rb +0 -1
- data/spec/controllers/suggest_controller_spec.rb +0 -1
- data/spec/features/alternate_controller_spec.rb +0 -1
- data/spec/features/bookmarks_spec.rb +0 -1
- data/spec/features/did_you_mean_spec.rb +0 -1
- data/spec/features/facets_spec.rb +0 -1
- data/spec/features/record_view_spec.rb +0 -1
- data/spec/features/saved_searches_spec.rb +0 -1
- data/spec/features/search_context_spec.rb +0 -1
- data/spec/features/search_filters_spec.rb +0 -1
- data/spec/features/search_formats_spec.rb +0 -1
- data/spec/features/search_history_spec.rb +0 -1
- data/spec/features/search_pagination_spec.rb +0 -1
- data/spec/features/search_results_spec.rb +0 -1
- data/spec/features/search_sort_spec.rb +0 -1
- data/spec/features/search_spec.rb +0 -1
- data/spec/features/sitelinks_search_box.rb +0 -1
- data/spec/helpers/blacklight_helper_spec.rb +95 -153
- data/spec/helpers/catalog_helper_spec.rb +0 -1
- data/spec/helpers/configuration_helper_spec.rb +0 -1
- data/spec/helpers/deprecated_url_helper_behavior_spec.rb +0 -1
- data/spec/helpers/facets_helper_spec.rb +79 -113
- data/spec/helpers/hash_as_hidden_fields_spec.rb +0 -1
- data/spec/helpers/layout_helper_spec.rb +0 -1
- data/spec/helpers/render_constraints_helper_spec.rb +0 -1
- data/spec/helpers/search_history_constraints_helper_spec.rb +0 -1
- data/spec/helpers/suggest_helper_spec.rb +0 -1
- data/spec/helpers/url_helper_spec.rb +0 -1
- data/spec/lib/blacklight/parameters_spec.rb +0 -1
- data/spec/lib/blacklight/search_state_spec.rb +0 -1
- data/spec/lib/blacklight/utils_spec.rb +0 -1
- data/spec/lib/blacklight_spec.rb +0 -1
- data/spec/lib/tasks/blacklight_task_spec.rb +0 -1
- data/spec/models/blacklight/configurable_spec.rb +0 -1
- data/spec/models/blacklight/configuration/context_spec.rb +0 -1
- data/spec/models/blacklight/configuration_spec.rb +0 -1
- data/spec/models/blacklight/document/active_model_shim_spec.rb +0 -1
- data/spec/models/blacklight/document/cache_key_spec.rb +0 -1
- data/spec/models/blacklight/document/dublin_core_spec.rb +0 -1
- data/spec/models/blacklight/document/email_spec.rb +0 -1
- data/spec/models/blacklight/document/sms_spec.rb +0 -1
- data/spec/models/blacklight/document_spec.rb +0 -1
- data/spec/models/blacklight/facet_paginator_spec.rb +0 -1
- data/spec/models/blacklight/search_builder_spec.rb +0 -1
- data/spec/models/blacklight/solr/document/more_like_this_spec.rb +0 -1
- data/spec/models/blacklight/solr/document_spec.rb +0 -1
- data/spec/models/blacklight/solr/facet_paginator_spec.rb +0 -1
- data/spec/models/blacklight/solr/repository_spec.rb +0 -1
- data/spec/models/blacklight/solr/request_spec.rb +0 -1
- data/spec/models/blacklight/solr/response/facets_spec.rb +0 -1
- data/spec/models/blacklight/solr/response_spec.rb +0 -1
- data/spec/models/blacklight/solr/search_builder_spec.rb +0 -1
- data/spec/models/blacklight/suggest/response_spec.rb +0 -1
- data/spec/models/blacklight/user_spec.rb +0 -1
- data/spec/models/bookmark_spec.rb +0 -1
- data/spec/models/record_mailer_spec.rb +0 -1
- data/spec/models/search_spec.rb +0 -1
- data/spec/models/solr_document_spec.rb +0 -1
- data/spec/presenters/document_presenter_spec.rb +0 -1
- data/spec/presenters/index_presenter_spec.rb +0 -1
- data/spec/presenters/pipeline_spec.rb +0 -1
- data/spec/presenters/show_presenter_spec.rb +0 -1
- data/spec/spec_helper.rb +5 -8
- data/spec/test_app_templates/Gemfile.extra +1 -1
- data/spec/views/_user_util_links.html.erb_spec.rb +0 -1
- data/spec/views/catalog/_constraints.html.erb_spec.rb +0 -1
- data/spec/views/catalog/_constraints_element.html.erb_spec.rb +0 -5
- data/spec/views/catalog/_document.html.erb_spec.rb +3 -14
- data/spec/views/catalog/_document_list.html.erb_spec.rb +1 -4
- data/spec/views/catalog/_facet_index_navigation.html.erb_spec.rb +0 -3
- data/spec/views/catalog/_facet_layout.html.erb_spec.rb +2 -7
- data/spec/views/catalog/_facets.html.erb_spec.rb +6 -14
- data/spec/views/catalog/_index_default.erb_spec.rb +4 -7
- data/spec/views/catalog/_index_header_default.html.erb_spec.rb +2 -5
- data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +3 -5
- data/spec/views/catalog/_search_header.erb_spec.rb +0 -2
- data/spec/views/catalog/_show_default.erb_spec.rb +7 -11
- data/spec/views/catalog/_show_sidebar.erb_spec.rb +0 -1
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +3 -13
- data/spec/views/catalog/_sort_and_per_page.html.erb_spec.rb +1 -5
- data/spec/views/catalog/_thumbnail_default.erb_spec.rb +0 -1
- data/spec/views/catalog/_view_type_group.html.erb_spec.rb +3 -11
- data/spec/views/catalog/facet.html.erb_spec.rb +0 -1
- data/spec/views/catalog/facet.json.jbuilder_spec.rb +0 -1
- data/spec/views/catalog/index.atom.builder_spec.rb +21 -36
- data/spec/views/catalog/index.html.erb_spec.rb +0 -3
- data/spec/views/catalog/index.json.jbuilder_spec.rb +0 -1
- data/spec/views/catalog/opensearch.xml.builder_spec.rb +0 -1
- data/spec/views/catalog/show.html.erb_spec.rb +2 -13
- metadata +7 -9
- data/spec/spec.opts +0 -4
@@ -1,5 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
2
|
|
4
3
|
require 'equivalent-xml'
|
5
4
|
|
@@ -11,112 +10,96 @@ describe FacetsHelper do
|
|
11
10
|
end
|
12
11
|
|
13
12
|
describe "has_facet_values?" do
|
14
|
-
|
15
|
-
|
16
|
-
a = double(:items => [1,2], :name => 'a')
|
17
|
-
b = double(:items => ['b','c'], :name => 'b')
|
18
|
-
empty = double(:items => [], :name => 'empty')
|
13
|
+
let(:empty) { double(:items => [], :name => 'empty') }
|
19
14
|
|
20
|
-
|
15
|
+
it "is true if there are any facets to display" do
|
16
|
+
a = double(:items => [1, 2], :name => 'a')
|
17
|
+
b = double(:items => ['b', 'c'], :name => 'b')
|
18
|
+
fields = [a, b, empty]
|
21
19
|
expect(helper.has_facet_values?(fields)).to be true
|
22
20
|
end
|
23
21
|
|
24
22
|
it "is false if all facets are empty" do
|
25
|
-
|
26
|
-
empty = double(:items => [])
|
27
|
-
|
28
|
-
fields = [empty]
|
29
|
-
expect(helper.has_facet_values?(fields)).to be false
|
23
|
+
expect(helper.has_facet_values?([empty])).to be false
|
30
24
|
end
|
31
25
|
|
32
|
-
|
33
|
-
|
34
|
-
|
26
|
+
describe "different config" do
|
27
|
+
let(:blacklight_config) { Blacklight::Configuration.new { |config| config.add_facet_field 'basic_field', :if => false } }
|
28
|
+
it "is false if no facets are displayable" do
|
29
|
+
a = double(:items => [1, 2], :name => 'basic_field')
|
30
|
+
expect(helper.has_facet_values?([a])).to be false
|
35
31
|
end
|
36
|
-
|
37
|
-
allow(helper).to receive_messages(:blacklight_config => @config)
|
38
|
-
|
39
|
-
a = double(:items => [1,2], :name=>'basic_field')
|
40
|
-
fields = [a]
|
41
|
-
|
42
|
-
expect(helper.has_facet_values?(fields)).to be false
|
43
32
|
end
|
44
33
|
end
|
45
34
|
|
46
35
|
describe "should_render_facet?" do
|
47
|
-
|
48
|
-
|
36
|
+
let(:blacklight_config) do
|
37
|
+
Blacklight::Configuration.new do |config|
|
49
38
|
config.add_facet_field 'basic_field'
|
50
39
|
config.add_facet_field 'no_show', :show => false
|
51
40
|
config.add_facet_field 'helper_show', :show => :my_custom_check
|
52
41
|
config.add_facet_field 'helper_with_an_arg_show', :show => :my_custom_check_with_an_arg
|
53
|
-
config.add_facet_field 'lambda_show',
|
42
|
+
config.add_facet_field 'lambda_show', :show => lambda { |context, config, field| true }
|
54
43
|
config.add_facet_field 'lambda_no_show', :show => lambda { |context, config, field| false }
|
55
44
|
end
|
56
|
-
|
57
|
-
allow(helper).to receive_messages(:blacklight_config => @config)
|
58
45
|
end
|
59
46
|
|
60
47
|
it "renders facets with items" do
|
61
|
-
a = double(:items => [1,2], :name=>'basic_field')
|
48
|
+
a = double(:items => [1, 2], :name => 'basic_field')
|
62
49
|
expect(helper.should_render_facet?(a)).to be true
|
63
50
|
end
|
51
|
+
|
64
52
|
it "does not render facets without items" do
|
65
|
-
empty = double(:items => [], :name=>'basic_field')
|
53
|
+
empty = double(:items => [], :name => 'basic_field')
|
66
54
|
expect(helper.should_render_facet?(empty)).to be false
|
67
55
|
end
|
68
56
|
|
69
57
|
it "does not render facets where show is set to false" do
|
70
|
-
a = double(:items => [1,2], :name=>'no_show')
|
58
|
+
a = double(:items => [1, 2], :name => 'no_show')
|
71
59
|
expect(helper.should_render_facet?(a)).to be false
|
72
60
|
end
|
73
61
|
|
74
62
|
it "calls a helper to determine if it should render a field" do
|
75
63
|
allow(controller).to receive_messages(:my_custom_check => true)
|
76
|
-
a = double(:items => [1,2], :name=>'helper_show')
|
64
|
+
a = double(:items => [1, 2], :name => 'helper_show')
|
77
65
|
expect(helper.should_render_facet?(a)).to be true
|
78
66
|
end
|
79
67
|
|
80
68
|
it "calls a helper to determine if it should render a field" do
|
81
|
-
a = double(:items => [1,2], :name=>'helper_with_an_arg_show')
|
82
|
-
allow(controller).to receive(:my_custom_check_with_an_arg).with(
|
69
|
+
a = double(:items => [1, 2], :name => 'helper_with_an_arg_show')
|
70
|
+
allow(controller).to receive(:my_custom_check_with_an_arg).with(blacklight_config.facet_fields['helper_with_an_arg_show'], a).and_return(true)
|
83
71
|
expect(helper.should_render_facet?(a)).to be true
|
84
72
|
end
|
85
73
|
|
86
|
-
|
87
74
|
it "evaluates a Proc to determine if it should render a field" do
|
88
|
-
a = double(:items => [1,2], :name=>'lambda_show')
|
75
|
+
a = double(:items => [1, 2], :name => 'lambda_show')
|
89
76
|
expect(helper.should_render_facet?(a)).to be true
|
90
|
-
|
91
|
-
a = double(:items => [1,2], :name=>'lambda_no_show')
|
77
|
+
a = double(:items => [1, 2], :name => 'lambda_no_show')
|
92
78
|
expect(helper.should_render_facet?(a)).to be false
|
93
79
|
end
|
94
80
|
end
|
95
81
|
|
96
82
|
describe "should_collapse_facet?" do
|
97
|
-
|
98
|
-
|
83
|
+
let(:blacklight_config) do
|
84
|
+
Blacklight::Configuration.new do |config|
|
99
85
|
config.add_facet_field 'basic_field'
|
100
86
|
config.add_facet_field 'no_collapse', collapse: false
|
101
87
|
end
|
102
|
-
|
103
|
-
allow(helper).to receive_messages(blacklight_config: @config)
|
104
88
|
end
|
105
89
|
|
106
90
|
it "is collapsed by default" do
|
107
|
-
expect(helper.should_collapse_facet?(
|
91
|
+
expect(helper.should_collapse_facet?(blacklight_config.facet_fields['basic_field'])).to be true
|
108
92
|
end
|
109
93
|
|
110
94
|
it "does not be collapsed if the configuration says so" do
|
111
|
-
expect(helper.should_collapse_facet?(
|
95
|
+
expect(helper.should_collapse_facet?(blacklight_config.facet_fields['no_collapse'])).to be false
|
112
96
|
end
|
113
97
|
|
114
98
|
it "does not be collapsed if it is in the params" do
|
115
99
|
params[:f] = ActiveSupport::HashWithIndifferentAccess.new(basic_field: [1], no_collapse: [2])
|
116
|
-
expect(helper.should_collapse_facet?(
|
117
|
-
expect(helper.should_collapse_facet?(
|
100
|
+
expect(helper.should_collapse_facet?(blacklight_config.facet_fields['basic_field'])).to be false
|
101
|
+
expect(helper.should_collapse_facet?(blacklight_config.facet_fields['no_collapse'])).to be false
|
118
102
|
end
|
119
|
-
|
120
103
|
end
|
121
104
|
|
122
105
|
describe "facet_by_field_name" do
|
@@ -124,7 +107,6 @@ describe FacetsHelper do
|
|
124
107
|
facet_config = double(:query => nil, field: 'a', key: 'a')
|
125
108
|
facet_field = double()
|
126
109
|
allow(helper).to receive(:facet_configuration_for_field).with(anything()).and_return(facet_config)
|
127
|
-
|
128
110
|
@response = double()
|
129
111
|
allow(@response).to receive(:aggregations).and_return('a' => facet_field)
|
130
112
|
|
@@ -132,96 +114,82 @@ describe FacetsHelper do
|
|
132
114
|
end
|
133
115
|
end
|
134
116
|
|
135
|
-
|
136
117
|
describe "render_facet_partials" do
|
118
|
+
let(:a) { double(:items => [1, 2]) }
|
119
|
+
let(:b) { double(:items => ['b', 'c']) }
|
120
|
+
|
137
121
|
it "tries to render all provided facets" do
|
138
|
-
a = double(:items => [1,2])
|
139
|
-
b = double(:items => ['b','c'])
|
140
122
|
empty = double(:items => [])
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
allow(helper).to receive(:render_facet_limit).with(b, {})
|
146
|
-
allow(helper).to receive(:render_facet_limit).with(empty, {})
|
147
|
-
|
123
|
+
fields = [a, b, empty]
|
124
|
+
expect(helper).to receive(:render_facet_limit).with(a, {})
|
125
|
+
expect(helper).to receive(:render_facet_limit).with(b, {})
|
126
|
+
expect(helper).to receive(:render_facet_limit).with(empty, {})
|
148
127
|
helper.render_facet_partials fields
|
149
128
|
end
|
150
129
|
|
151
130
|
it "defaults to the configured facets" do
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
allow(helper).to receive(:render_facet_limit).with(a, {})
|
157
|
-
allow(helper).to receive(:render_facet_limit).with(b, {})
|
158
|
-
|
131
|
+
expect(helper).to receive(:facet_field_names) { [a, b] }
|
132
|
+
expect(helper).to receive(:render_facet_limit).with(a, {})
|
133
|
+
expect(helper).to receive(:render_facet_limit).with(b, {})
|
159
134
|
helper.render_facet_partials
|
160
135
|
end
|
161
|
-
|
162
136
|
end
|
163
137
|
|
164
138
|
describe "render_facet_limit" do
|
165
|
-
|
166
|
-
|
167
|
-
@config = Blacklight::Configuration.new do |config|
|
139
|
+
let(:blacklight_config) do
|
140
|
+
Blacklight::Configuration.new do |config|
|
168
141
|
config.add_facet_field 'basic_field'
|
169
142
|
config.add_facet_field 'pivot_facet_field', :pivot => ['a', 'b']
|
170
143
|
config.add_facet_field 'my_pivot_facet_field_with_custom_partial', :partial => 'custom_facet_partial', :pivot => ['a', 'b']
|
171
144
|
config.add_facet_field 'my_facet_field_with_custom_partial', :partial => 'custom_facet_partial'
|
172
145
|
end
|
173
|
-
|
174
|
-
allow(helper).to receive_messages(:blacklight_config => @config)
|
175
|
-
@response = double()
|
176
146
|
end
|
147
|
+
let(:mock_custom_facet) { double(:name => 'my_facet_field_with_custom_partial', :items => [1, 2, 3]) }
|
177
148
|
|
178
149
|
it "sets basic local variables" do
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
helper.render_facet_limit(
|
150
|
+
mock_facet = double(:name => 'basic_field', :items => [1, 2, 3])
|
151
|
+
expect(helper).to receive(:render).with(hash_including(:partial => 'facet_limit',
|
152
|
+
:locals => {
|
153
|
+
:solr_field => 'basic_field',
|
154
|
+
:field_name => 'basic_field',
|
155
|
+
:facet_field => helper.blacklight_config.facet_fields['basic_field'],
|
156
|
+
:display_facet => mock_facet }
|
157
|
+
))
|
158
|
+
helper.render_facet_limit(mock_facet)
|
188
159
|
end
|
189
160
|
|
190
161
|
it "renders a facet _not_ declared in the configuration" do
|
191
|
-
|
192
|
-
|
193
|
-
helper.render_facet_limit(
|
162
|
+
mock_facet = double(:name => 'asdf', :items => [1, 2, 3])
|
163
|
+
expect(helper).to receive(:render).with(hash_including(:partial => 'facet_limit'))
|
164
|
+
helper.render_facet_limit(mock_facet)
|
194
165
|
end
|
195
166
|
|
196
167
|
it "gets the partial name from the configuration" do
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
end
|
168
|
+
expect(helper).to receive(:render).with(hash_including(:partial => 'custom_facet_partial'))
|
169
|
+
helper.render_facet_limit(mock_custom_facet)
|
170
|
+
end
|
201
171
|
|
202
172
|
it "uses a partial layout for rendering the facet frame" do
|
203
|
-
|
204
|
-
|
205
|
-
helper.render_facet_limit(@mock_facet)
|
173
|
+
expect(helper).to receive(:render).with(hash_including(:layout => 'facet_layout'))
|
174
|
+
helper.render_facet_limit(mock_custom_facet)
|
206
175
|
end
|
207
176
|
|
208
177
|
it "allows the caller to opt-out of facet layouts" do
|
209
|
-
|
210
|
-
|
211
|
-
helper.render_facet_limit(@mock_facet, :layout => nil)
|
178
|
+
expect(helper).to receive(:render).with(hash_including(:layout => nil))
|
179
|
+
helper.render_facet_limit(mock_custom_facet, :layout => nil)
|
212
180
|
end
|
213
181
|
|
214
182
|
it "renders the facet_pivot partial for pivot facets" do
|
215
|
-
|
216
|
-
|
217
|
-
helper.render_facet_limit(
|
218
|
-
end
|
183
|
+
mock_facet = double(:name => 'pivot_facet_field', :items => [1, 2, 3])
|
184
|
+
expect(helper).to receive(:render).with(hash_including(:partial => 'facet_pivot'))
|
185
|
+
helper.render_facet_limit(mock_facet)
|
186
|
+
end
|
219
187
|
|
220
188
|
it "lets you override the rendered partial for pivot facets" do
|
221
|
-
|
222
|
-
|
223
|
-
helper.render_facet_limit(
|
224
|
-
end
|
189
|
+
mock_facet = double(:name => 'my_pivot_facet_field_with_custom_partial', :items => [1, 2, 3])
|
190
|
+
expect(helper).to receive(:render).with(hash_including(:partial => 'custom_facet_partial'))
|
191
|
+
helper.render_facet_limit(mock_facet)
|
192
|
+
end
|
225
193
|
end
|
226
194
|
|
227
195
|
describe "render_facet_limit_list" do
|
@@ -234,22 +202,21 @@ describe FacetsHelper do
|
|
234
202
|
search_catalog_path *args
|
235
203
|
end
|
236
204
|
end
|
205
|
+
|
237
206
|
it "draws a list of elements" do
|
238
207
|
expect(subject).to have_selector 'li', count: 2
|
239
|
-
expect(subject).to have_selector 'li:first-child a.facet_select', text: 'Book'
|
240
|
-
expect(subject).to have_selector 'li:nth-child(2) a.facet_select', text: 'Musical Score'
|
208
|
+
expect(subject).to have_selector 'li:first-child a.facet_select', text: 'Book'
|
209
|
+
expect(subject).to have_selector 'li:nth-child(2) a.facet_select', text: 'Musical Score'
|
241
210
|
end
|
242
211
|
|
243
212
|
context "when one of the facet items is rendered as nil" do
|
244
213
|
# An app may override render_facet_item to filter out some undesired facet items by returning nil.
|
245
|
-
|
246
|
-
before { allow(helper).to receive(:render_facet_item).and_return("<a class=\"facet_select\">Book</a>".html_safe, nil) }
|
214
|
+
before { allow(helper).to receive(:render_facet_item).and_return('<a class="facet_select">Book</a>'.html_safe, nil) }
|
247
215
|
|
248
216
|
it "draws a list of elements" do
|
249
217
|
expect(subject).to have_selector 'li', count: 1
|
250
|
-
expect(subject).to have_selector 'li:first-child a.facet_select', text: 'Book'
|
218
|
+
expect(subject).to have_selector 'li:first-child a.facet_select', text: 'Book'
|
251
219
|
end
|
252
|
-
|
253
220
|
end
|
254
221
|
end
|
255
222
|
|
@@ -311,8 +278,9 @@ describe FacetsHelper do
|
|
311
278
|
search_catalog_path *args
|
312
279
|
end
|
313
280
|
end
|
281
|
+
|
314
282
|
describe "simple case" do
|
315
|
-
let(:expected_html) {
|
283
|
+
let(:expected_html) { '<span class="facet-label"><a class="facet_select" href="/catalog">Z</a></span><span class="facet-count">10</span>' }
|
316
284
|
|
317
285
|
it "uses facet_display_value" do
|
318
286
|
result = helper.render_facet_value('simple_field', item)
|
@@ -321,7 +289,7 @@ describe FacetsHelper do
|
|
321
289
|
end
|
322
290
|
|
323
291
|
describe "when :url_method is set" do
|
324
|
-
let(:expected_html) {
|
292
|
+
let(:expected_html) { '<span class="facet-label"><a class="facet_select" href="/blabla">Z</a></span><span class="facet-count">10</span>' }
|
325
293
|
it "uses that method" do
|
326
294
|
allow(helper).to receive(:facet_configuration_for_field).with('simple_field').and_return(double(:query => nil, :date => nil, :helper_method => nil, :single => false, :url_method => :test_method))
|
327
295
|
allow(helper).to receive(:test_method).with('simple_field', item).and_return('/blabla')
|
@@ -331,14 +299,14 @@ describe FacetsHelper do
|
|
331
299
|
end
|
332
300
|
|
333
301
|
describe "when :suppress_link is set" do
|
334
|
-
let(:expected_html) {
|
302
|
+
let(:expected_html) { '<span class="facet-label">Z</span><span class="facet-count">10</span>' }
|
335
303
|
it "suppresses the link" do
|
336
304
|
result = helper.render_facet_value('simple_field', item, :suppress_link => true)
|
337
305
|
expect(result).to be_equivalent_to(expected_html).respecting_element_order
|
338
306
|
end
|
339
307
|
end
|
340
308
|
end
|
341
|
-
|
309
|
+
|
342
310
|
describe "#facet_display_value" do
|
343
311
|
it "justs be the facet value for an ordinary facet" do
|
344
312
|
allow(helper).to receive(:facet_configuration_for_field).with('simple_field').and_return(double(:query => nil, :date => nil, :helper_method => nil, :url_method => nil))
|
@@ -347,9 +315,7 @@ describe FacetsHelper do
|
|
347
315
|
|
348
316
|
it "allows you to pass in a :helper_method argument to the configuration" do
|
349
317
|
allow(helper).to receive(:facet_configuration_for_field).with('helper_field').and_return(double(:query => nil, :date => nil, :url_method => nil, :helper_method => :my_facet_value_renderer))
|
350
|
-
|
351
318
|
allow(helper).to receive(:my_facet_value_renderer).with('qwerty').and_return('abc')
|
352
|
-
|
353
319
|
expect(helper.facet_display_value('helper_field', 'qwerty')).to eq 'abc'
|
354
320
|
end
|
355
321
|
|