blacklight 8.2.2 → 8.4.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/.env +1 -1
- data/.github/workflows/ruby.yml +60 -62
- data/.rubocop.yml +229 -21
- data/.rubocop_todo.yml +22 -55
- data/Gemfile +2 -10
- data/README.md +2 -2
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight/blacklight.esm.js +5 -1
- data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -1
- data/app/assets/javascripts/blacklight/blacklight.js +5 -1
- data/app/assets/javascripts/blacklight/blacklight.js.map +1 -1
- data/app/assets/stylesheets/blacklight/_balanced_list.scss +1 -1
- data/app/assets/stylesheets/blacklight/_bookmark.scss +30 -0
- data/app/assets/stylesheets/blacklight/_bootstrap_overrides.scss +0 -4
- data/app/assets/stylesheets/blacklight/_constraints.scss +15 -9
- data/app/assets/stylesheets/blacklight/_controls.scss +0 -1
- data/app/assets/stylesheets/blacklight/_facets.scss +33 -37
- data/app/assets/stylesheets/blacklight/_header.scss +2 -35
- data/app/assets/stylesheets/blacklight/_icons.scss +3 -2
- data/app/assets/stylesheets/blacklight/_layout.scss +3 -0
- data/app/assets/stylesheets/blacklight/_mixins.scss +6 -21
- data/app/assets/stylesheets/blacklight/_search_form.scss +3 -8
- data/app/assets/stylesheets/blacklight/_search_history.scss +5 -5
- data/app/assets/stylesheets/blacklight/_search_results.scss +5 -2
- data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +16 -10
- data/app/components/blacklight/advanced_search_form_component.html.erb +1 -1
- data/app/components/blacklight/advanced_search_form_component.rb +6 -0
- data/app/components/blacklight/constraint_layout_component.html.erb +2 -9
- data/app/components/blacklight/constraint_layout_component.rb +8 -0
- data/app/components/blacklight/constraints_component.rb +3 -3
- data/app/components/blacklight/document/action_component.rb +2 -1
- data/app/components/blacklight/document/bookmark_component.html.erb +2 -1
- data/app/components/blacklight/document/bookmark_component.rb +6 -0
- data/app/components/blacklight/document/page_header_component.html.erb +7 -0
- data/app/components/blacklight/document/page_header_component.rb +85 -0
- data/app/components/blacklight/document_component.rb +1 -1
- data/app/components/blacklight/facet_component.rb +1 -1
- data/app/components/blacklight/facet_field_checkboxes_component.html.erb +1 -1
- data/app/components/blacklight/facet_field_checkboxes_component.rb +1 -1
- data/app/components/blacklight/facet_field_inclusive_constraint_component.html.erb +1 -1
- data/app/components/blacklight/facet_field_list_component.html.erb +1 -1
- data/app/components/blacklight/facet_item_component.rb +1 -1
- data/app/components/blacklight/facet_item_pivot_component.rb +2 -2
- data/app/components/blacklight/icons/bookmark_icon_component.rb +17 -0
- data/app/components/blacklight/icons/icon_component.rb +9 -4
- data/app/components/blacklight/icons/remove_component.rb +16 -0
- data/app/components/blacklight/metadata_field_component.html.erb +1 -1
- data/app/components/blacklight/metadata_field_component.rb +5 -0
- data/app/components/blacklight/response/facet_group_component.rb +1 -1
- data/app/components/blacklight/response/pagination_component.html.erb +1 -1
- data/app/components/blacklight/response/sort_component.html.erb +1 -6
- data/app/components/blacklight/response/sort_component.rb +15 -0
- data/app/components/blacklight/search/per_page_component.html.erb +2 -0
- data/app/components/blacklight/search/per_page_component.rb +50 -0
- data/app/components/blacklight/search_bar_component.html.erb +1 -1
- data/app/components/blacklight/search_context/server_item_pagination_component.html.erb +4 -7
- data/app/components/blacklight/skip_link_component.html.erb +7 -0
- data/app/components/blacklight/skip_link_component.rb +17 -0
- data/app/components/blacklight/system/dropdown_button_component.rb +18 -0
- data/app/components/blacklight/system/dropdown_component.rb +4 -7
- data/app/components/blacklight/system/flash_message_component.html.erb +1 -1
- data/app/components/blacklight/top_navbar_component.html.erb +2 -2
- data/app/components/blacklight/top_navbar_component.rb +4 -0
- data/app/helpers/blacklight/catalog_helper_behavior.rb +3 -5
- data/app/helpers/blacklight/component_helper_behavior.rb +4 -4
- data/app/helpers/blacklight/configuration_helper_behavior.rb +2 -0
- data/app/helpers/blacklight/layout_helper_behavior.rb +3 -3
- data/app/javascript/blacklight/checkbox_submit.js +5 -1
- data/app/models/concerns/blacklight/document/semantic_fields.rb +1 -1
- data/app/presenters/blacklight/facet_checkbox_item_presenter.rb +11 -0
- data/app/presenters/blacklight/facet_field_presenter.rb +9 -1
- data/app/services/blacklight/search_service.rb +9 -1
- data/app/views/catalog/_per_page_widget.html.erb +1 -10
- data/app/views/catalog/_search_results.html.erb +1 -1
- data/app/views/catalog/_show_main_content.html.erb +1 -1
- data/app/views/catalog/show.html.erb +0 -2
- data/app/views/catalog/suggest.html.erb +1 -1
- data/app/views/kaminari/blacklight/_page.html.erb +14 -8
- data/app/views/layouts/blacklight/base.html.erb +3 -4
- data/app/views/shared/_flash_messages.html.erb +1 -1
- data/blacklight.gemspec +4 -0
- data/{docker-compose.yml → compose.yaml} +1 -1
- data/config/locales/blacklight.ar.yml +3 -0
- data/config/locales/blacklight.de.yml +3 -0
- data/config/locales/blacklight.en.yml +216 -229
- data/config/locales/blacklight.es.yml +3 -0
- data/config/locales/blacklight.fr.yml +3 -0
- data/config/locales/blacklight.hu.yml +3 -0
- data/config/locales/blacklight.it.yml +3 -0
- data/config/locales/blacklight.nl.yml +3 -0
- data/config/locales/blacklight.pt-BR.yml +3 -0
- data/config/locales/blacklight.sq.yml +3 -0
- data/config/locales/blacklight.zh.yml +3 -0
- data/lib/blacklight/abstract_repository.rb +6 -0
- data/lib/blacklight/configuration.rb +33 -19
- data/lib/blacklight/nested_open_struct_with_hash_access.rb +2 -2
- data/lib/blacklight/parameters.rb +1 -1
- data/lib/blacklight/solr/repository.rb +11 -4
- data/lib/blacklight/solr/request.rb +1 -1
- data/lib/blacklight/solr/response/facets.rb +1 -1
- data/lib/blacklight/solr/response/params.rb +1 -1
- data/lib/blacklight/solr/response.rb +0 -12
- data/lib/blacklight/solr/search_builder_behavior.rb +2 -2
- data/lib/blacklight/solr.rb +0 -6
- data/lib/blacklight.rb +4 -14
- data/lib/generators/blacklight/assets/propshaft_generator.rb +2 -2
- data/lib/generators/blacklight/models_generator.rb +1 -1
- data/package.json +1 -1
- data/spec/components/blacklight/advanced_search_form_component_spec.rb +2 -2
- data/spec/components/blacklight/constraint_layout_component_spec.rb +11 -11
- data/spec/components/blacklight/constraints_component_spec.rb +9 -9
- data/spec/components/blacklight/document/action_component_spec.rb +1 -1
- data/spec/components/blacklight/document/group_component_spec.rb +3 -3
- data/spec/components/blacklight/document/page_header_component_spec.rb +92 -0
- data/spec/components/blacklight/document/sidebar_component_spec.rb +3 -4
- data/spec/components/blacklight/document_component_spec.rb +41 -25
- data/spec/components/blacklight/facet_component_spec.rb +2 -2
- data/spec/components/blacklight/facet_field_checkboxes_component_spec.rb +5 -5
- data/spec/components/blacklight/facet_field_list_component_spec.rb +13 -13
- data/spec/components/blacklight/facet_item_component_spec.rb +5 -5
- data/spec/components/blacklight/facet_item_pivot_component_spec.rb +6 -6
- data/spec/components/blacklight/header_component_spec.rb +1 -2
- data/spec/components/blacklight/hidden_search_state_component_spec.rb +6 -6
- data/spec/components/blacklight/icons/icon_component_spec.rb +42 -0
- data/spec/components/blacklight/metadata_field_component_spec.rb +3 -3
- data/spec/components/blacklight/response/pagination_component_spec.rb +4 -4
- data/spec/components/blacklight/search_context/server_applied_params_component_spec.rb +1 -1
- data/spec/components/blacklight/search_context/server_item_pagination_component_spec.rb +2 -4
- data/spec/components/blacklight/system/flash_message_component_spec.rb +5 -5
- data/spec/controllers/blacklight/catalog_spec.rb +2 -2
- data/spec/controllers/blacklight/{catalog/component_configuration_spec.rb → configurable_spec.rb} +1 -1
- data/spec/controllers/bookmarks_controller_spec.rb +10 -10
- data/spec/controllers/catalog_controller_spec.rb +29 -31
- data/spec/features/advanced_search_spec.rb +30 -16
- data/spec/features/alternate_controller_spec.rb +9 -9
- data/spec/features/axe_spec.rb +4 -4
- data/spec/features/bookmarks_spec.rb +34 -19
- data/spec/features/citation_spec.rb +1 -1
- data/spec/features/did_you_mean_spec.rb +23 -23
- data/spec/features/facet_missing_spec.rb +9 -9
- data/spec/features/facets_spec.rb +21 -20
- data/spec/features/modal_spec.rb +4 -4
- data/spec/features/record_view_spec.rb +2 -2
- data/spec/features/search_context_spec.rb +6 -6
- data/spec/features/search_crawler_spec.rb +5 -5
- data/spec/features/search_filters_spec.rb +65 -65
- data/spec/features/search_history_spec.rb +12 -12
- data/spec/features/search_pagination_spec.rb +10 -10
- data/spec/features/search_results_spec.rb +1 -1
- data/spec/features/search_sort_spec.rb +4 -4
- data/spec/features/search_spec.rb +25 -25
- data/spec/features/sitelinks_search_box_spec.rb +2 -2
- data/spec/features/sms_spec.rb +1 -1
- data/spec/helpers/blacklight/facets_helper_behavior_spec.rb +2 -2
- data/spec/helpers/blacklight/layout_helper_behavior_spec.rb +20 -3
- data/spec/helpers/blacklight/render_partials_helper_behavior_spec.rb +2 -1
- data/spec/helpers/blacklight/url_helper_behavior_spec.rb +7 -8
- data/spec/helpers/blacklight_helper_spec.rb +13 -15
- data/spec/helpers/catalog_helper_spec.rb +3 -6
- data/spec/i18n_spec.rb +2 -1
- data/spec/lib/blacklight/nested_open_struct_with_hash_access_spec.rb +1 -1
- data/spec/lib/blacklight/open_struct_with_hash_access_spec.rb +1 -1
- data/spec/lib/blacklight/search_state_spec.rb +4 -4
- data/spec/lib/tasks/blacklight_task_spec.rb +2 -1
- data/spec/models/blacklight/configurable_spec.rb +1 -1
- data/spec/models/blacklight/configuration/context_spec.rb +1 -1
- data/spec/models/blacklight/configuration_spec.rb +14 -14
- data/spec/models/blacklight/document/active_model_shim_spec.rb +1 -1
- data/spec/models/blacklight/document/cache_key_spec.rb +1 -1
- data/spec/models/blacklight/document_spec.rb +1 -1
- data/spec/models/blacklight/facet_paginator_spec.rb +14 -14
- data/spec/models/blacklight/icon_spec.rb +1 -1
- data/spec/models/blacklight/search_builder_spec.rb +1 -1
- data/spec/models/blacklight/solr/document_spec.rb +3 -3
- data/spec/models/blacklight/solr/facet_paginator_spec.rb +1 -1
- data/spec/models/blacklight/solr/repository_spec.rb +33 -15
- data/spec/models/blacklight/solr/request_spec.rb +1 -1
- data/spec/models/blacklight/solr/response/facets_spec.rb +3 -3
- data/spec/models/blacklight/solr/response/group_response_spec.rb +1 -1
- data/spec/models/blacklight/solr/response/group_spec.rb +2 -2
- data/spec/models/blacklight/solr/response_spec.rb +3 -3
- data/spec/models/blacklight/solr/{search_builder_spec.rb → search_builder_behavior_spec.rb} +10 -20
- data/spec/models/blacklight/suggest/response_spec.rb +1 -1
- data/spec/models/blacklight/suggest_search_spec.rb +1 -1
- data/spec/models/blacklight/user_spec.rb +1 -1
- data/spec/models/bookmark_spec.rb +1 -1
- data/spec/models/solr_document_spec.rb +1 -1
- data/spec/presenters/blacklight/document_presenter_spec.rb +3 -4
- data/spec/presenters/blacklight/facet_checkbox_item_presenter_spec.rb +42 -0
- data/spec/presenters/blacklight/facet_field_presenter_spec.rb +14 -0
- data/spec/presenters/blacklight/field_presenter_spec.rb +1 -1
- data/spec/presenters/blacklight/index_presenter_spec.rb +2 -3
- data/spec/presenters/blacklight/json_presenter_spec.rb +1 -1
- data/spec/presenters/{pipeline_spec.rb → blacklight/rendering/pipeline_spec.rb} +1 -1
- data/spec/presenters/blacklight/show_presenter_spec.rb +5 -6
- data/spec/presenters/{thumbnail_presenter_spec.rb → blacklight/thumbnail_presenter_spec.rb} +5 -3
- data/spec/requests/load_suggestions_spec.rb +5 -5
- data/spec/routing/catalog_routing_spec.rb +1 -1
- data/spec/services/blacklight/field_retriever_spec.rb +1 -1
- data/spec/services/blacklight/search_service_spec.rb +11 -11
- data/spec/spec_helper.rb +2 -2
- data/spec/support/features/search_helpers.rb +2 -2
- data/spec/support/features/session_helpers.rb +3 -3
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +3 -3
- data/spec/views/catalog/_document.html.erb_spec.rb +1 -4
- data/spec/views/catalog/_document_list.html.erb_spec.rb +2 -2
- data/spec/views/catalog/_facet_index_navigation.html.erb_spec.rb +5 -6
- data/spec/views/catalog/_facet_layout.html.erb_spec.rb +7 -7
- data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +4 -4
- data/spec/views/catalog/_show_sidebar.erb_spec.rb +1 -4
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +1 -2
- data/spec/views/catalog/_view_type_group.html.erb_spec.rb +7 -7
- data/spec/views/catalog/email_success.html.erb_spec.rb +1 -1
- data/spec/views/catalog/facet.html.erb_spec.rb +1 -1
- data/spec/views/catalog/facet.json.jbuilder_spec.rb +1 -1
- data/spec/views/catalog/index.atom.builder_spec.rb +18 -19
- data/spec/views/catalog/index.html.erb_spec.rb +2 -4
- data/spec/views/catalog/index.json.jbuilder_spec.rb +5 -8
- data/spec/views/catalog/show.html.erb_spec.rb +3 -5
- data/spec/views/catalog/show.json.jbuilder_spec.rb +1 -2
- data/spec/views/catalog/sms_success.html.erb_spec.rb +1 -1
- data/spec/views/shared/_user_util_links.html.erb_spec.rb +2 -3
- data/tasks/blacklight.rake +5 -5
- metadata +84 -12
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
RSpec.describe CatalogController, api
|
3
|
+
RSpec.describe CatalogController, :api do
|
4
4
|
let(:doc_id) { '2007020969' }
|
5
5
|
let(:mock_document) { instance_double(SolrDocument, export_formats: {}) }
|
6
6
|
let(:search_service) { instance_double(Blacklight::SearchService) }
|
@@ -24,26 +24,26 @@ RSpec.describe CatalogController, api: true do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
# check each user manipulated parameter
|
27
|
-
it "has docs and facets for query with results", integration
|
27
|
+
it "has docs and facets for query with results", :integration do
|
28
28
|
get :index, params: { q: user_query }
|
29
29
|
expect(assigns(:response).docs).not_to be_empty
|
30
30
|
assert_facets_have_values(assigns(:response).aggregations)
|
31
31
|
end
|
32
32
|
|
33
|
-
it "has docs and facets for existing facet value", integration
|
33
|
+
it "has docs and facets for existing facet value", :integration do
|
34
34
|
get :index, params: { f: { "format" => 'Book' } }
|
35
35
|
expect(assigns(:response).docs).not_to be_empty
|
36
36
|
assert_facets_have_values(assigns(:response).aggregations)
|
37
37
|
end
|
38
38
|
|
39
|
-
it "has docs and facets for non-default results per page", integration
|
39
|
+
it "has docs and facets for non-default results per page", :integration do
|
40
40
|
num_per_page = 7
|
41
41
|
get :index, params: { per_page: num_per_page }
|
42
42
|
expect(assigns(:response).docs).to have(num_per_page).items
|
43
43
|
assert_facets_have_values(assigns(:response).aggregations)
|
44
44
|
end
|
45
45
|
|
46
|
-
it "has docs and facets for second page", integration
|
46
|
+
it "has docs and facets for second page", :integration do
|
47
47
|
page = 2
|
48
48
|
get :index, params: { page: page }
|
49
49
|
expect(assigns(:response).docs).not_to be_empty
|
@@ -51,7 +51,7 @@ RSpec.describe CatalogController, api: true do
|
|
51
51
|
assert_facets_have_values(assigns(:response).aggregations)
|
52
52
|
end
|
53
53
|
|
54
|
-
it "has no docs or facet values for query without results", integration
|
54
|
+
it "has no docs or facet values for query without results", :integration do
|
55
55
|
get :index, params: { q: 'sadfdsafasdfsadfsadfsadf' } # query for no results
|
56
56
|
expect(assigns(:response).docs).to be_empty
|
57
57
|
assigns(:response).aggregations.each_value do |facet|
|
@@ -59,12 +59,12 @@ RSpec.describe CatalogController, api: true do
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
it "shows 0 results when the user asks for an invalid value to a custom facet query", integration
|
62
|
+
it "shows 0 results when the user asks for an invalid value to a custom facet query", :integration do
|
63
63
|
get :index, params: { f: { example_query_facet_field: ['bogus'] } } # bogus custom facet value
|
64
64
|
expect(assigns(:response).docs).to be_empty
|
65
65
|
end
|
66
66
|
|
67
|
-
it "returns results (possibly 0) when the user asks for a valid value to a custom facet query", integration
|
67
|
+
it "returns results (possibly 0) when the user asks for a valid value to a custom facet query", :integration do
|
68
68
|
get :index, params: { f: { example_query_facet_field: ['years_25'] } } # valid custom facet value with some results
|
69
69
|
expect(assigns(:response).docs).not_to be_empty
|
70
70
|
end
|
@@ -74,7 +74,7 @@ RSpec.describe CatalogController, api: true do
|
|
74
74
|
expect(assigns(:response).docs).to be_empty
|
75
75
|
end
|
76
76
|
|
77
|
-
it "has a spelling suggestion for an appropriately poor query", integration
|
77
|
+
it "has a spelling suggestion for an appropriately poor query", :integration do
|
78
78
|
get :index, params: { q: 'boo' }
|
79
79
|
expect(assigns(:response).spelling.words).not_to be_nil
|
80
80
|
end
|
@@ -95,12 +95,12 @@ RSpec.describe CatalogController, api: true do
|
|
95
95
|
|
96
96
|
# check with no user manipulation
|
97
97
|
describe "for default query" do
|
98
|
-
it "gets documents when no query", integration
|
98
|
+
it "gets documents when no query", :integration do
|
99
99
|
get :index
|
100
100
|
expect(assigns(:response).docs).not_to be_empty
|
101
101
|
end
|
102
102
|
|
103
|
-
it "gets facets when no query", integration
|
103
|
+
it "gets facets when no query", :integration do
|
104
104
|
get :index
|
105
105
|
assert_facets_have_values(assigns(:response).aggregations)
|
106
106
|
end
|
@@ -113,14 +113,14 @@ RSpec.describe CatalogController, api: true do
|
|
113
113
|
end
|
114
114
|
|
115
115
|
# NOTE: status code is always 200 in isolation mode ...
|
116
|
-
it "HTTP status code for GET should be 200", integration
|
116
|
+
it "HTTP status code for GET should be 200", :integration do
|
117
117
|
get :index
|
118
118
|
expect(response).to be_successful
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
122
|
describe "with format :rss" do
|
123
|
-
it "gets the feed", integration
|
123
|
+
it "gets the feed", :integration do
|
124
124
|
get :index, params: { format: 'rss' }
|
125
125
|
expect(response).to be_successful
|
126
126
|
end
|
@@ -133,7 +133,7 @@ RSpec.describe CatalogController, api: true do
|
|
133
133
|
expect(response).to be_successful
|
134
134
|
end
|
135
135
|
|
136
|
-
let(:json) {
|
136
|
+
let(:json) { response.parsed_body }
|
137
137
|
let(:pages) { json['meta']['pages'] }
|
138
138
|
let(:docs) { json['data'] }
|
139
139
|
let(:facets) { json['included'].select { |x| x['type'] == 'facet' } }
|
@@ -251,7 +251,7 @@ RSpec.describe CatalogController, api: true do
|
|
251
251
|
|
252
252
|
it "HTTP status code for redirect should be 303" do
|
253
253
|
put :track, params: { id: doc_id, counter: 3 }
|
254
|
-
expect(response
|
254
|
+
expect(response).to have_http_status :see_other
|
255
255
|
end
|
256
256
|
|
257
257
|
it "redirects to the path given in the redirect param" do
|
@@ -285,7 +285,7 @@ RSpec.describe CatalogController, api: true do
|
|
285
285
|
it "gets the raw solr document" do
|
286
286
|
get :raw, params: { id: doc_id, format: 'json' }
|
287
287
|
expect(response).to be_successful
|
288
|
-
json =
|
288
|
+
json = response.parsed_body
|
289
289
|
expect(json.keys).to match_array(
|
290
290
|
%w[id _version_ author_addl_tsim author_tsim format isbn_ssim
|
291
291
|
language_ssim lc_1letter_ssim lc_alpha_ssim lc_b4cutter_ssim
|
@@ -310,7 +310,7 @@ RSpec.describe CatalogController, api: true do
|
|
310
310
|
# SHOW ACTION
|
311
311
|
describe "show action" do
|
312
312
|
describe "with format :html" do
|
313
|
-
it "gets document", integration
|
313
|
+
it "gets document", :integration do
|
314
314
|
get :show, params: { id: doc_id }
|
315
315
|
expect(assigns[:document]).not_to be_nil
|
316
316
|
end
|
@@ -321,7 +321,7 @@ RSpec.describe CatalogController, api: true do
|
|
321
321
|
it "gets the feed" do
|
322
322
|
get :show, params: { id: doc_id, format: 'json' }
|
323
323
|
expect(response).to be_successful
|
324
|
-
json =
|
324
|
+
json = response.parsed_body
|
325
325
|
expect(json["data"]["attributes"].keys).to match_array(
|
326
326
|
%w[author_tsim format isbn_ssim language_ssim lc_callnum_ssim
|
327
327
|
published_ssim subtitle_tsim title title_tsim url_suppl_ssim]
|
@@ -335,9 +335,8 @@ RSpec.describe CatalogController, api: true do
|
|
335
335
|
|
336
336
|
before do
|
337
337
|
allow(mock_document).to receive_messages(export_formats: {})
|
338
|
-
allow(controller).to receive(:search_service).and_return(search_service)
|
339
338
|
expect(search_service).to receive(:fetch).and_return(mock_document)
|
340
|
-
allow(controller).to
|
339
|
+
allow(controller).to receive_messages(search_service: search_service, current_search_session: current_search)
|
341
340
|
end
|
342
341
|
|
343
342
|
context 'if counter is present in session' do
|
@@ -389,7 +388,7 @@ RSpec.describe CatalogController, api: true do
|
|
389
388
|
end
|
390
389
|
|
391
390
|
# NOTE: status code is always 200 in isolation mode ...
|
392
|
-
it "HTTP status code for GET should be 200", integration
|
391
|
+
it "HTTP status code for GET should be 200", :integration do
|
393
392
|
get :show, params: { id: doc_id }
|
394
393
|
expect(response).to be_successful
|
395
394
|
end
|
@@ -612,10 +611,10 @@ RSpec.describe CatalogController, api: true do
|
|
612
611
|
it "is successful" do
|
613
612
|
get :facet, params: { id: 'format' }
|
614
613
|
expect(response).to be_successful
|
615
|
-
expect(assigns[:response]).to
|
616
|
-
expect(assigns[:facet]).to
|
617
|
-
expect(assigns[:display_facet]).to
|
618
|
-
expect(assigns[:pagination]).to
|
614
|
+
expect(assigns[:response]).to be_a Blacklight::Solr::Response
|
615
|
+
expect(assigns[:facet]).to be_a Blacklight::Configuration::FacetField
|
616
|
+
expect(assigns[:display_facet]).to be_a Blacklight::Solr::Response::Facets::FacetField
|
617
|
+
expect(assigns[:pagination]).to be_a Blacklight::Solr::FacetPaginator
|
619
618
|
end
|
620
619
|
end
|
621
620
|
|
@@ -624,7 +623,7 @@ RSpec.describe CatalogController, api: true do
|
|
624
623
|
it "is successful" do
|
625
624
|
get :facet, params: { id: 'format', format: 'json' }
|
626
625
|
expect(response).to be_successful
|
627
|
-
json =
|
626
|
+
json = response.parsed_body
|
628
627
|
expect(json["response"]["facets"]["items"].first["value"]).to eq 'Book'
|
629
628
|
end
|
630
629
|
end
|
@@ -639,7 +638,7 @@ RSpec.describe CatalogController, api: true do
|
|
639
638
|
|
640
639
|
expect(response).to be_successful
|
641
640
|
|
642
|
-
expect(assigns[:facet]).to
|
641
|
+
expect(assigns[:facet]).to be_a Blacklight::Configuration::FacetField
|
643
642
|
expect(assigns[:facet].key).to eq 'params_key'
|
644
643
|
expect(assigns[:facet].field).to eq 'format'
|
645
644
|
|
@@ -741,8 +740,7 @@ RSpec.describe CatalogController, api: true do
|
|
741
740
|
describe "#add_show_tools_partial", api: false do
|
742
741
|
before do
|
743
742
|
described_class.blacklight_config.add_show_tools_partial(:like, callback: :perform_like, validator: :validate_like_params)
|
744
|
-
allow(controller).to
|
745
|
-
allow(controller).to receive(:action_documents).and_return(1)
|
743
|
+
allow(controller).to receive_messages(solr_document_url: 'http://test.host/catalog/1', action_documents: 1)
|
746
744
|
Rails.application.routes.draw do
|
747
745
|
get 'catalog/like', as: :catalog_like
|
748
746
|
end
|
@@ -796,7 +794,7 @@ RSpec.describe CatalogController, api: true do
|
|
796
794
|
end
|
797
795
|
|
798
796
|
describe "page_links" do
|
799
|
-
it "has prev/next docs and result set data for non-empty result sets", integration
|
797
|
+
it "has prev/next docs and result set data for non-empty result sets", :integration do
|
800
798
|
get :page_links, params: { f: { "format" => 'Book' }, counter: 2 }
|
801
799
|
expect(assigns(:page_link_data)).not_to be_empty
|
802
800
|
expect(assigns(:page_link_data).fetch(:prev, nil)).to end_with('counter=1')
|
@@ -804,7 +802,7 @@ RSpec.describe CatalogController, api: true do
|
|
804
802
|
expect(assigns(:page_link_data).fetch(:totalRaw, nil)).to be 30
|
805
803
|
end
|
806
804
|
|
807
|
-
it "is empty for empty result sets", integration
|
805
|
+
it "is empty for empty result sets", :integration do
|
808
806
|
get :page_links, params: { f: { "format" => 'empty-result-set' }, counter: 1 }
|
809
807
|
expect(assigns(:page_link_data)).to be_empty
|
810
808
|
end
|
@@ -27,16 +27,16 @@ RSpec.describe "Blacklight Advanced Search Form" do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it "has field and facet blocks" do
|
30
|
-
expect(page).to
|
31
|
-
expect(page).to
|
30
|
+
expect(page).to have_css('.query-criteria')
|
31
|
+
expect(page).to have_css('.limit-criteria')
|
32
32
|
end
|
33
33
|
|
34
34
|
describe "query column" do
|
35
35
|
it "gives the user a choice between and/or queries" do
|
36
|
-
expect(page).to
|
36
|
+
expect(page).to have_css('#op')
|
37
37
|
within('#op') do
|
38
|
-
expect(page).to
|
39
|
-
expect(page).to
|
38
|
+
expect(page).to have_css('option[value="must"]')
|
39
|
+
expect(page).to have_css('option[value="should"]')
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -50,7 +50,7 @@ RSpec.describe "Blacklight Advanced Search Form" do
|
|
50
50
|
|
51
51
|
describe "facet column" do
|
52
52
|
it "lists facets" do
|
53
|
-
expect(page).to
|
53
|
+
expect(page).to have_css('.blacklight-language_ssim')
|
54
54
|
|
55
55
|
within('.blacklight-language_ssim') do
|
56
56
|
expect(page).to have_content 'Language'
|
@@ -63,7 +63,7 @@ RSpec.describe "Blacklight Advanced Search Form" do
|
|
63
63
|
click_on 'advanced-search-submit'
|
64
64
|
expect(page).to have_content 'Remove constraint Title: Medicine'
|
65
65
|
expect(page).to have_content 'Strong Medicine speaks'
|
66
|
-
expect(page).to
|
66
|
+
expect(page).to have_css('article.document', count: 1)
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'can limit to facets' do
|
@@ -72,16 +72,16 @@ RSpec.describe "Blacklight Advanced Search Form" do
|
|
72
72
|
check 'Urdu 3'
|
73
73
|
click_on 'advanced-search-submit'
|
74
74
|
expect(page).to have_content 'Pākistānī ʻaurat dorāhe par'
|
75
|
-
expect(page).
|
76
|
-
expect(page).to
|
75
|
+
expect(page).to have_no_content 'Ajikto kŭrŏk chŏrŏk sasimnikka : and 아직도 그럭 저럭 사십니까'
|
76
|
+
expect(page).to have_css('article.document', count: 1)
|
77
77
|
end
|
78
78
|
|
79
79
|
it 'handles boolean queries' do
|
80
80
|
fill_in 'All Fields', with: 'history NOT strong'
|
81
81
|
click_on 'advanced-search-submit'
|
82
82
|
expect(page).to have_content('Ci an zhou bian')
|
83
|
-
expect(page).
|
84
|
-
expect(page).to
|
83
|
+
expect(page).to have_no_content('Strong Medicine speaks')
|
84
|
+
expect(page).to have_css('article.document', count: 10)
|
85
85
|
end
|
86
86
|
|
87
87
|
it 'handles queries in multiple fields with the ALL operator' do
|
@@ -89,7 +89,7 @@ RSpec.describe "Blacklight Advanced Search Form" do
|
|
89
89
|
fill_in 'Author', with: 'hearth'
|
90
90
|
click_on 'advanced-search-submit'
|
91
91
|
expect(page).to have_content('Strong Medicine speaks')
|
92
|
-
expect(page).to
|
92
|
+
expect(page).to have_css('article.document', count: 1)
|
93
93
|
end
|
94
94
|
|
95
95
|
it 'handles queries in multiple fields with the ANY operator' do
|
@@ -99,17 +99,29 @@ RSpec.describe "Blacklight Advanced Search Form" do
|
|
99
99
|
click_on 'advanced-search-submit'
|
100
100
|
expect(page).to have_content('Ci an zhou bian')
|
101
101
|
expect(page).to have_content('Pākistānī ʻaurat dorāhe par')
|
102
|
-
expect(page).to
|
102
|
+
expect(page).to have_css('article.document', count: 10)
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
106
|
describe "prepopulated advanced search form" do
|
107
107
|
before do
|
108
|
-
visit '/catalog/advanced?op=must&clause[
|
108
|
+
visit '/catalog/advanced?op=must&clause[1][field]=title&clause[1]query=medicine&f_inclusive[language_ssim][]=Tibetan&sort=author'
|
109
109
|
end
|
110
110
|
|
111
|
-
it
|
111
|
+
it 'prepopulates the expected fields' do
|
112
112
|
expect(page).to have_field 'Title', with: 'medicine'
|
113
|
+
expect(page).to have_field 'Tibetan', checked: true
|
114
|
+
expect(page).to have_select 'op', selected: 'all'
|
115
|
+
expect(page).to have_select 'sort', selected: 'author'
|
116
|
+
end
|
117
|
+
|
118
|
+
it "does not create hidden inputs for fields included in adv search form" do
|
119
|
+
within('form.advanced') do
|
120
|
+
expect(page).to have_no_field('clause[1][query]', type: :hidden, with: 'medicine')
|
121
|
+
expect(page).to have_no_field('f_inclusive[language_ssim][]', type: :hidden, with: 'Tibetan')
|
122
|
+
expect(page).to have_no_field('op', type: :hidden, with: 'must')
|
123
|
+
expect(page).to have_no_field('sort', type: :hidden, with: 'author')
|
124
|
+
end
|
113
125
|
end
|
114
126
|
|
115
127
|
it "does not have multiple parameters for a search field" do
|
@@ -121,8 +133,10 @@ RSpec.describe "Blacklight Advanced Search Form" do
|
|
121
133
|
|
122
134
|
it "clears the prepopulated fields when the Start Over button is pressed" do
|
123
135
|
expect(page).to have_field 'Title', with: 'medicine'
|
136
|
+
expect(page).to have_field 'Tibetan', checked: true
|
124
137
|
click_on 'Start over'
|
125
|
-
expect(page).
|
138
|
+
expect(page).to have_no_field 'Title', with: 'medicine'
|
139
|
+
expect(page).to have_no_field 'Tibetan', checked: true
|
126
140
|
end
|
127
141
|
end
|
128
142
|
end
|
@@ -3,9 +3,9 @@
|
|
3
3
|
RSpec.describe "Alternate Controller Behaviors" do
|
4
4
|
it "has the correct per-page form" do
|
5
5
|
visit search_alternate_path
|
6
|
-
expect(page).to
|
6
|
+
expect(page).to have_css("form[action='#{search_alternate_url}']")
|
7
7
|
fill_in "q", with: "history"
|
8
|
-
|
8
|
+
click_on 'search'
|
9
9
|
expect(current_path).to match /#{search_alternate_path}/
|
10
10
|
within "#per_page-dropdown .dropdown-menu" do
|
11
11
|
click_on '10 per page'
|
@@ -15,9 +15,9 @@ RSpec.describe "Alternate Controller Behaviors" do
|
|
15
15
|
|
16
16
|
it "has the correct search field form" do
|
17
17
|
visit search_alternate_path
|
18
|
-
expect(page).to
|
18
|
+
expect(page).to have_css("form[action='#{search_alternate_url}']")
|
19
19
|
fill_in "q", with: "history"
|
20
|
-
|
20
|
+
click_on 'search'
|
21
21
|
expect(current_path).to match /#{search_alternate_path}/
|
22
22
|
click_on 'relevance'
|
23
23
|
expect(current_path).to match /#{search_alternate_path}/
|
@@ -25,11 +25,11 @@ RSpec.describe "Alternate Controller Behaviors" do
|
|
25
25
|
|
26
26
|
it "displays document thumbnails" do
|
27
27
|
visit search_alternate_path
|
28
|
-
expect(page).to
|
28
|
+
expect(page).to have_css("form[action='#{search_alternate_url}']")
|
29
29
|
fill_in "q", with: "history"
|
30
|
-
|
31
|
-
expect(page).to
|
32
|
-
expect(page).to
|
33
|
-
expect(page).to
|
30
|
+
click_on 'search'
|
31
|
+
expect(page).to have_css ".document-thumbnail"
|
32
|
+
expect(page).to have_css ".document-thumbnail a[data-context-href]"
|
33
|
+
expect(page).to have_css ".document-thumbnail a img"
|
34
34
|
end
|
35
35
|
end
|
data/spec/features/axe_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
RSpec.describe 'Accessibility testing',
|
3
|
+
RSpec.describe 'Accessibility testing', :js, api: false do
|
4
4
|
it 'validates the home page' do
|
5
5
|
visit root_path
|
6
6
|
expect(page).to be_accessible
|
@@ -9,13 +9,13 @@ RSpec.describe 'Accessibility testing', api: false, js: true do
|
|
9
9
|
it 'validates the catalog page' do
|
10
10
|
visit root_path
|
11
11
|
fill_in "q", with: 'history'
|
12
|
-
|
12
|
+
click_on 'search'
|
13
13
|
|
14
14
|
expect(page).to be_accessible
|
15
15
|
|
16
16
|
within '.card.blacklight-language_ssim' do
|
17
|
-
|
18
|
-
|
17
|
+
click_on 'Language'
|
18
|
+
click_on "Tibetan"
|
19
19
|
end
|
20
20
|
|
21
21
|
expect(page).to be_accessible
|
@@ -5,16 +5,16 @@ RSpec.describe "Bookmarks" do
|
|
5
5
|
it "has a link to the history page" do
|
6
6
|
sign_in 'user1'
|
7
7
|
visit root_path
|
8
|
-
|
8
|
+
click_on 'Bookmarks'
|
9
9
|
expect(page).to have_content 'You have no bookmarks'
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
it "clears bookmarks" do
|
14
14
|
visit solr_document_path('2007020969')
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
click_on 'Bookmark'
|
16
|
+
click_on 'Bookmarks'
|
17
|
+
click_on 'Clear Bookmarks'
|
18
18
|
expect(page).to have_content 'Cleared your bookmarks.'
|
19
19
|
expect(page).to have_content 'You have no bookmarks'
|
20
20
|
end
|
@@ -23,24 +23,24 @@ RSpec.describe "Bookmarks" do
|
|
23
23
|
sign_in 'user1'
|
24
24
|
visit root_path
|
25
25
|
fill_in "q", with: 'Sumadhvavijayaḥ'
|
26
|
-
|
27
|
-
|
26
|
+
click_on 'search'
|
27
|
+
click_on 'Bookmark'
|
28
28
|
expect(page).to have_content 'Successfully added bookmark.'
|
29
29
|
fill_in "q", with: 'Sumadhvavijayaḥ'
|
30
|
-
|
31
|
-
|
30
|
+
click_on 'search'
|
31
|
+
click_on 'Remove bookmark'
|
32
32
|
expect(page).to have_content 'Successfully removed bookmark.'
|
33
33
|
end
|
34
34
|
|
35
35
|
it "adds and delete bookmarks from the show page" do
|
36
36
|
sign_in 'user1'
|
37
37
|
visit solr_document_path('2007020969')
|
38
|
-
|
39
|
-
|
38
|
+
click_on 'Bookmark'
|
39
|
+
click_on 'Remove bookmark'
|
40
40
|
expect(page).to have_content 'Successfully removed bookmark.'
|
41
41
|
end
|
42
42
|
|
43
|
-
it 'shows bookmarks as checkboxes', js
|
43
|
+
it 'shows bookmarks as checkboxes', :js do
|
44
44
|
visit solr_document_path('2007020969')
|
45
45
|
check 'Bookmark'
|
46
46
|
|
@@ -51,7 +51,7 @@ RSpec.describe "Bookmarks" do
|
|
51
51
|
|
52
52
|
it "adds bookmarks after a user logs in" do
|
53
53
|
visit solr_document_path('2007020969')
|
54
|
-
|
54
|
+
click_on 'Bookmark'
|
55
55
|
sign_in 'user1'
|
56
56
|
visit bookmarks_path
|
57
57
|
expect(page).to have_button("Remove bookmark")
|
@@ -60,25 +60,40 @@ RSpec.describe "Bookmarks" do
|
|
60
60
|
|
61
61
|
it "cites items in bookmarks" do
|
62
62
|
visit solr_document_path('2007020969')
|
63
|
-
|
64
|
-
|
65
|
-
|
63
|
+
click_on 'Bookmark'
|
64
|
+
click_on 'Bookmarks'
|
65
|
+
click_on 'Cite'
|
66
66
|
expect(page).to have_content 'Strong Medicine speaks'
|
67
67
|
end
|
68
68
|
|
69
69
|
it "cites all items in current bookmarks" do
|
70
70
|
visit solr_document_path('2009373513') # Ci an zhou bian
|
71
|
-
|
71
|
+
click_on 'Bookmark'
|
72
72
|
|
73
73
|
visit solr_document_path('2007020969') # Strong Medicine speaks
|
74
|
-
|
74
|
+
click_on 'Bookmark'
|
75
75
|
|
76
76
|
visit "/bookmarks?per_page=1"
|
77
77
|
expect(page).to have_content 'Strong Medicine speaks'
|
78
|
-
expect(page).
|
78
|
+
expect(page).to have_no_content 'Ci an zhou bian'
|
79
79
|
|
80
|
-
|
80
|
+
click_on 'Cite'
|
81
81
|
expect(page).to have_content 'Strong Medicine speaks'
|
82
82
|
expect(page).to have_content 'Ci an zhou bian'
|
83
83
|
end
|
84
|
+
|
85
|
+
context "has bookmark icon" do
|
86
|
+
before do
|
87
|
+
CatalogController.blacklight_config.bookmark_icon_component = Blacklight::Icons::BookmarkIconComponent
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'shows bookmark icon instead of checkbox', :js do
|
91
|
+
visit solr_document_path('2007020969')
|
92
|
+
expect(page).to have_css('.blacklight-icons-bookmark')
|
93
|
+
find('.blacklight-icons-bookmark').click
|
94
|
+
|
95
|
+
expect(find('.toggle-bookmark[type="checkbox"]', visible: false)).to be_checked
|
96
|
+
find('.blacklight-icons-bookmark').click
|
97
|
+
end
|
98
|
+
end
|
84
99
|
end
|