blacklight 9.0.0.beta7 → 9.0.0.beta8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.docker/app/Dockerfile +2 -1
- data/.github/matrix.json +14 -3
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight/blacklight.esm.js +7 -4
- data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -1
- data/app/assets/javascripts/blacklight/blacklight.js +7 -4
- data/app/assets/javascripts/blacklight/blacklight.js.map +1 -1
- data/app/components/blacklight/advanced_search_form_component.rb +2 -1
- data/app/components/blacklight/document_component.rb +10 -13
- data/app/components/blacklight/facets/filters_component.rb +1 -1
- data/app/components/blacklight/facets/suggest_component.rb +2 -3
- data/app/components/blacklight/metadata_field_component.html.erb +2 -2
- data/app/components/blacklight/metadata_field_component.rb +2 -1
- data/app/components/blacklight/metadata_field_layout_component.rb +9 -4
- data/app/components/blacklight/search_bar_component.html.erb +1 -1
- data/app/javascript/blacklight-frontend/modal.js +7 -4
- data/app/presenters/blacklight/document_presenter.rb +6 -5
- data/app/presenters/blacklight/facet_field_presenter.rb +10 -3
- data/app/presenters/blacklight/field_presenter.rb +4 -2
- data/app/presenters/blacklight/rendering/abstract_step.rb +7 -1
- data/app/presenters/blacklight/rendering/join.rb +9 -5
- data/app/presenters/blacklight/rendering/terminator.rb +1 -1
- data/app/views/catalog/_show_main_content.html.erb +9 -5
- data/app/views/catalog/index.html.erb +0 -1
- data/app/views/catalog/show.html.erb +2 -2
- data/config/locales/blacklight.en.yml +1 -1
- data/lib/blacklight/component.rb +2 -0
- data/lib/blacklight/configuration/facet_field.rb +2 -0
- data/lib/blacklight/configuration/view_config.rb +30 -16
- data/lib/blacklight/configuration.rb +56 -5
- data/lib/blacklight/search_state/pivot_filter_field.rb +1 -1
- data/lib/blacklight/solr/field_reflection_search_builder.rb +11 -0
- data/lib/blacklight/solr/repository.rb +5 -5
- data/lib/blacklight/solr/search_builder_behavior.rb +19 -2
- data/lib/blacklight/solr/single_doc_search_builder.rb +25 -0
- data/lib/generators/blacklight/templates/catalog_controller.rb +26 -4
- data/lib/generators/blacklight/templates/solr/conf/solrconfig.xml +0 -67
- data/package.json +1 -1
- data/spec/components/blacklight/document_component_spec.rb +0 -7
- data/spec/components/blacklight/facets/filters_component_spec.rb +2 -2
- data/spec/components/blacklight/facets/suggest_component_spec.rb +13 -0
- data/spec/components/blacklight/search_bar_component_spec.rb +24 -1
- data/spec/controllers/blacklight/catalog_spec.rb +1 -1
- data/spec/features/advanced_search_spec.rb +39 -20
- data/spec/models/blacklight/configuration_spec.rb +126 -0
- data/spec/models/blacklight/solr/repository_spec.rb +6 -0
- data/spec/models/blacklight/solr/search_builder_behavior_spec.rb +52 -6
- data/spec/presenters/blacklight/document_presenter_spec.rb +3 -3
- data/spec/presenters/blacklight/field_presenter_spec.rb +103 -22
- data/spec/presenters/blacklight/rendering/pipeline_spec.rb +130 -14
- metadata +4 -5
- data/app/views/shared/_sitelinks_search_box.html.erb +0 -12
- data/spec/features/sitelinks_search_box_spec.rb +0 -13
|
@@ -6,6 +6,8 @@ RSpec.describe Blacklight::FieldPresenter, :api do
|
|
|
6
6
|
let(:request_context) { double('View context', params: { x: '1' }, search_state: search_state, should_render_field?: true, blacklight_config: config) }
|
|
7
7
|
let(:document) do
|
|
8
8
|
SolrDocument.new(id: 1,
|
|
9
|
+
'join_true' => %w[a b c],
|
|
10
|
+
'separator_options' => %w[d e f],
|
|
9
11
|
'link_to_facet_true' => 'x',
|
|
10
12
|
'link_to_facet_named' => 'x',
|
|
11
13
|
'qwer' => 'document qwer value',
|
|
@@ -30,6 +32,8 @@ RSpec.describe Blacklight::FieldPresenter, :api do
|
|
|
30
32
|
Blacklight::Configuration.new.configure do |config|
|
|
31
33
|
config.add_index_field 'qwer'
|
|
32
34
|
config.add_index_field 'asdf', helper_method: :render_asdf_index_field
|
|
35
|
+
config.add_index_field 'join_true', join: true
|
|
36
|
+
config.add_index_field 'separator_options', separator_options: { words_connector: '<br/>', last_word_connector: '<br/>' }
|
|
33
37
|
config.add_index_field 'link_to_facet_true', link_to_facet: true
|
|
34
38
|
config.add_index_field 'link_to_facet_named', link_to_facet: :some_field
|
|
35
39
|
config.add_index_field 'highlight', highlight: true
|
|
@@ -40,6 +44,7 @@ RSpec.describe Blacklight::FieldPresenter, :api do
|
|
|
40
44
|
config.add_index_field 'alias', field: 'qwer'
|
|
41
45
|
config.add_index_field 'with_default', default: 'value'
|
|
42
46
|
config.add_index_field 'with_steps', steps: [custom_step]
|
|
47
|
+
config.add_index_field :some_field
|
|
43
48
|
config.add_facet_field :link_to_facet_true
|
|
44
49
|
config.add_facet_field :some_field
|
|
45
50
|
end
|
|
@@ -51,25 +56,33 @@ RSpec.describe Blacklight::FieldPresenter, :api do
|
|
|
51
56
|
context 'when an explicit html value is provided' do
|
|
52
57
|
let(:options) { { value: '<b>val1</b>' } }
|
|
53
58
|
|
|
54
|
-
it { is_expected.
|
|
59
|
+
it { is_expected.to eq(['<b>val1</b>']) }
|
|
60
|
+
|
|
61
|
+
it 'does not mark value as html_safe' do
|
|
62
|
+
expect(result.first).not_to be_html_safe
|
|
63
|
+
end
|
|
55
64
|
end
|
|
56
65
|
|
|
57
66
|
context 'when an explicit array value with unsafe characters is provided' do
|
|
58
67
|
let(:options) { { value: ['<a', 'b'] } }
|
|
59
68
|
|
|
60
|
-
it { is_expected.to eq(
|
|
69
|
+
it { is_expected.to eq(%w[<a b]) }
|
|
70
|
+
|
|
71
|
+
it 'does not mark values as html_safe' do
|
|
72
|
+
expect(subject.all?(&:html_safe?)).not_to be true
|
|
73
|
+
end
|
|
61
74
|
end
|
|
62
75
|
|
|
63
76
|
context 'when an explicit array value is provided' do
|
|
64
77
|
let(:options) { { value: %w[a b c] } }
|
|
65
78
|
|
|
66
|
-
it { is_expected.to eq
|
|
79
|
+
it { is_expected.to eq %w[a b c] }
|
|
67
80
|
end
|
|
68
81
|
|
|
69
82
|
context 'when an explicit value is provided' do
|
|
70
83
|
let(:options) { { value: 'asdf' } }
|
|
71
84
|
|
|
72
|
-
it { is_expected.to eq 'asdf' }
|
|
85
|
+
it { is_expected.to eq ['asdf'] }
|
|
73
86
|
end
|
|
74
87
|
|
|
75
88
|
context 'when field has a helper method' do
|
|
@@ -77,7 +90,7 @@ RSpec.describe Blacklight::FieldPresenter, :api do
|
|
|
77
90
|
allow(request_context).to receive(:render_asdf_index_field).and_return('custom asdf value')
|
|
78
91
|
end
|
|
79
92
|
|
|
80
|
-
it { is_expected.to eq 'custom asdf value' }
|
|
93
|
+
it { is_expected.to eq ['custom asdf value'] }
|
|
81
94
|
end
|
|
82
95
|
|
|
83
96
|
context 'when field has link_to_facet with true' do
|
|
@@ -88,7 +101,7 @@ RSpec.describe Blacklight::FieldPresenter, :api do
|
|
|
88
101
|
|
|
89
102
|
let(:field_name) { 'link_to_facet_true' }
|
|
90
103
|
|
|
91
|
-
it { is_expected.to eq 'bar' }
|
|
104
|
+
it { is_expected.to eq ['bar'] }
|
|
92
105
|
end
|
|
93
106
|
|
|
94
107
|
context 'when field has link_to_facet with a field name' do
|
|
@@ -99,7 +112,7 @@ RSpec.describe Blacklight::FieldPresenter, :api do
|
|
|
99
112
|
|
|
100
113
|
let(:field_name) { 'link_to_facet_named' }
|
|
101
114
|
|
|
102
|
-
it { is_expected.to eq 'bar' }
|
|
115
|
+
it { is_expected.to eq ['bar'] }
|
|
103
116
|
end
|
|
104
117
|
|
|
105
118
|
context 'when no highlight field is available' do
|
|
@@ -120,14 +133,14 @@ RSpec.describe Blacklight::FieldPresenter, :api do
|
|
|
120
133
|
|
|
121
134
|
let(:field_name) { 'highlight' }
|
|
122
135
|
|
|
123
|
-
it { is_expected.to eq '<em>highlight</em>' }
|
|
136
|
+
it { is_expected.to eq ['<em>highlight</em>'] }
|
|
124
137
|
end
|
|
125
138
|
|
|
126
139
|
context 'when no options are provided' do
|
|
127
140
|
let(:field_name) { 'qwer' }
|
|
128
141
|
|
|
129
142
|
it "checks the document field value" do
|
|
130
|
-
expect(subject).to eq 'document qwer value'
|
|
143
|
+
expect(subject).to eq ['document qwer value']
|
|
131
144
|
end
|
|
132
145
|
end
|
|
133
146
|
|
|
@@ -138,7 +151,7 @@ RSpec.describe Blacklight::FieldPresenter, :api do
|
|
|
138
151
|
|
|
139
152
|
let(:field_name) { 'solr_doc_accessor' }
|
|
140
153
|
|
|
141
|
-
it { is_expected.to eq '123' }
|
|
154
|
+
it { is_expected.to eq ['123'] }
|
|
142
155
|
end
|
|
143
156
|
|
|
144
157
|
context 'when accessor is set to a value' do
|
|
@@ -147,7 +160,7 @@ RSpec.describe Blacklight::FieldPresenter, :api do
|
|
|
147
160
|
it 'calls the accessor with the field_name as the argument' do
|
|
148
161
|
expect(document).to receive(:solr_doc_accessor).with('explicit_accessor').and_return("123")
|
|
149
162
|
|
|
150
|
-
expect(subject).to eq '123'
|
|
163
|
+
expect(subject).to eq ['123']
|
|
151
164
|
end
|
|
152
165
|
end
|
|
153
166
|
|
|
@@ -157,7 +170,7 @@ RSpec.describe Blacklight::FieldPresenter, :api do
|
|
|
157
170
|
it 'calls the accessors on the return of the preceeding' do
|
|
158
171
|
allow(document).to receive_message_chain(:solr_doc_accessor, some_method: "123")
|
|
159
172
|
|
|
160
|
-
expect(subject).to eq '123'
|
|
173
|
+
expect(subject).to eq ['123']
|
|
161
174
|
end
|
|
162
175
|
end
|
|
163
176
|
|
|
@@ -165,26 +178,26 @@ RSpec.describe Blacklight::FieldPresenter, :api do
|
|
|
165
178
|
let(:field_name) { 'explicit_values_with_context' }
|
|
166
179
|
|
|
167
180
|
it 'calls the accessors on the return of the preceeding' do
|
|
168
|
-
expect(subject).to eq '1'
|
|
181
|
+
expect(subject).to eq ['1']
|
|
169
182
|
end
|
|
170
183
|
end
|
|
171
184
|
|
|
172
185
|
context 'when the field is an alias' do
|
|
173
186
|
let(:field_name) { 'alias' }
|
|
174
187
|
|
|
175
|
-
it { is_expected.to eq 'document qwer value' }
|
|
188
|
+
it { is_expected.to eq ['document qwer value'] }
|
|
176
189
|
end
|
|
177
190
|
|
|
178
191
|
context 'when the field has a default' do
|
|
179
192
|
let(:field_name) { 'with_default' }
|
|
180
193
|
|
|
181
|
-
it { is_expected.to eq 'value' }
|
|
194
|
+
it { is_expected.to eq ['value'] }
|
|
182
195
|
end
|
|
183
196
|
|
|
184
197
|
context 'with steps' do
|
|
185
198
|
let(:field_name) { 'with_steps' }
|
|
186
199
|
|
|
187
|
-
it { is_expected.to eq 'Static step' }
|
|
200
|
+
it { is_expected.to eq ['Static step'] }
|
|
188
201
|
end
|
|
189
202
|
|
|
190
203
|
context 'for a field with the helper_method option' do
|
|
@@ -200,12 +213,80 @@ RSpec.describe Blacklight::FieldPresenter, :api do
|
|
|
200
213
|
args.first
|
|
201
214
|
end
|
|
202
215
|
|
|
203
|
-
expect(result).to
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
216
|
+
expect(result).to contain_exactly({ document: document, field: field_name,
|
|
217
|
+
value: ['value'], config: field_config, a: 1 })
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
context 'when joining a field' do
|
|
222
|
+
context 'with join config' do
|
|
223
|
+
let(:field_name) { :join_true }
|
|
224
|
+
|
|
225
|
+
it { is_expected.to eq ['a, b, and c'] }
|
|
226
|
+
|
|
227
|
+
it 'marks the value as html_safe' do
|
|
228
|
+
expect(result.first).to be_html_safe
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
context 'with separator_options' do
|
|
233
|
+
let(:field_name) { :separator_options }
|
|
234
|
+
|
|
235
|
+
it { is_expected.to eq ['d<br/>e<br/>f'] }
|
|
236
|
+
|
|
237
|
+
it 'marks the value as html_safe' do
|
|
238
|
+
expect(result.first).to be_html_safe
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
context 'with join option' do
|
|
243
|
+
let(:options) { { join: true } }
|
|
244
|
+
let(:field_name) { 'some_field' }
|
|
245
|
+
|
|
246
|
+
it { is_expected.to eq ['1 and 2'] }
|
|
247
|
+
|
|
248
|
+
it 'marks the value as html_safe' do
|
|
249
|
+
expect(result.first).to be_html_safe
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
context 'with a single value' do
|
|
255
|
+
let(:options) { { join: true, value: 1 } }
|
|
256
|
+
|
|
257
|
+
it 'is not joined' do
|
|
258
|
+
expect(result).to eq [1]
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
context 'with a single html value' do
|
|
263
|
+
let(:options) { { join: true, value: '<b>value</b>' } }
|
|
264
|
+
|
|
265
|
+
it { is_expected.to eq ['<b>value</b>'] }
|
|
266
|
+
|
|
267
|
+
it 'does not mark the value as html_safe' do
|
|
268
|
+
expect(result.first).not_to be_html_safe
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
context 'when an array containing unsafe characters provided' do
|
|
273
|
+
let(:options) { { join: true, value: ['<a', 'b'] } }
|
|
274
|
+
|
|
275
|
+
it 'html escapes the unsafe characters' do
|
|
276
|
+
expect(result).to eq ["<a and b"]
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
it 'marks the value as html_safe' do
|
|
280
|
+
expect(result.first).to be_html_safe
|
|
281
|
+
end
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
context 'when outside the html context' do
|
|
285
|
+
let(:field_name) { :join_true }
|
|
286
|
+
let(:options) { { format: 'json' } }
|
|
287
|
+
|
|
288
|
+
it 'does not join the values' do
|
|
289
|
+
expect(result).to eq %w[a b c]
|
|
209
290
|
end
|
|
210
291
|
end
|
|
211
292
|
end
|
|
@@ -12,20 +12,15 @@ RSpec.describe Blacklight::Rendering::Pipeline do
|
|
|
12
12
|
let(:values) { %w[a b] }
|
|
13
13
|
let(:field_config) { Blacklight::Configuration::NullField.new }
|
|
14
14
|
|
|
15
|
-
it { is_expected.to eq
|
|
16
|
-
|
|
17
|
-
context "when separator_options are in the config" do
|
|
18
|
-
let(:values) { %w[c d] }
|
|
19
|
-
let(:field_config) { Blacklight::Configuration::NullField.new(itemprop: nil, separator_options: { two_words_connector: '; ' }) }
|
|
20
|
-
|
|
21
|
-
it { is_expected.to eq "c; d" }
|
|
22
|
-
end
|
|
15
|
+
it { is_expected.to eq %w[a b] }
|
|
23
16
|
|
|
24
17
|
context "when itemprop is in the config" do
|
|
25
18
|
let(:values) { ['a'] }
|
|
26
19
|
let(:field_config) { Blacklight::Configuration::NullField.new(itemprop: 'some-prop', separator_options: nil) }
|
|
27
20
|
|
|
28
|
-
it
|
|
21
|
+
it 'renders the expected markup' do
|
|
22
|
+
expect(rendered.first).to have_css("span[@itemprop='some-prop']", text: "a")
|
|
23
|
+
end
|
|
29
24
|
end
|
|
30
25
|
|
|
31
26
|
it 'sets the operations on the instance as equal to the class variable' do
|
|
@@ -37,13 +32,134 @@ RSpec.describe Blacklight::Rendering::Pipeline do
|
|
|
37
32
|
end
|
|
38
33
|
|
|
39
34
|
context 'outside of an HTML context' do
|
|
40
|
-
|
|
35
|
+
context 'when options determines format' do
|
|
36
|
+
let(:options) { { format: 'text' } }
|
|
37
|
+
|
|
38
|
+
let(:values) { ['"blah"', "<notatag>"] }
|
|
39
|
+
let(:field_config) { Blacklight::Configuration::NullField.new itemprop: 'some-prop' }
|
|
40
|
+
|
|
41
|
+
it 'does not HTML escape values or inject HTML tags' do
|
|
42
|
+
expect(rendered).to eq ['"blah"', "<notatag>"]
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
context 'when context determines format' do
|
|
47
|
+
let(:values) { ['"blah"', "<notatag>"] }
|
|
48
|
+
let(:field_config) { Blacklight::Configuration::NullField.new itemprop: 'some-prop' }
|
|
49
|
+
let(:controller) { CatalogController.new }
|
|
50
|
+
let(:search_state) { Blacklight::SearchState.new({ format: 'text' }, controller.blacklight_config, controller) }
|
|
51
|
+
|
|
52
|
+
before { allow(context).to receive(:search_state).and_return(search_state) }
|
|
53
|
+
|
|
54
|
+
it 'does not HTML escape values or inject HTML tags' do
|
|
55
|
+
expect(rendered).to eq ['"blah"', '<notatag>']
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
context 'when link_to_facet is in the config' do
|
|
61
|
+
let(:values) { %w[book manuscript] }
|
|
62
|
+
let(:field_config) { Blacklight::Configuration::Field.new(field: 'format', key: 'format', link_to_facet: true) }
|
|
63
|
+
let(:controller) { CatalogController.new }
|
|
64
|
+
let(:search_state) { Blacklight::SearchState.new({}, controller.blacklight_config, controller) }
|
|
65
|
+
|
|
66
|
+
before do
|
|
67
|
+
allow(context).to receive(:search_state).and_return(search_state)
|
|
68
|
+
allow(context).to receive(:search_action_path) { |f| "/catalog?f[format][]=#{f['f']['format'].first}" }
|
|
69
|
+
allow(context).to receive(:link_to) { |value, link| ActiveSupport::SafeBuffer.new("<a href=#{link}>#{value}</a>") }
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it 'renders html' do
|
|
73
|
+
expect(rendered).to eq ["<a href=/catalog?f[format][]=book>book</a>", "<a href=/catalog?f[format][]=manuscript>manuscript</a>"]
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
context 'outside html context' do
|
|
77
|
+
let(:values) { %w[book manuscript] }
|
|
78
|
+
let(:field_config) { Blacklight::Configuration::Field.new(field: 'format', link_to_facet: true) }
|
|
79
|
+
let(:search_state) { Blacklight::SearchState.new({ format: 'json' }, CatalogController.blacklight_config, CatalogController.new) }
|
|
80
|
+
|
|
81
|
+
it 'does not render html' do
|
|
82
|
+
expect(rendered).to eq %w[book manuscript]
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
context 'when joining values' do
|
|
88
|
+
context 'with join in the config' do
|
|
89
|
+
let(:field_config) { Blacklight::Configuration::NullField.new(join: true) }
|
|
90
|
+
|
|
91
|
+
it 'joins the values' do
|
|
92
|
+
expect(rendered).to eq ['a and b']
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
context 'with join is in the options' do
|
|
97
|
+
let(:options) { { join: true } }
|
|
98
|
+
let(:field_config) { Blacklight::Configuration::NullField.new }
|
|
99
|
+
|
|
100
|
+
it 'joins the values' do
|
|
101
|
+
expect(rendered).to eq ['a and b']
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
context 'with separator_options in the config' do
|
|
106
|
+
let(:values) { %w[c d] }
|
|
107
|
+
let(:field_config) { Blacklight::Configuration::NullField.new(separator_options: { two_words_connector: '; ' }) }
|
|
108
|
+
|
|
109
|
+
it { is_expected.to eq ["c; d"] }
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
context 'with a single value' do
|
|
113
|
+
let(:values) { [1] }
|
|
114
|
+
let(:field_config) { Blacklight::Configuration::NullField.new(join: true) }
|
|
115
|
+
|
|
116
|
+
it 'does not run the join step' do
|
|
117
|
+
expect(rendered).to eq [1]
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
context 'with a single html value' do
|
|
122
|
+
let(:values) { ['<b>value</b>'] }
|
|
123
|
+
let(:field_config) { Blacklight::Configuration::NullField.new(join: true) }
|
|
124
|
+
|
|
125
|
+
it 'does not escape the html' do
|
|
126
|
+
expect(rendered).to eq ['<b>value</b>']
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
it 'does not mark the value as html_safe' do
|
|
130
|
+
expect(rendered.first).not_to be_html_safe
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
context 'with an array of values containing unsafe characters' do
|
|
135
|
+
let(:values) { ['<a', 'b'] }
|
|
136
|
+
let(:field_config) { Blacklight::Configuration::NullField.new(join: true) }
|
|
137
|
+
|
|
138
|
+
it 'escapes the unsafe characters' do
|
|
139
|
+
expect(rendered).to eq ["<a and b"]
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
it 'marks the joined value as html_safe' do
|
|
143
|
+
expect(rendered.first).to be_html_safe
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
context 'outside the html context' do
|
|
148
|
+
let(:values) { %w[a b <c] }
|
|
149
|
+
let(:field_config) { Blacklight::Configuration::Field.new(join: true) }
|
|
150
|
+
let(:options) { { format: 'json' } }
|
|
151
|
+
|
|
152
|
+
it 'does not run the join step' do
|
|
153
|
+
expect(rendered).to eq %w[a b <c]
|
|
154
|
+
end
|
|
41
155
|
|
|
42
|
-
|
|
43
|
-
|
|
156
|
+
it 'does not escape unsafe html characters' do
|
|
157
|
+
expect(rendered.last).to eq '<c'
|
|
158
|
+
end
|
|
44
159
|
|
|
45
|
-
|
|
46
|
-
|
|
160
|
+
it 'does not mark the values as html_safe' do
|
|
161
|
+
expect(rendered.none?(&:html_safe?)).to be true
|
|
162
|
+
end
|
|
47
163
|
end
|
|
48
164
|
end
|
|
49
165
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: blacklight
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 9.0.0.
|
|
4
|
+
version: 9.0.0.beta8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jonathan Rochkind
|
|
@@ -738,7 +738,6 @@ files:
|
|
|
738
738
|
- app/views/shared/_flash_msg.html.erb
|
|
739
739
|
- app/views/shared/_footer.html.erb
|
|
740
740
|
- app/views/shared/_modal.html.erb
|
|
741
|
-
- app/views/shared/_sitelinks_search_box.html.erb
|
|
742
741
|
- app/views/shared/_user_util_links.html.erb
|
|
743
742
|
- blacklight.gemspec
|
|
744
743
|
- compose.yaml
|
|
@@ -799,6 +798,7 @@ files:
|
|
|
799
798
|
- lib/blacklight/solr/document.rb
|
|
800
799
|
- lib/blacklight/solr/facet_paginator.rb
|
|
801
800
|
- lib/blacklight/solr/facet_search_builder_behavior.rb
|
|
801
|
+
- lib/blacklight/solr/field_reflection_search_builder.rb
|
|
802
802
|
- lib/blacklight/solr/repository.rb
|
|
803
803
|
- lib/blacklight/solr/request.rb
|
|
804
804
|
- lib/blacklight/solr/response.rb
|
|
@@ -811,6 +811,7 @@ files:
|
|
|
811
811
|
- lib/blacklight/solr/response/response.rb
|
|
812
812
|
- lib/blacklight/solr/response/spelling.rb
|
|
813
813
|
- lib/blacklight/solr/search_builder_behavior.rb
|
|
814
|
+
- lib/blacklight/solr/single_doc_search_builder.rb
|
|
814
815
|
- lib/blacklight/version.rb
|
|
815
816
|
- lib/generators/blacklight/assets/importmap_generator.rb
|
|
816
817
|
- lib/generators/blacklight/assets/propshaft_generator.rb
|
|
@@ -911,7 +912,6 @@ files:
|
|
|
911
912
|
- spec/features/search_results_spec.rb
|
|
912
913
|
- spec/features/search_sort_spec.rb
|
|
913
914
|
- spec/features/search_spec.rb
|
|
914
|
-
- spec/features/sitelinks_search_box_spec.rb
|
|
915
915
|
- spec/features/sms_spec.rb
|
|
916
916
|
- spec/fixtures/sample_solr_documents.yml
|
|
917
917
|
- spec/helpers/blacklight/configuration_helper_behavior_spec.rb
|
|
@@ -1031,7 +1031,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
1031
1031
|
- !ruby/object:Gem::Version
|
|
1032
1032
|
version: '0'
|
|
1033
1033
|
requirements: []
|
|
1034
|
-
rubygems_version: 3.
|
|
1034
|
+
rubygems_version: 3.7.1
|
|
1035
1035
|
specification_version: 4
|
|
1036
1036
|
summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
|
|
1037
1037
|
index.
|
|
@@ -1096,7 +1096,6 @@ test_files:
|
|
|
1096
1096
|
- spec/features/search_results_spec.rb
|
|
1097
1097
|
- spec/features/search_sort_spec.rb
|
|
1098
1098
|
- spec/features/search_spec.rb
|
|
1099
|
-
- spec/features/sitelinks_search_box_spec.rb
|
|
1100
1099
|
- spec/features/sms_spec.rb
|
|
1101
1100
|
- spec/fixtures/sample_solr_documents.yml
|
|
1102
1101
|
- spec/helpers/blacklight/configuration_helper_behavior_spec.rb
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<script type="application/ld+json">
|
|
2
|
-
{
|
|
3
|
-
"@context": "http://schema.org",
|
|
4
|
-
"@type": "WebSite",
|
|
5
|
-
"url": "<%= root_url %>",
|
|
6
|
-
"potentialAction": {
|
|
7
|
-
"@type": "SearchAction",
|
|
8
|
-
"target": "<%= root_url %>?q={search_term_string}",
|
|
9
|
-
"query-input": "required name=search_term_string"
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
</script>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
RSpec.describe 'Sitelinks search box' do
|
|
4
|
-
it 'is home page' do
|
|
5
|
-
visit root_path
|
|
6
|
-
expect(page).to have_css 'script[type="application/ld+json"]', visible: :hidden
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
it 'on search page' do
|
|
10
|
-
visit search_catalog_path q: 'book'
|
|
11
|
-
expect(page).to have_no_css 'script[type="application/ld+json"]', visible: :hidden
|
|
12
|
-
end
|
|
13
|
-
end
|