blacklight 8.2.2 → 8.4.0
Sign up to get free protection for your applications and to get access to all the features.
- 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 'catalog/_facet_index_navigation.html.erb'
|
3
|
+
RSpec.describe 'catalog/_facet_index_navigation.html.erb' do
|
4
4
|
let(:pagination) { Blacklight::Solr::FacetPaginator.new([]) }
|
5
5
|
let(:facet) { Blacklight::Configuration::FacetField.new(index_range: '0'..'9', presenter: Blacklight::FacetFieldPresenter) }
|
6
6
|
let(:display_facet) { double(items: [], offset: 0, prefix: '', sort: 'index') }
|
@@ -9,14 +9,13 @@ RSpec.describe 'catalog/_facet_index_navigation.html.erb', type: :view do
|
|
9
9
|
before do
|
10
10
|
assign(:display_facet, display_facet)
|
11
11
|
assign(:facet, facet)
|
12
|
-
allow(view).to
|
13
|
-
allow(view).to receive(:facet_limit_for).and_return(10)
|
12
|
+
allow(view).to receive_messages(blacklight_config: blacklight_config, facet_limit_for: 10)
|
14
13
|
controller.request.path_parameters[:action] = 'index'
|
15
14
|
end
|
16
15
|
|
17
16
|
it 'renders the facet index navigation range' do
|
18
17
|
render
|
19
|
-
expect(rendered).to
|
18
|
+
expect(rendered).to have_css '.pagination'
|
20
19
|
expect(rendered).to have_link '0', href: '/?facet.prefix=0&facet.sort=index'
|
21
20
|
expect(rendered).to have_link '1'
|
22
21
|
expect(rendered).to have_link '8'
|
@@ -25,7 +24,7 @@ RSpec.describe 'catalog/_facet_index_navigation.html.erb', type: :view do
|
|
25
24
|
|
26
25
|
it 'renders an "all" button' do
|
27
26
|
render
|
28
|
-
expect(rendered).to
|
27
|
+
expect(rendered).to have_css '.page-link', text: 'All'
|
29
28
|
end
|
30
29
|
|
31
30
|
context 'with a selected index' do
|
@@ -33,7 +32,7 @@ RSpec.describe 'catalog/_facet_index_navigation.html.erb', type: :view do
|
|
33
32
|
|
34
33
|
it 'highlights the selected index' do
|
35
34
|
render
|
36
|
-
expect(rendered).to
|
35
|
+
expect(rendered).to have_css '.active', text: '5'
|
37
36
|
end
|
38
37
|
|
39
38
|
it 'enables the clear facets button' do
|
@@ -17,25 +17,25 @@ RSpec.describe "catalog/facet_layout" do
|
|
17
17
|
|
18
18
|
it "has a facet-specific class" do
|
19
19
|
render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
|
20
|
-
expect(rendered).to
|
20
|
+
expect(rendered).to have_css '.blacklight-some_field'
|
21
21
|
end
|
22
22
|
|
23
23
|
it "has a title with a link for a11y" do
|
24
24
|
render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
|
25
|
-
expect(rendered).to
|
25
|
+
expect(rendered).to have_css 'h3', text: 'Some Field'
|
26
26
|
end
|
27
27
|
|
28
28
|
it "is collapsable" do
|
29
29
|
render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
|
30
|
-
expect(rendered).to
|
31
|
-
expect(rendered).to
|
30
|
+
expect(rendered).to have_css 'button.collapsed[data-toggle="collapse"][data-bs-toggle="collapse"][aria-expanded="false"]'
|
31
|
+
expect(rendered).to have_css '.collapse .card-body'
|
32
32
|
end
|
33
33
|
|
34
34
|
it "is configured to be open by default" do
|
35
35
|
allow(facet_field).to receive_messages(collapse: false)
|
36
36
|
render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
|
37
|
-
expect(rendered).to
|
38
|
-
expect(rendered).
|
39
|
-
expect(rendered).to
|
37
|
+
expect(rendered).to have_css 'button[data-toggle="collapse"][data-bs-toggle="collapse"][aria-expanded="true"]'
|
38
|
+
expect(rendered).to have_no_css '.card-header.collapsed'
|
39
|
+
expect(rendered).to have_css '.collapse.show .card-body'
|
40
40
|
end
|
41
41
|
end
|
@@ -11,14 +11,14 @@ RSpec.describe "catalog/_paginate_compact.html.erb" do
|
|
11
11
|
|
12
12
|
it "renders paginatable arrays" do
|
13
13
|
render partial: 'catalog/paginate_compact', object: Kaminari.paginate_array([], total_count: 145).page(1).per(10)
|
14
|
-
expect(rendered).to
|
15
|
-
expect(rendered).to
|
14
|
+
expect(rendered).to have_css ".page-entries"
|
15
|
+
expect(rendered).to have_css "a[@rel=next]"
|
16
16
|
end
|
17
17
|
|
18
18
|
it "renders ActiveRecord collections" do
|
19
19
|
50.times { b = Bookmark.new; b.user = user; b.save! }
|
20
20
|
render partial: 'catalog/paginate_compact', object: Bookmark.page(1).per(25)
|
21
|
-
expect(rendered).to
|
22
|
-
expect(rendered).to
|
21
|
+
expect(rendered).to have_css ".page-entries"
|
22
|
+
expect(rendered).to have_css "a[@rel=next]"
|
23
23
|
end
|
24
24
|
end
|
@@ -11,10 +11,7 @@ RSpec.describe "catalog/_show_sidebar.html.erb" do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
before do
|
14
|
-
allow(view).to
|
15
|
-
allow(view).to receive(:has_user_authentication_provider?).and_return(false)
|
16
|
-
allow(view).to receive(:document_actions).and_return([])
|
17
|
-
allow(view).to receive(:session_tracking_params).and_return({})
|
14
|
+
allow(view).to receive_messages(blacklight_config: blacklight_config, has_user_authentication_provider?: false, document_actions: [], session_tracking_params: {})
|
18
15
|
end
|
19
16
|
|
20
17
|
it "shows more-like-this titles in the sidebar" do
|
@@ -9,8 +9,7 @@ RSpec.describe "catalog/_show_tools.html.erb" do
|
|
9
9
|
allow(Blacklight::Document::ShowToolsComponent).to receive(:new).and_return(component)
|
10
10
|
allow(view).to receive(:render).with(component)
|
11
11
|
allow(view).to receive(:render).with('catalog/show_tools', { document: document }).and_call_original
|
12
|
-
allow(view).to
|
13
|
-
allow(view).to receive(:has_user_authentication_provider?).and_return false
|
12
|
+
allow(view).to receive_messages(blacklight_config: blacklight_config, has_user_authentication_provider?: false)
|
14
13
|
end
|
15
14
|
|
16
15
|
describe "document actions" do
|
@@ -34,13 +34,13 @@ RSpec.describe "catalog/_view_type_group" do
|
|
34
34
|
config.view.c(icon: :list)
|
35
35
|
end
|
36
36
|
render partial: 'catalog/view_type_group'
|
37
|
-
expect(rendered).to
|
38
|
-
expect(rendered).to
|
37
|
+
expect(rendered).to have_css('.btn-group.view-type-group')
|
38
|
+
expect(rendered).to have_css('.view-type-a', text: 'A')
|
39
39
|
within '.view-type-a' do
|
40
|
-
expect(rendered).to
|
40
|
+
expect(rendered).to have_css 'svg'
|
41
41
|
end
|
42
|
-
expect(rendered).to
|
43
|
-
expect(rendered).to
|
42
|
+
expect(rendered).to have_css('.view-type-b', text: 'B')
|
43
|
+
expect(rendered).to have_css('.view-type-c', text: 'C')
|
44
44
|
end
|
45
45
|
|
46
46
|
it "sets the current view to 'active'" do
|
@@ -50,7 +50,7 @@ RSpec.describe "catalog/_view_type_group" do
|
|
50
50
|
config.view.b(icon: :list)
|
51
51
|
end
|
52
52
|
render partial: 'catalog/view_type_group'
|
53
|
-
expect(rendered).to
|
54
|
-
expect(rendered).
|
53
|
+
expect(rendered).to have_css('.active', text: 'A')
|
54
|
+
expect(rendered).to have_no_css('.active', text: 'B')
|
55
55
|
end
|
56
56
|
end
|
@@ -3,6 +3,6 @@
|
|
3
3
|
RSpec.describe "catalog/email_success.html.erb" do
|
4
4
|
it "includes updates to the main flash messages" do
|
5
5
|
render
|
6
|
-
expect(rendered).to
|
6
|
+
expect(rendered).to have_css 'turbo-stream[action="append"][target="main-flashes"]'
|
7
7
|
end
|
8
8
|
end
|
@@ -20,8 +20,7 @@ RSpec.describe "catalog/index" do
|
|
20
20
|
allow(controller).to receive(:search_state_class).and_return(Blacklight::SearchState)
|
21
21
|
allow(@response).to receive(:documents).and_return(document_list)
|
22
22
|
params['content_format'] = 'some_format'
|
23
|
-
allow(view).to
|
24
|
-
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
|
23
|
+
allow(view).to receive_messages(action_name: 'index', blacklight_config: blacklight_config)
|
25
24
|
end
|
26
25
|
|
27
26
|
# We need to use rexml to test certain things that have_tag wont' test
|
@@ -30,13 +29,13 @@ RSpec.describe "catalog/index" do
|
|
30
29
|
it "has contextual information" do
|
31
30
|
render template: 'catalog/index', formats: [:atom]
|
32
31
|
|
33
|
-
expect(rendered).to
|
34
|
-
expect(rendered).to
|
35
|
-
expect(rendered).to
|
36
|
-
expect(rendered).to
|
37
|
-
expect(rendered).to
|
38
|
-
expect(rendered).to
|
39
|
-
expect(rendered).to
|
32
|
+
expect(rendered).to have_css("link[rel=self]")
|
33
|
+
expect(rendered).to have_css("link[rel=next]")
|
34
|
+
expect(rendered).to have_css("link[rel=previous]")
|
35
|
+
expect(rendered).to have_css("link[rel=first]")
|
36
|
+
expect(rendered).to have_css("link[rel=last]")
|
37
|
+
expect(rendered).to have_css("link[rel='alternate'][type='text/html']")
|
38
|
+
expect(rendered).to have_css("link[rel=search][type='application/opensearchdescription+xml']")
|
40
39
|
end
|
41
40
|
|
42
41
|
it "gets paging data correctly from response" do
|
@@ -62,33 +61,33 @@ RSpec.describe "catalog/index" do
|
|
62
61
|
it "has ten entries" do
|
63
62
|
render template: 'catalog/index', formats: [:atom]
|
64
63
|
|
65
|
-
expect(rendered).to
|
64
|
+
expect(rendered).to have_css("entry", count: 10)
|
66
65
|
end
|
67
66
|
|
68
67
|
describe "entries" do
|
69
68
|
it "has a title" do
|
70
69
|
render template: 'catalog/index', formats: [:atom]
|
71
|
-
expect(rendered).to
|
70
|
+
expect(rendered).to have_css("entry > title")
|
72
71
|
end
|
73
72
|
|
74
73
|
it "has an updated" do
|
75
74
|
render template: 'catalog/index', formats: [:atom]
|
76
|
-
expect(rendered).to
|
75
|
+
expect(rendered).to have_css("entry > updated")
|
77
76
|
end
|
78
77
|
|
79
78
|
it "has html link" do
|
80
79
|
render template: 'catalog/index', formats: [:atom]
|
81
|
-
expect(rendered).to
|
80
|
+
expect(rendered).to have_css("entry > link[rel=alternate][type='text/html']")
|
82
81
|
end
|
83
82
|
|
84
83
|
it "has an id" do
|
85
84
|
render template: 'catalog/index', formats: [:atom]
|
86
|
-
expect(rendered).to
|
85
|
+
expect(rendered).to have_css("entry > id")
|
87
86
|
end
|
88
87
|
|
89
88
|
it "has a summary" do
|
90
89
|
render template: 'catalog/index', formats: [:atom]
|
91
|
-
expect(rendered).to
|
90
|
+
expect(rendered).to have_css("entry > summary", text: 'Title 0')
|
92
91
|
end
|
93
92
|
|
94
93
|
context 'with a custom template' do
|
@@ -107,7 +106,7 @@ RSpec.describe "catalog/index" do
|
|
107
106
|
|
108
107
|
it "has the customized summary" do
|
109
108
|
render template: 'catalog/index', formats: [:atom]
|
110
|
-
expect(rendered).to
|
109
|
+
expect(rendered).to have_css("entry > summary", text: 'whatever content')
|
111
110
|
end
|
112
111
|
end
|
113
112
|
|
@@ -136,12 +135,12 @@ RSpec.describe "catalog/index" do
|
|
136
135
|
|
137
136
|
it "includes a link rel tag" do
|
138
137
|
render template: 'catalog/index', formats: [:atom]
|
139
|
-
expect(entry).to
|
138
|
+
expect(entry).to have_css("link[rel=alternate][type='application/some-format']")
|
140
139
|
end
|
141
140
|
|
142
141
|
it "has content embedded" do
|
143
142
|
render template: 'catalog/index', formats: [:atom]
|
144
|
-
expect(entry).to
|
143
|
+
expect(entry).to have_css("content")
|
145
144
|
end
|
146
145
|
end
|
147
146
|
|
@@ -150,7 +149,7 @@ RSpec.describe "catalog/index" do
|
|
150
149
|
|
151
150
|
it "does not have content embedded" do
|
152
151
|
render template: 'catalog/index', formats: [:atom]
|
153
|
-
expect(entry).
|
152
|
+
expect(entry).to have_no_css("content[type='application/some-format']")
|
154
153
|
end
|
155
154
|
end
|
156
155
|
end
|
@@ -3,8 +3,7 @@
|
|
3
3
|
RSpec.describe "catalog/index.html.erb" do
|
4
4
|
describe "with no search parameters" do
|
5
5
|
before do
|
6
|
-
allow(view).to
|
7
|
-
allow(view).to receive(:blacklight_config).and_return(CatalogController.blacklight_config)
|
6
|
+
allow(view).to receive_messages(has_search_parameters?: false, blacklight_config: CatalogController.blacklight_config)
|
8
7
|
@response = instance_double(Blacklight::Solr::Response, empty?: true, total: 11, start: 1, limit_value: 10, aggregations: {})
|
9
8
|
end
|
10
9
|
|
@@ -19,10 +18,9 @@ RSpec.describe "catalog/index.html.erb" do
|
|
19
18
|
|
20
19
|
describe "with search parameters" do
|
21
20
|
before do
|
22
|
-
allow(view).to receive(:has_search_parameters?).and_return(true)
|
23
21
|
stub_template "catalog/_results_pagination.html.erb" => ""
|
24
22
|
stub_template "catalog/_search_header.html.erb" => "header_content"
|
25
|
-
allow(view).to
|
23
|
+
allow(view).to receive_messages(has_search_parameters?: true, blacklight_config: Blacklight::Configuration.new)
|
26
24
|
@response = instance_double(Blacklight::Solr::Response, empty?: true, total: 11, start: 1, limit_value: 10)
|
27
25
|
end
|
28
26
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
RSpec.describe "catalog/index.json", api
|
3
|
+
RSpec.describe "catalog/index.json", :api do
|
4
4
|
let(:response) { instance_double(Blacklight::Solr::Response, documents: docs, prev_page: nil, next_page: 2, total_pages: 3) }
|
5
5
|
let(:docs) do
|
6
6
|
[
|
@@ -32,13 +32,10 @@ RSpec.describe "catalog/index.json", api: true do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
before do
|
35
|
-
allow(view).to
|
36
|
-
allow(
|
37
|
-
|
38
|
-
|
39
|
-
next_page: 2,
|
40
|
-
prev_page: nil)
|
41
|
-
allow(presenter).to receive(:search_facets).and_return([format_facet])
|
35
|
+
allow(view).to receive_messages(blacklight_config: config, search_action_path: 'http://test.host/some/search/url', search_facet_path: 'http://test.host/some/facet/url')
|
36
|
+
allow(presenter).to receive_messages(pagination_info: { current_page: 1,
|
37
|
+
next_page: 2,
|
38
|
+
prev_page: nil }, search_facets: [format_facet])
|
42
39
|
assign :presenter, presenter
|
43
40
|
assign :response, response
|
44
41
|
end
|
@@ -7,13 +7,11 @@ RSpec.describe "catalog/show.html.erb" do
|
|
7
7
|
|
8
8
|
before do
|
9
9
|
allow(presenter).to receive(:html_title).and_return('Heading')
|
10
|
-
allow(view).to receive(:document_presenter).and_return(presenter)
|
11
|
-
allow(view).to receive(:action_name).and_return('show')
|
12
10
|
allow(view).to receive_messages(has_user_authentication_provider?: false)
|
13
11
|
allow(view).to receive_messages(render_document_sidebar_partial: "Sidebar")
|
14
12
|
allow(view).to receive_messages(current_search_session: nil, search_session: {})
|
15
13
|
assign :document, document
|
16
|
-
allow(view).to
|
14
|
+
allow(view).to receive_messages(document_presenter: presenter, action_name: 'show', blacklight_config: blacklight_config)
|
17
15
|
end
|
18
16
|
|
19
17
|
it "sets the @page_title" do
|
@@ -26,8 +24,8 @@ RSpec.describe "catalog/show.html.erb" do
|
|
26
24
|
it "includes schema.org itemscope/type properties" do
|
27
25
|
allow(document).to receive_messages(itemtype: 'some-item-type-uri')
|
28
26
|
render
|
29
|
-
expect(rendered).to
|
30
|
-
expect(rendered).to
|
27
|
+
expect(rendered).to have_css('div#document[@itemscope]')
|
28
|
+
expect(rendered).to have_css('div#document[@itemtype="some-item-type-uri"]')
|
31
29
|
end
|
32
30
|
|
33
31
|
it "uses the show.partials parameter to determine the partials to render" do
|
@@ -16,8 +16,7 @@ RSpec.describe "catalog/show.json" do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
before do
|
19
|
-
allow(view).to
|
20
|
-
allow(view).to receive(:action_name).and_return('show')
|
19
|
+
allow(view).to receive_messages(blacklight_config: config, action_name: 'show')
|
21
20
|
assign :document, document
|
22
21
|
end
|
23
22
|
|
@@ -3,6 +3,6 @@
|
|
3
3
|
RSpec.describe "catalog/sms_success.html.erb" do
|
4
4
|
it "includes updates to the main flash messages" do
|
5
5
|
render
|
6
|
-
expect(rendered).to
|
6
|
+
expect(rendered).to have_css 'turbo-stream[action="append"][target="main-flashes"]'
|
7
7
|
end
|
8
8
|
end
|
@@ -9,11 +9,10 @@ RSpec.describe "shared/_user_util_links" do
|
|
9
9
|
|
10
10
|
it "renders the correct bookmark count" do
|
11
11
|
count = rand(99)
|
12
|
-
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
|
13
12
|
allow(controller).to receive(:render_bookmarks_control?).and_return true
|
14
|
-
allow(view).to
|
13
|
+
allow(view).to receive_messages(blacklight_config: blacklight_config, has_user_authentication_provider?: false)
|
15
14
|
allow(view).to receive_message_chain(:current_or_guest_user, :bookmarks, :count).and_return(count)
|
16
15
|
render "shared/user_util_links"
|
17
|
-
expect(rendered).to
|
16
|
+
expect(rendered).to have_css('#bookmarks_nav span.badge[data-role=bookmark-counter]', text: count.to_s)
|
18
17
|
end
|
19
18
|
end
|
data/tasks/blacklight.rake
CHANGED
@@ -21,18 +21,18 @@ def system_with_error_handling(*args)
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def with_solr(&block)
|
24
|
-
# We're being invoked by the app entrypoint script and solr is already up via docker
|
24
|
+
# We're being invoked by the app entrypoint script and solr is already up via docker compose
|
25
25
|
if ENV['SOLR_ENV'] == 'docker-compose'
|
26
26
|
yield
|
27
|
-
elsif system('docker
|
28
|
-
# We're not running docker
|
27
|
+
elsif system('docker compose -v')
|
28
|
+
# We're not running `docker compose up' but still want to use a docker instance of solr.
|
29
29
|
begin
|
30
30
|
puts "Starting Solr"
|
31
|
-
system_with_error_handling "docker
|
31
|
+
system_with_error_handling "docker compose up -d solr"
|
32
32
|
yield
|
33
33
|
ensure
|
34
34
|
puts "Stopping Solr"
|
35
|
-
system_with_error_handling "docker
|
35
|
+
system_with_error_handling "docker compose stop solr"
|
36
36
|
end
|
37
37
|
else
|
38
38
|
SolrWrapper.wrap do |solr|
|