blacklight 7.1.0 → 7.2.0
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/.jshintrc +3 -1
- data/.rubocop_todo.yml +8 -8
- data/.travis.yml +13 -13
- data/CONTRIBUTING.md +3 -1
- data/Gemfile +2 -0
- data/VERSION +1 -1
- data/app/assets/images/blacklight/list.svg +1 -1
- data/app/assets/images/blacklight/search.svg +1 -1
- data/app/assets/javascripts/blacklight/blacklight.js +82 -70
- data/app/assets/stylesheets/blacklight/_bootstrap_overrides.scss +17 -13
- data/app/assets/stylesheets/blacklight/_facets.scss +3 -0
- data/app/assets/stylesheets/blacklight/_header.scss +26 -0
- data/app/assets/stylesheets/blacklight/_icons.scss +6 -6
- data/app/assets/stylesheets/blacklight/_mixins.scss +3 -3
- data/app/controllers/concerns/blacklight/facet.rb +1 -7
- data/app/helpers/blacklight/catalog_helper_behavior.rb +16 -17
- data/app/helpers/blacklight/layout_helper_behavior.rb +2 -2
- data/app/helpers/blacklight/url_helper_behavior.rb +1 -1
- data/app/javascript/blacklight/button_focus.js +9 -0
- data/app/javascript/blacklight/facet_load.js +18 -19
- data/app/javascript/blacklight/search_context.js +67 -49
- data/app/models/blacklight/icon.rb +26 -5
- data/app/presenters/blacklight/search_bar_presenter.rb +3 -1
- data/app/views/catalog/_bookmark_control.html.erb +11 -13
- data/app/views/catalog/_facet_group.html.erb +1 -1
- data/app/views/catalog/_facet_layout.html.erb +9 -2
- data/app/views/catalog/_facets.html.erb +1 -1
- data/app/views/catalog/_per_page_widget.html.erb +1 -1
- data/app/views/catalog/_search_form.html.erb +1 -1
- data/app/views/catalog/_search_results.html.erb +4 -0
- data/app/views/catalog/_sort_widget.html.erb +1 -1
- data/app/views/layouts/blacklight.html.erb +2 -2
- data/app/views/layouts/blacklight/base.html.erb +14 -8
- data/config/locales/blacklight.de.yml +17 -2
- data/config/locales/blacklight.en.yml +17 -2
- data/config/locales/blacklight.es.yml +17 -2
- data/config/locales/blacklight.fr.yml +17 -2
- data/config/locales/blacklight.hu.yml +17 -3
- data/config/locales/blacklight.it.yml +17 -2
- data/config/locales/blacklight.nl.yml +17 -3
- data/config/locales/blacklight.pt-BR.yml +17 -2
- data/config/locales/blacklight.sq.yml +17 -2
- data/config/locales/blacklight.zh.yml +17 -3
- data/lib/blacklight/configuration.rb +6 -0
- data/lib/blacklight/engine.rb +5 -4
- data/lib/blacklight/solr.rb +2 -0
- data/{app/models/concerns → lib}/blacklight/solr/document.rb +0 -0
- data/{app/models → lib}/blacklight/solr/facet_paginator.rb +0 -0
- data/lib/blacklight/solr/response/group_response.rb +10 -0
- data/lib/blacklight/solr/response/pagination_methods.rb +12 -0
- data/lib/generators/blacklight/assets_generator.rb +4 -1
- data/package-lock.json +1 -1
- data/package.json +2 -2
- data/spec/features/facets_spec.rb +22 -1
- data/spec/features/search_filters_spec.rb +25 -5
- data/spec/helpers/blacklight/layout_helper_behavior_spec.rb +4 -4
- data/spec/helpers/catalog_helper_spec.rb +0 -9
- data/spec/models/blacklight/icon_spec.rb +25 -1
- data/spec/models/blacklight/solr/response/group_response_spec.rb +13 -0
- data/spec/models/blacklight/solr/response_spec.rb +3 -0
- data/spec/presenters/blacklight/search_bar_presenter_spec.rb +15 -0
- data/spec/views/catalog/_facet_group.html.erb_spec.rb +82 -0
- data/spec/views/catalog/_facet_layout.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_facets.html.erb_spec.rb +5 -66
- metadata +7 -5
- data/app/javascript/blacklight/collapsable.js +0 -9
@@ -22,6 +22,10 @@ pt-BR:
|
|
22
22
|
|
23
23
|
blacklight:
|
24
24
|
application_name: 'Blacklight'
|
25
|
+
skip_links:
|
26
|
+
main_content: 'Ir para o conteúdo principal'
|
27
|
+
search_field: 'Ir para a pesquisa'
|
28
|
+
first_result: 'Ir para o primeiro resultado da pesquisa'
|
25
29
|
header_links:
|
26
30
|
login: 'Acessar'
|
27
31
|
logout: 'Sair'
|
@@ -144,11 +148,13 @@ pt-BR:
|
|
144
148
|
invalid_solr_id: "Desculpe, você solicitou um cadastro que não existe."
|
145
149
|
per_page:
|
146
150
|
label: '%{count}<span class="hide-text"> por página</span>'
|
147
|
-
button_label: '%{count} por página'
|
151
|
+
button_label: '%{count} por página' # TODO: Remove during major release
|
152
|
+
button_label_html: '%{count}<span class="d-none d-sm-inline"> por página</span>'
|
148
153
|
title: 'Número de resultados para mostrar por página'
|
149
154
|
submit: 'Atualizar'
|
150
155
|
sort:
|
151
|
-
label: 'Ordenar por %{field}'
|
156
|
+
label: 'Ordenar por %{field}' # TODO: Remove during major release
|
157
|
+
label_html: 'Ordenar<span class="d-none d-sm-inline"> por %{field}</span>'
|
152
158
|
submit: 'ordenar resultados'
|
153
159
|
form:
|
154
160
|
search_field:
|
@@ -171,6 +177,9 @@ pt-BR:
|
|
171
177
|
one: '<strong>1 de 1</strong>'
|
172
178
|
other: '<strong>%{current}</strong> de <strong>%{total}</strong>'
|
173
179
|
documents:
|
180
|
+
aria:
|
181
|
+
search_results: 'Resultados da Busca'
|
182
|
+
limit_search: 'Filtre sua busca'
|
174
183
|
counter: '%{counter}. '
|
175
184
|
facets:
|
176
185
|
title: 'Filtre sua busca'
|
@@ -217,5 +226,11 @@ pt-BR:
|
|
217
226
|
|
218
227
|
entry_name:
|
219
228
|
default: 'registro'
|
229
|
+
grouped:
|
230
|
+
default: 'resultado agrupado'
|
220
231
|
|
221
232
|
did_you_mean: 'Você quis dizer: %{options}?'
|
233
|
+
|
234
|
+
main:
|
235
|
+
aria:
|
236
|
+
main_container: 'Conteúdo principal'
|
@@ -12,6 +12,10 @@ sq:
|
|
12
12
|
next: 'Tjetra »'
|
13
13
|
|
14
14
|
blacklight:
|
15
|
+
skip_links:
|
16
|
+
main_content: 'Shkoni tek përmbajtja kryesore'
|
17
|
+
search_field: 'Shkoni në kërkim'
|
18
|
+
first_result: 'Shkoni te rezultati i parë i kërkimit'
|
15
19
|
header_links:
|
16
20
|
login: 'Hyr'
|
17
21
|
logout: 'Dil'
|
@@ -134,11 +138,13 @@ sq:
|
|
134
138
|
invalid_solr_id: "Na vjen keq, ju keni kërkuar një të dhënë që nuk ekziston."
|
135
139
|
per_page:
|
136
140
|
label: '%{count}<span class="sr-only"> për faqe</span>'
|
137
|
-
button_label: '%{count} për faqe'
|
141
|
+
button_label: '%{count} për faqe' # TODO: Remove during major release
|
142
|
+
button_label_html: '%{count}<span class="d-none d-sm-inline"> për faqe</span>'
|
138
143
|
title: 'Numri i rezultateve që do të shfaqen për faqe'
|
139
144
|
submit: 'Përditëso'
|
140
145
|
sort:
|
141
|
-
label: 'Klasifikoj sipas %{field}'
|
146
|
+
label: 'Klasifikoj sipas %{field}' # TODO: Remove during major release
|
147
|
+
label_html: 'Klasifikoj<span class="d-none d-sm-inline"> sipas %{field}</span>'
|
142
148
|
submit: 'klasifiko rezultatet'
|
143
149
|
form:
|
144
150
|
search_field:
|
@@ -161,6 +167,9 @@ sq:
|
|
161
167
|
one: '<strong>1 prej 1</strong>'
|
162
168
|
other: '<strong>%{current}</strong> prej <strong>%{total}</strong>'
|
163
169
|
documents:
|
170
|
+
aria:
|
171
|
+
search_results: 'Rezultatet e kërkimit'
|
172
|
+
limit_search: 'Kufizo këkimin'
|
164
173
|
counter: '%{counter}. '
|
165
174
|
facets:
|
166
175
|
title: 'Kufizo këkimin'
|
@@ -206,5 +215,11 @@ sq:
|
|
206
215
|
|
207
216
|
entry_name:
|
208
217
|
default: 'entry'
|
218
|
+
grouped:
|
219
|
+
default: 'rezultat i grupuar'
|
209
220
|
|
210
221
|
did_you_mean: 'A keni menduar: %{options}?'
|
222
|
+
|
223
|
+
main:
|
224
|
+
aria:
|
225
|
+
main_container: 'Përmbajtja kryesore'
|
@@ -13,7 +13,10 @@ zh:
|
|
13
13
|
|
14
14
|
blacklight:
|
15
15
|
application_name: 'Blacklight'
|
16
|
-
|
16
|
+
skip_links:
|
17
|
+
main_content: '转到主要内容'
|
18
|
+
search_field: '转到搜索'
|
19
|
+
first_result: '转到第一个搜索结果'
|
17
20
|
header_links:
|
18
21
|
login: '登陆'
|
19
22
|
logout: '注销'
|
@@ -136,11 +139,13 @@ zh:
|
|
136
139
|
invalid_solr_id: "抱歉,你要找的结果不存在。"
|
137
140
|
per_page:
|
138
141
|
label: '%{count}<span class="sr-only"> 每页</span>'
|
139
|
-
button_label: '%{count} 每页'
|
142
|
+
button_label: '%{count} 每页' # TODO: Remove during major release
|
143
|
+
button_label_html: '%{count}<span class="d-none d-sm-inline"> 每页</span>'
|
140
144
|
title: '每页显示结果数'
|
141
145
|
submit: '更新'
|
142
146
|
sort:
|
143
|
-
label: '按 %{field} 排序'
|
147
|
+
label: '按 %{field} 排序' # TODO: Remove during major release
|
148
|
+
label_html: '<span class="d-none d-sm-inline">按 %{field} </span>排序'
|
144
149
|
submit: '排序'
|
145
150
|
form:
|
146
151
|
search_field:
|
@@ -163,6 +168,9 @@ zh:
|
|
163
168
|
one: '<strong>1 / 1</strong>'
|
164
169
|
other: '<strong>%{current}</strong> / <strong>%{total}</strong>'
|
165
170
|
documents:
|
171
|
+
aria:
|
172
|
+
search_results: '搜索结果'
|
173
|
+
limit_search: '限定搜索'
|
166
174
|
counter: '%{counter}. '
|
167
175
|
facets:
|
168
176
|
title: '限定搜索'
|
@@ -208,5 +216,11 @@ zh:
|
|
208
216
|
|
209
217
|
entry_name:
|
210
218
|
default: '条目'
|
219
|
+
grouped:
|
220
|
+
default: '分组结果'
|
211
221
|
|
212
222
|
did_you_mean: '你是要输入: %{options} 吗?'
|
223
|
+
|
224
|
+
main:
|
225
|
+
aria:
|
226
|
+
main_container: '主要内容'
|
@@ -245,6 +245,12 @@ module Blacklight
|
|
245
245
|
FacetField.new(field: field).normalize!
|
246
246
|
end
|
247
247
|
|
248
|
+
# @param [String] group (nil) a group name of facet fields
|
249
|
+
# @return [Array<String>] a list of the facet field names from the configuration
|
250
|
+
def facet_field_names(group = nil)
|
251
|
+
facet_fields.select { |_facet, opts| group == opts[:group] }.values.map(&:field)
|
252
|
+
end
|
253
|
+
|
248
254
|
# Add any configured facet fields to the default solr parameters hash
|
249
255
|
# @overload add_facet_fields_to_solr_request!
|
250
256
|
# add all facet fields to the solr request
|
data/lib/blacklight/engine.rb
CHANGED
@@ -39,15 +39,16 @@ module Blacklight
|
|
39
39
|
'Sprint' => 'messaging.sprintpcs.com',
|
40
40
|
'T Mobile' => 'tmomail.net',
|
41
41
|
'Alltel' => 'message.alltel.com',
|
42
|
-
'Cricket' => 'mms.mycricket.com'
|
42
|
+
'Cricket' => 'mms.mycricket.com',
|
43
|
+
'Google Fi' => 'msg.fi.google.com'
|
43
44
|
}
|
44
45
|
|
45
46
|
config.bookmarks_http_method = :post
|
46
47
|
|
47
48
|
config.email_regexp = defined?(Devise) ? Devise.email_regexp : /\A[^@\s]+@[^@\s]+\z/
|
48
49
|
|
49
|
-
config.action_dispatch.rescue_responses
|
50
|
-
|
51
|
-
|
50
|
+
config.action_dispatch.rescue_responses["Blacklight::Exceptions::RecordNotFound"] = :not_found
|
51
|
+
|
52
|
+
config.enable_search_bar_autofocus = false
|
52
53
|
end
|
53
54
|
end
|
data/lib/blacklight/solr.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module Blacklight
|
3
3
|
module Solr
|
4
|
+
autoload :Document, 'blacklight/solr/document'
|
5
|
+
autoload :FacetPaginator, 'blacklight/solr/facet_paginator'
|
4
6
|
autoload :Repository, 'blacklight/solr/repository'
|
5
7
|
autoload :Request, 'blacklight/solr/request'
|
6
8
|
autoload :Response, 'blacklight/solr/response'
|
File without changes
|
File without changes
|
@@ -39,6 +39,16 @@ class Blacklight::Solr::Response::GroupResponse
|
|
39
39
|
total.zero?
|
40
40
|
end
|
41
41
|
|
42
|
+
##
|
43
|
+
# Overridden from Blacklight::Solr::Response::PaginationMethods to support
|
44
|
+
# grouped key specific i18n keys. `key` is the field being grouped
|
45
|
+
def entry_name(options)
|
46
|
+
I18n.t(
|
47
|
+
"blacklight.entry_name.grouped.#{key}",
|
48
|
+
default: :'blacklight.entry_name.grouped.default'
|
49
|
+
).pluralize(options[:count])
|
50
|
+
end
|
51
|
+
|
42
52
|
def method_missing meth, *args, &block
|
43
53
|
if response.respond_to? meth
|
44
54
|
response.send(meth, *args, &block)
|
@@ -14,4 +14,16 @@ module Blacklight::Solr::Response::PaginationMethods
|
|
14
14
|
def total_count #:nodoc:
|
15
15
|
total
|
16
16
|
end
|
17
|
+
|
18
|
+
##
|
19
|
+
# Should return response documents size, not hash size
|
20
|
+
def size
|
21
|
+
total_count
|
22
|
+
end
|
23
|
+
|
24
|
+
##
|
25
|
+
# Meant to have the same signature as Kaminari::PaginatableArray#entry_name
|
26
|
+
def entry_name(options)
|
27
|
+
I18n.t('blacklight.entry_name.default').pluralize(options[:count])
|
28
|
+
end
|
17
29
|
end
|
@@ -16,7 +16,6 @@ module Blacklight
|
|
16
16
|
return if has_blacklight_assets?
|
17
17
|
|
18
18
|
contents = "\n//\n// Required by Blacklight\n"
|
19
|
-
contents += "//= require jquery\n"
|
20
19
|
contents += "//= require popper\n"
|
21
20
|
contents += "// Twitter Typeahead for autocomplete\n"
|
22
21
|
contents += "//= require twitter/typeahead\n"
|
@@ -32,6 +31,10 @@ module Blacklight
|
|
32
31
|
insert_into_file "app/assets/javascripts/application.js", after: marker do
|
33
32
|
contents
|
34
33
|
end
|
34
|
+
|
35
|
+
insert_into_file "app/assets/javascripts/application.js", before: '//= require rails-ujs' do
|
36
|
+
"//= require jquery3\n"
|
37
|
+
end
|
35
38
|
end
|
36
39
|
|
37
40
|
# This is not a default in Rails 5.1+
|
data/package-lock.json
CHANGED
data/package.json
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "blacklight-frontend",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.2.0",
|
4
4
|
"description": "[](https://travis-ci.org/projectblacklight/blacklight) [](http://badge.fury.io/rb/blacklight) [](https://coveralls.io/github/projectblacklight/blacklight?branch=master)",
|
5
5
|
"main": "app/assets/javascripts/blacklight",
|
6
6
|
"scripts": {
|
7
|
-
"js-compile-bundle": "shx cat app/javascript/blacklight/core.js app/javascript/blacklight/autocomplete.js app/javascript/blacklight/bookmark_toggle.js app/javascript/blacklight/
|
7
|
+
"js-compile-bundle": "shx cat app/javascript/blacklight/core.js app/javascript/blacklight/autocomplete.js app/javascript/blacklight/bookmark_toggle.js app/javascript/blacklight/button_focus.js app/javascript/blacklight/checkbox_submit.js app/javascript/blacklight/facet_load.js app/javascript/blacklight/modal.js app/javascript/blacklight/search_context.js | shx sed \"s/^(import|export).*//\" | babel --filename app/javascript/blacklight/blacklight.js > app/assets/javascripts/blacklight/blacklight.js"
|
8
8
|
},
|
9
9
|
"repository": {
|
10
10
|
"type": "git",
|
@@ -56,13 +56,34 @@ RSpec.describe "Facets" do
|
|
56
56
|
|
57
57
|
expect(page).to have_css('#facet-format', visible: false)
|
58
58
|
|
59
|
-
|
59
|
+
within('#facets .navbar') do
|
60
|
+
page.find('button.navbar-toggler').click
|
61
|
+
end
|
62
|
+
|
63
|
+
page.find('h3.facet-field-heading button', text: 'Format').click
|
60
64
|
|
61
65
|
sleep(1) # let facet animation finish and wait for it to potentially re-collapse
|
62
66
|
|
63
67
|
expect(page).to have_css('#facet-format', visible: true) # assert that it didn't re-collapse
|
64
68
|
end
|
65
69
|
|
70
|
+
describe 'heading button focus with Firefox' do
|
71
|
+
before do
|
72
|
+
Capybara.current_driver = :selenium_headless
|
73
|
+
end
|
74
|
+
|
75
|
+
after do
|
76
|
+
Capybara.current_driver = :rack_test
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'changes to the button on button click in Firefox' do
|
80
|
+
visit root_path
|
81
|
+
page.find('h3.facet-field-heading button', text: 'Format').click
|
82
|
+
focused_element_data_target = page.evaluate_script("document.activeElement")['data-target']
|
83
|
+
expect(focused_element_data_target).to eq '#facet-format'
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
66
87
|
describe '"More" links' do
|
67
88
|
it 'has default more link with sr-only text' do
|
68
89
|
visit root_path
|
@@ -169,22 +169,37 @@ RSpec.describe "Facets" do
|
|
169
169
|
it "is collapsed when not selected", js: true do
|
170
170
|
skip("Test passes locally but not on Travis.") if ENV['TRAVIS']
|
171
171
|
visit root_path
|
172
|
+
|
173
|
+
within('#facets .navbar') do
|
174
|
+
page.find('button.navbar-toggler').click
|
175
|
+
end
|
176
|
+
|
172
177
|
within(".blacklight-subject_ssim") do
|
173
178
|
expect(page).not_to have_selector(".card-body", visible: true)
|
174
179
|
end
|
175
180
|
end
|
176
|
-
it "expands when the heading is clicked", js: true do
|
181
|
+
it "expands when the heading button is clicked", js: true do
|
177
182
|
skip("Test passes locally but not on Travis.") if ENV['TRAVIS']
|
178
183
|
visit root_path
|
184
|
+
|
185
|
+
within('#facets .navbar') do
|
186
|
+
page.find('button.navbar-toggler').click
|
187
|
+
end
|
188
|
+
|
179
189
|
within(".blacklight-subject_ssim") do
|
180
190
|
expect(page).not_to have_selector(".card-body", visible: true)
|
181
|
-
find(".card-header").click
|
182
|
-
expect(page).to
|
191
|
+
find(".card-header button").click
|
192
|
+
expect(page).to have_selector(".card-body", visible: true)
|
183
193
|
end
|
184
194
|
end
|
185
|
-
it "expands when the
|
195
|
+
it "expands when the button is clicked", js: true do
|
186
196
|
skip("Test passes locally but not on Travis.") if ENV['TRAVIS']
|
187
197
|
visit root_path
|
198
|
+
|
199
|
+
within('#facets .navbar') do
|
200
|
+
page.find('button.navbar-toggler').click
|
201
|
+
end
|
202
|
+
|
188
203
|
within(".blacklight-subject_ssim") do
|
189
204
|
expect(page).not_to have_selector(".card-body", visible: true)
|
190
205
|
find(".card-header").click
|
@@ -194,8 +209,13 @@ RSpec.describe "Facets" do
|
|
194
209
|
it "keeps selected facets expanded on page load", js: true do
|
195
210
|
skip("Test passes locally but not on Travis.") if ENV['TRAVIS']
|
196
211
|
visit root_path
|
212
|
+
|
213
|
+
within('#facets .navbar') do
|
214
|
+
page.find('button.navbar-toggler').click
|
215
|
+
end
|
216
|
+
|
197
217
|
within(".blacklight-subject_ssim") do
|
198
|
-
|
218
|
+
page.find('h3.facet-field-heading', text: 'Topic').click
|
199
219
|
expect(page).to have_selector(".panel-collapse", visible: true)
|
200
220
|
end
|
201
221
|
within(".blacklight-subject_ssim") do
|
@@ -4,28 +4,28 @@ RSpec.describe Blacklight::LayoutHelperBehavior do
|
|
4
4
|
describe '#show_content_classes' do
|
5
5
|
it 'returns a string of classes' do
|
6
6
|
expect(helper.show_content_classes).to be_an String
|
7
|
-
expect(helper.show_content_classes).to eq 'col-
|
7
|
+
expect(helper.show_content_classes).to eq 'col-lg-9 show-document'
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
describe '#show_sidebar_classes' do
|
12
12
|
it 'returns a string of classes' do
|
13
13
|
expect(helper.show_sidebar_classes).to be_an String
|
14
|
-
expect(helper.show_sidebar_classes).to eq 'page-sidebar col-
|
14
|
+
expect(helper.show_sidebar_classes).to eq 'page-sidebar col-lg-3'
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
describe '#main_content_classes' do
|
19
19
|
it 'returns a string of classes' do
|
20
20
|
expect(helper.main_content_classes).to be_an String
|
21
|
-
expect(helper.main_content_classes).to eq 'col-
|
21
|
+
expect(helper.main_content_classes).to eq 'col-lg-9'
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
describe '#sidebar_classes' do
|
26
26
|
it 'returns a string of classes' do
|
27
27
|
expect(helper.sidebar_classes).to be_an String
|
28
|
-
expect(helper.sidebar_classes).to eq 'page-sidebar col-
|
28
|
+
expect(helper.sidebar_classes).to eq 'page-sidebar col-lg-3'
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -62,15 +62,6 @@ RSpec.describe CatalogHelper do
|
|
62
62
|
expect(html).to eq "<strong>1</strong> entry found"
|
63
63
|
expect(html).to be_html_safe
|
64
64
|
end
|
65
|
-
|
66
|
-
it "uses the model_name from the response" do
|
67
|
-
response = mock_response total: 1
|
68
|
-
allow(response).to receive(:model_name).and_return(double(human: 'thingy'))
|
69
|
-
|
70
|
-
html = page_entries_info(response)
|
71
|
-
expect(html).to eq "<strong>1</strong> thingy found"
|
72
|
-
expect(html).to be_html_safe
|
73
|
-
end
|
74
65
|
end
|
75
66
|
|
76
67
|
it "with a single page of results" do
|
@@ -9,7 +9,31 @@ RSpec.describe Blacklight::Icon do
|
|
9
9
|
end
|
10
10
|
it 'returns raw svg' do
|
11
11
|
expect(Capybara.string(subject.svg))
|
12
|
-
.to have_css 'svg
|
12
|
+
.to have_css 'svg[width="24"]'
|
13
|
+
end
|
14
|
+
it 'adds role="image"' do
|
15
|
+
expect(Capybara.string(subject.svg))
|
16
|
+
.to have_css 'svg[role="image"]'
|
17
|
+
end
|
18
|
+
it 'adds title' do
|
19
|
+
expect(Capybara.string(subject.svg))
|
20
|
+
.to have_css 'title[id^="bl-icon-search-"]', text: 'search icon'
|
21
|
+
end
|
22
|
+
it 'adds aria-labelled-by' do
|
23
|
+
expect(Capybara.string(subject.svg))
|
24
|
+
.to have_css 'svg[aria-labelled-by^="bl-icon-search-"]'
|
25
|
+
end
|
26
|
+
context 'when label is false' do
|
27
|
+
subject { described_class.new(:search, classes: 'awesome', aria_hidden: true, label: false) }
|
28
|
+
|
29
|
+
it 'does not add title' do
|
30
|
+
expect(Capybara.string(subject.svg))
|
31
|
+
.not_to have_css 'title', text: 'search icon'
|
32
|
+
end
|
33
|
+
it 'does not add aria-labelled-by' do
|
34
|
+
expect(Capybara.string(subject.svg))
|
35
|
+
.not_to have_css 'svg[aria-labelled-by^="bl-icon-search-"]'
|
36
|
+
end
|
13
37
|
end
|
14
38
|
end
|
15
39
|
|