blacklight 8.0.0.beta8 → 8.0.1
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/VERSION +1 -1
- data/app/assets/config/blacklight/manifest.js +1 -1
- data/app/components/blacklight/document/show_tools_component.html.erb +12 -0
- data/app/components/blacklight/document/show_tools_component.rb +23 -0
- data/app/components/blacklight/document/sidebar_component.html.erb +1 -1
- data/app/components/blacklight/document/sidebar_component.rb +12 -0
- data/app/components/blacklight/document_component.rb +1 -1
- data/app/components/blacklight/response/pagination_component.html.erb +1 -1
- data/app/components/blacklight/response/pagination_component.rb +5 -1
- data/app/components/blacklight/top_navbar_component.html.erb +1 -1
- data/app/components/blacklight/top_navbar_component.rb +4 -0
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +10 -0
- data/app/helpers/blacklight/render_partials_helper_behavior.rb +1 -0
- data/app/views/catalog/_show_tools.html.erb +2 -14
- data/app/views/layouts/blacklight/base.html.erb +0 -3
- data/lib/blacklight/configuration.rb +3 -0
- data/lib/railties/blacklight.rake +4 -4
- data/package.json +2 -2
- data/spec/components/blacklight/document/sidebar_component_spec.rb +63 -0
- data/spec/components/blacklight/document_component_spec.rb +20 -0
- data/spec/components/blacklight/header_component_spec.rb +20 -0
- data/spec/controllers/catalog_controller_spec.rb +1 -1
- data/spec/lib/blacklight/open_struct_with_hash_access_spec.rb +2 -2
- data/spec/models/blacklight/configuration_spec.rb +2 -2
- data/spec/models/blacklight/search_builder_spec.rb +3 -3
- data/spec/models/blacklight/solr/request_spec.rb +2 -2
- data/spec/presenters/blacklight/show_presenter_spec.rb +4 -10
- data/spec/support/view_component_test_helpers.rb +1 -1
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +2 -2
- data/spec/views/catalog/index.json.jbuilder_spec.rb +1 -1
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 788296244ed7711b196967fcc206a6b7836db4b384bcbbe7e062cdf9f29d8b06
|
4
|
+
data.tar.gz: 4f83e1cf3421afde9db8cd8bfb7fed298c5f3c5874de2f22f7e7a48db2fe5979
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 193f6a74d712c28cd42a7354ff0da15b7e303b94e51a3854de54401a38ef2e444bf76a1878130fcef71d5286080943cc5635d46f3f38b8bce7c539d2af6f10fe
|
7
|
+
data.tar.gz: 0cf1904df3915ed93d122d54d653201b576c2b4027b182fdb88e6d02bcc9885bac69ecc9c7f6331f4dd3d9ca7f637600e869a5edcb106dad03b2c88868e77e86
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
8.0.
|
1
|
+
8.0.1
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<div class="card show-tools">
|
2
|
+
<div class="card-header">
|
3
|
+
<h2 class="mb-0 h6"><%= t('blacklight.tools.title') %></h2>
|
4
|
+
</div>
|
5
|
+
<%= render Blacklight::Document::ActionsComponent.new(document: document,
|
6
|
+
tag: 'ul',
|
7
|
+
classes: 'list-group list-group-flush',
|
8
|
+
wrapping_tag: 'li',
|
9
|
+
wrapping_classes: 'list-group-item list-group-item-action',
|
10
|
+
actions: actions,
|
11
|
+
url_opts: Blacklight::Parameters.sanitize(params.to_unsafe_h)) %>
|
12
|
+
</div>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Blacklight
|
4
|
+
module Document
|
5
|
+
# Render the tools that display on the sidebar of the show page
|
6
|
+
class ShowToolsComponent < Blacklight::Component
|
7
|
+
# @param [Blacklight::Document] document
|
8
|
+
def initialize(document:)
|
9
|
+
@document = document
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_reader :document
|
13
|
+
|
14
|
+
def render?
|
15
|
+
helpers.show_doc_actions?
|
16
|
+
end
|
17
|
+
|
18
|
+
def actions
|
19
|
+
helpers.document_actions(document)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,2 +1,2 @@
|
|
1
|
-
<%=
|
1
|
+
<%= render_show_tools %>
|
2
2
|
<%= render(Blacklight::Document::MoreLikeThisComponent.new(document: document)) %>
|
@@ -11,6 +11,18 @@ module Blacklight
|
|
11
11
|
end
|
12
12
|
|
13
13
|
attr_reader :document
|
14
|
+
|
15
|
+
delegate :blacklight_config, to: :helpers
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def render_show_tools
|
20
|
+
blacklight_config.view_config(:show).show_tools_component&.tap do |show_tools_component_class|
|
21
|
+
return render show_tools_component_class.new(document: document)
|
22
|
+
end
|
23
|
+
|
24
|
+
render 'show_tools', document: document, silence_deprecation: helpers.partial_from_blacklight?('show_tools')
|
25
|
+
end
|
14
26
|
end
|
15
27
|
end
|
16
28
|
end
|
@@ -37,7 +37,7 @@ module Blacklight
|
|
37
37
|
|
38
38
|
# The document title with some reasonable default behavior
|
39
39
|
renders_one :title, (lambda do |*args, component: nil, **kwargs|
|
40
|
-
component ||= Blacklight::DocumentTitleComponent
|
40
|
+
component ||= @presenter&.view_config&.title_component || Blacklight::DocumentTitleComponent
|
41
41
|
|
42
42
|
component.new(*args, counter: @counter, document: @document, presenter: @presenter, as: @title_component, actions: !@show, link_to_document: !@show, document_component: self, **kwargs)
|
43
43
|
end)
|
@@ -8,10 +8,14 @@ module Blacklight
|
|
8
8
|
# @param [Hash] html html options for the pagination container
|
9
9
|
def initialize(response:, html: {}, **pagination_args)
|
10
10
|
@response = response
|
11
|
-
@
|
11
|
+
@html = html
|
12
12
|
@pagination_args = pagination_args
|
13
13
|
end
|
14
14
|
|
15
|
+
def html_attr
|
16
|
+
{ aria: { label: t('views.pagination.aria.container_label') } }.merge(@html)
|
17
|
+
end
|
18
|
+
|
15
19
|
def pagination
|
16
20
|
helpers.paginate @response, **Blacklight::Engine.config.blacklight.default_pagination_options, **@pagination_args
|
17
21
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<nav class="navbar navbar-expand-md navbar-dark bg-dark topbar" role="navigation">
|
2
2
|
<div class="<%= container_classes %>">
|
3
|
-
<%=
|
3
|
+
<%= logo_link %>
|
4
4
|
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-bs-toggle="collapse" data-target="#user-util-collapse" data-bs-target="#user-util-collapse" aria-controls="user-util-collapse" aria-expanded="false" aria-label="Toggle navigation">
|
5
5
|
<span class="navbar-toggler-icon"></span>
|
6
6
|
</button>
|
@@ -9,5 +9,9 @@ module Blacklight
|
|
9
9
|
attr_reader :blacklight_config
|
10
10
|
|
11
11
|
delegate :application_name, :container_classes, to: :helpers
|
12
|
+
|
13
|
+
def logo_link(title: application_name)
|
14
|
+
link_to title, blacklight_config.logo_link, class: 'mb-0 navbar-brand navbar-logo'
|
15
|
+
end
|
12
16
|
end
|
13
17
|
end
|
@@ -37,4 +37,14 @@ module Blacklight::BlacklightHelperBehavior
|
|
37
37
|
self.formats = old_formats
|
38
38
|
nil
|
39
39
|
end
|
40
|
+
|
41
|
+
def self.blacklight_gem_path
|
42
|
+
@blacklight_gem_path ||= Gem.loaded_specs["blacklight"].full_gem_path
|
43
|
+
end
|
44
|
+
|
45
|
+
def partial_from_blacklight?(partial)
|
46
|
+
path = lookup_context.find_all(partial, lookup_context.prefixes + [""], true).first&.identifier
|
47
|
+
|
48
|
+
path.nil? ? false : path.starts_with?(Blacklight::BlacklightHelperBehavior.blacklight_gem_path)
|
49
|
+
end
|
40
50
|
end
|
@@ -59,6 +59,7 @@ render document_component.new(presenter: document_presenter(document), component
|
|
59
59
|
if template
|
60
60
|
template.render(self, locals.merge(document: doc))
|
61
61
|
else
|
62
|
+
logger.warn("No template was found for base_name: '#{base_name}', view_type: '#{view_type}' in render_document_partial")
|
62
63
|
''
|
63
64
|
end
|
64
65
|
end
|
@@ -1,14 +1,2 @@
|
|
1
|
-
<%
|
2
|
-
|
3
|
-
<div class="card-header">
|
4
|
-
<h2 class="mb-0 h6"><%= t('blacklight.tools.title') %></h2>
|
5
|
-
</div>
|
6
|
-
<%= render Blacklight::Document::ActionsComponent.new(document: document,
|
7
|
-
tag: 'ul',
|
8
|
-
classes: 'list-group list-group-flush',
|
9
|
-
wrapping_tag: 'li',
|
10
|
-
wrapping_classes: 'list-group-item list-group-item-action',
|
11
|
-
actions: document_actions(document),
|
12
|
-
url_opts: Blacklight::Parameters.sanitize(params.to_unsafe_h)) %>
|
13
|
-
</div>
|
14
|
-
<% end %>
|
1
|
+
<% Blacklight.deprecation.warn('The partial _show_tools.html.erb will be removed in 9.0. Configure blacklight_config.show.show_tools_component instead (default Blacklight::Document::ShowToolsComponent).') unless local_assigns[:silence_deprecation] %>
|
2
|
+
<%= render Blacklight::Document::ShowToolsComponent.new(document: document) %>
|
@@ -5,9 +5,6 @@
|
|
5
5
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
7
7
|
|
8
|
-
<!-- Internet Explorer use the highest version available -->
|
9
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
10
|
-
|
11
8
|
<title><%= render_page_title %></title>
|
12
9
|
<script>
|
13
10
|
document.querySelector('html').classList.remove('no-js');
|
@@ -181,6 +181,9 @@ module Blacklight
|
|
181
181
|
# document presenter class used by helpers and views
|
182
182
|
document_presenter_class: nil,
|
183
183
|
document_component: Blacklight::DocumentComponent,
|
184
|
+
# in Blacklight 9, the default show_tools_component configuration will
|
185
|
+
# be Blacklight::Document::ShowToolsComponent
|
186
|
+
show_tools_component: nil,
|
184
187
|
sidebar_component: Blacklight::Document::SidebarComponent,
|
185
188
|
display_type_field: nil,
|
186
189
|
# the "field access" key to use to look up the document display fields
|
@@ -40,7 +40,7 @@ namespace :blacklight do
|
|
40
40
|
exit 1
|
41
41
|
end
|
42
42
|
rescue => e
|
43
|
-
puts e
|
43
|
+
puts e
|
44
44
|
exit 1
|
45
45
|
end
|
46
46
|
|
@@ -70,7 +70,7 @@ namespace :blacklight do
|
|
70
70
|
end
|
71
71
|
rescue => e
|
72
72
|
errors += 1
|
73
|
-
puts e
|
73
|
+
puts e
|
74
74
|
end
|
75
75
|
|
76
76
|
print " - search_results: "
|
@@ -92,7 +92,7 @@ namespace :blacklight do
|
|
92
92
|
end
|
93
93
|
rescue => e
|
94
94
|
errors += 1
|
95
|
-
puts e
|
95
|
+
puts e
|
96
96
|
end
|
97
97
|
|
98
98
|
print " - fetch: "
|
@@ -112,7 +112,7 @@ namespace :blacklight do
|
|
112
112
|
end
|
113
113
|
rescue => e
|
114
114
|
errors += 1
|
115
|
-
puts e
|
115
|
+
puts e
|
116
116
|
end
|
117
117
|
|
118
118
|
exit 1 if errors > 0
|
data/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "blacklight-frontend",
|
3
|
-
"version": "8.0.
|
4
|
-
"description": "
|
3
|
+
"version": "8.0.1",
|
4
|
+
"description": "The frontend code and styles for Blacklight",
|
5
5
|
"main": "app/assets/javascripts/blacklight",
|
6
6
|
"module": "app/assets/javascripts/blacklight/blacklight.esm.js",
|
7
7
|
"scripts": {
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe Blacklight::Document::SidebarComponent, type: :component do
|
6
|
+
subject(:component) { described_class.new(presenter: document) }
|
7
|
+
|
8
|
+
let(:view_context) { controller.view_context }
|
9
|
+
let(:render) do
|
10
|
+
component.render_in(view_context)
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:rendered) do
|
14
|
+
Capybara::Node::Simple.new(render)
|
15
|
+
end
|
16
|
+
|
17
|
+
let(:document) { view_context.document_presenter(presented_document) }
|
18
|
+
|
19
|
+
let(:presented_document) { SolrDocument.new(id: 'x', title_tsim: 'Title') }
|
20
|
+
|
21
|
+
let(:blacklight_config) do
|
22
|
+
CatalogController.blacklight_config.deep_copy
|
23
|
+
end
|
24
|
+
|
25
|
+
let(:expected_html) { "<div class=\"expected-show_tools\">Expected Content</div>".html_safe }
|
26
|
+
|
27
|
+
before do
|
28
|
+
# Every call to view_context returns a different object. This ensures it stays stable.
|
29
|
+
allow(controller).to receive(:view_context).and_return(view_context)
|
30
|
+
allow(controller).to receive(:blacklight_config).and_return(blacklight_config)
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '#render_show_tools' do
|
34
|
+
# rubocop:disable RSpec/SubjectStub
|
35
|
+
before do
|
36
|
+
allow(component).to receive(:render).with(an_instance_of(Blacklight::Document::MoreLikeThisComponent)).and_return("")
|
37
|
+
end
|
38
|
+
|
39
|
+
context "without a configured ShowTools component" do
|
40
|
+
before do
|
41
|
+
allow(component).to receive(:render).with('show_tools', document: presented_document, silence_deprecation: false).and_return(expected_html)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'renders show_tools partial' do
|
45
|
+
expect(rendered).to have_selector 'div[@class="expected-show_tools"]'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context "with a configured ShowTools component" do
|
50
|
+
let(:show_tools_component) { Class.new(Blacklight::Document::ShowToolsComponent) }
|
51
|
+
|
52
|
+
before do
|
53
|
+
blacklight_config.show.show_tools_component = show_tools_component
|
54
|
+
allow(component).to receive(:render).with(an_instance_of(show_tools_component)).and_return(expected_html)
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'renders configured show_tools component' do
|
58
|
+
expect(rendered).to have_selector 'div[@class="expected-show_tools"]'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
# rubocop:enable RSpec/SubjectStub
|
62
|
+
end
|
63
|
+
end
|
@@ -181,6 +181,26 @@ RSpec.describe Blacklight::DocumentComponent, type: :component do
|
|
181
181
|
expect(rendered).to have_text 'blah'
|
182
182
|
end
|
183
183
|
end
|
184
|
+
|
185
|
+
context 'with configured title component' do
|
186
|
+
let(:custom_component_class) do
|
187
|
+
Class.new(Blacklight::DocumentTitleComponent) do
|
188
|
+
# Override component rendering with our own value
|
189
|
+
def call
|
190
|
+
'Titleriffic'
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
before do
|
196
|
+
stub_const('MyTitleComponent', custom_component_class)
|
197
|
+
blacklight_config.show.title_component = MyTitleComponent
|
198
|
+
end
|
199
|
+
|
200
|
+
it 'renders custom component' do
|
201
|
+
expect(rendered).to have_text 'Titleriffic'
|
202
|
+
end
|
203
|
+
end
|
184
204
|
end
|
185
205
|
|
186
206
|
it 'renders partials' do
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.describe Blacklight::HeaderComponent, type: :component do
|
4
|
+
before do
|
5
|
+
with_controller_class(CatalogController) do
|
6
|
+
allow(controller).to receive(:current_user).and_return(nil)
|
7
|
+
allow(controller).to receive(:search_action_url).and_return('/search')
|
8
|
+
render
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'with no slots' do
|
13
|
+
let(:render) { render_inline(described_class.new(blacklight_config: CatalogController.blacklight_config)) }
|
14
|
+
|
15
|
+
it 'draws the topbar' do
|
16
|
+
expect(page).to have_css 'nav.topbar'
|
17
|
+
expect(page).to have_link 'Blacklight', href: '/'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -158,7 +158,7 @@ RSpec.describe CatalogController, api: true do
|
|
158
158
|
|
159
159
|
format = facets.find { |x| x['id'] == 'format' }
|
160
160
|
|
161
|
-
expect(format['attributes']['items'].pluck('attributes')).to
|
161
|
+
expect(format['attributes']['items'].pluck('attributes')).to contain_exactly({ "value" => "Book", "hits" => 30, "label" => "Book" })
|
162
162
|
expect(format['links']['self']).to eq facet_catalog_url(format: :json, id: 'format')
|
163
163
|
expect(format['attributes']['items'].first['links']['self']).to eq search_catalog_url(format: :json, f: { format: ['Book'] })
|
164
164
|
end
|
@@ -76,7 +76,7 @@ RSpec.describe Blacklight::OpenStructWithHashAccess do
|
|
76
76
|
|
77
77
|
it "sorts the underlying hash" do
|
78
78
|
sorted = subject.sort_by { |_k, v| v }
|
79
|
-
expect(sorted.keys).to
|
79
|
+
expect(sorted.keys).to contain_exactly(:b, :a, :c)
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
@@ -85,7 +85,7 @@ RSpec.describe Blacklight::OpenStructWithHashAccess do
|
|
85
85
|
|
86
86
|
it "sorts the underlying hash" do
|
87
87
|
subject.sort_by! { |_k, v| v }
|
88
|
-
expect(subject.keys).to
|
88
|
+
expect(subject.keys).to contain_exactly(:b, :a, :c)
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
@@ -172,8 +172,8 @@ RSpec.describe "Blacklight::Configuration", api: true do
|
|
172
172
|
|
173
173
|
expect(config.a[:value]).to eq 1
|
174
174
|
expect(config_copy.a[:value]).to eq 2
|
175
|
-
expect(config.b).to
|
176
|
-
expect(config_copy.b).to
|
175
|
+
expect(config.b).to contain_exactly(1, 2, 3)
|
176
|
+
expect(config_copy.b).to contain_exactly(1, 2, 3, 5)
|
177
177
|
expect(config.c.value).to match_array %w[a b]
|
178
178
|
expect(config_copy.c.value).to match_array %w[a b c]
|
179
179
|
end
|
@@ -45,7 +45,7 @@ RSpec.describe Blacklight::SearchBuilder, api: true do
|
|
45
45
|
|
46
46
|
it "is mutable" do
|
47
47
|
subject.processor_chain.insert(-1, :d)
|
48
|
-
expect(subject.processor_chain).to
|
48
|
+
expect(subject.processor_chain).to contain_exactly(:a, :b, :c, :d)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -56,7 +56,7 @@ RSpec.describe Blacklight::SearchBuilder, api: true do
|
|
56
56
|
builder = subject.append(:d, :e)
|
57
57
|
expect(subject.processor_chain).to eq processor_chain
|
58
58
|
expect(builder.processor_chain).not_to eq subject.processor_chain
|
59
|
-
expect(builder.processor_chain).to
|
59
|
+
expect(builder.processor_chain).to contain_exactly(:a, :b, :c, :d, :e)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -68,7 +68,7 @@ RSpec.describe Blacklight::SearchBuilder, api: true do
|
|
68
68
|
expect(builder).not_to equal(subject)
|
69
69
|
expect(subject.processor_chain).to eq processor_chain
|
70
70
|
expect(builder.processor_chain).not_to eq subject.processor_chain
|
71
|
-
expect(builder.processor_chain).to
|
71
|
+
expect(builder.processor_chain).to contain_exactly(:a, :c, :e)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -45,7 +45,7 @@ RSpec.describe Blacklight::Solr::Request, api: true do
|
|
45
45
|
subject.append_query 'this is my query'
|
46
46
|
subject.append_query 'another:query'
|
47
47
|
expect(subject).not_to have_key 'q'
|
48
|
-
expect(subject.dig('json', 'query', 'bool', 'must')).to
|
48
|
+
expect(subject.dig('json', 'query', 'bool', 'must')).to contain_exactly('this is my query', 'another:query')
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -62,7 +62,7 @@ RSpec.describe Blacklight::Solr::Request, api: true do
|
|
62
62
|
subject['q'] = 'some query'
|
63
63
|
subject.append_boolean_query :must, 'also required'
|
64
64
|
|
65
|
-
expect(subject.dig('json', 'query', 'bool', 'must')).to
|
65
|
+
expect(subject.dig('json', 'query', 'bool', 'must')).to contain_exactly('some query', 'also required')
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
@@ -50,10 +50,6 @@ RSpec.describe Blacklight::ShowPresenter, api: true do
|
|
50
50
|
|
51
51
|
MockDocument.use_extension(MockExtension)
|
52
52
|
|
53
|
-
def mock_document_app_helper_url *args
|
54
|
-
solr_document_url(*args)
|
55
|
-
end
|
56
|
-
|
57
53
|
allow(request_context).to receive(:polymorphic_url) do |_, opts|
|
58
54
|
"url.#{opts[:format]}"
|
59
55
|
end
|
@@ -68,12 +64,10 @@ RSpec.describe Blacklight::ShowPresenter, api: true do
|
|
68
64
|
tmp_value = Capybara.ignore_hidden_elements
|
69
65
|
Capybara.ignore_hidden_elements = false
|
70
66
|
document.export_formats.each_pair do |format, _spec|
|
71
|
-
expect(subject).to have_selector("link[href$='.#{format}']") do |
|
72
|
-
expect(
|
73
|
-
tag
|
74
|
-
expect(tag
|
75
|
-
expect(tag.attributes["title"].value).to eq format.to_s
|
76
|
-
expect(tag.attributes["href"].value).to eq mock_document_app_helper_url(document, format: format)
|
67
|
+
expect(subject).to have_selector("link[href$='.#{format}']", count: 1) do |tag|
|
68
|
+
expect(tag["rel"]).to eq "alternate"
|
69
|
+
expect(tag["title"]).to eq format.to_s
|
70
|
+
expect(tag["href"]).to eq "url.#{format}"
|
77
71
|
end
|
78
72
|
end
|
79
73
|
Capybara.ignore_hidden_elements = tmp_value
|
@@ -14,7 +14,7 @@ module ViewComponentTestHelpers
|
|
14
14
|
return super if defined?(super)
|
15
15
|
|
16
16
|
# ViewComponent 3.x
|
17
|
-
return
|
17
|
+
return vc_test_controller if defined?(vc_test_controller)
|
18
18
|
|
19
19
|
ApplicationController.new.extend(Rails.application.routes.url_helpers)
|
20
20
|
end
|
@@ -3,10 +3,10 @@
|
|
3
3
|
RSpec.describe "catalog/_show_tools.html.erb" do
|
4
4
|
let(:document) { SolrDocument.new id: 'xyz', format: 'a' }
|
5
5
|
let(:blacklight_config) { Blacklight::Configuration.new }
|
6
|
-
let(:component) { instance_double(Blacklight::Document::
|
6
|
+
let(:component) { instance_double(Blacklight::Document::ShowToolsComponent) }
|
7
7
|
|
8
8
|
before do
|
9
|
-
allow(Blacklight::Document::
|
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
12
|
allow(view).to receive(:blacklight_config).and_return blacklight_config
|
@@ -93,7 +93,7 @@ RSpec.describe "catalog/index.json", api: true do
|
|
93
93
|
expect(facets.pluck('id')).to include 'format'
|
94
94
|
expect(format['links']).to include self: 'http://test.host/some/facet/url'
|
95
95
|
expect(format['attributes']['label']).to eq 'Format'
|
96
|
-
expect(format_item_attributes).to
|
96
|
+
expect(format_item_attributes).to contain_exactly({ value: 'Book', hits: 30, label: 'Book' })
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
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: 8.0.
|
4
|
+
version: 8.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
@@ -17,7 +17,7 @@ authors:
|
|
17
17
|
autorequire:
|
18
18
|
bindir: exe
|
19
19
|
cert_chain: []
|
20
|
-
date: 2023-
|
20
|
+
date: 2023-05-01 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|
@@ -423,6 +423,8 @@ files:
|
|
423
423
|
- app/components/blacklight/document/group_component.rb
|
424
424
|
- app/components/blacklight/document/more_like_this_component.html.erb
|
425
425
|
- app/components/blacklight/document/more_like_this_component.rb
|
426
|
+
- app/components/blacklight/document/show_tools_component.html.erb
|
427
|
+
- app/components/blacklight/document/show_tools_component.rb
|
426
428
|
- app/components/blacklight/document/sidebar_component.html.erb
|
427
429
|
- app/components/blacklight/document/sidebar_component.rb
|
428
430
|
- app/components/blacklight/document/thumbnail_component.html.erb
|
@@ -769,6 +771,7 @@ files:
|
|
769
771
|
- spec/components/blacklight/constraints_component_spec.rb
|
770
772
|
- spec/components/blacklight/document/action_component_spec.rb
|
771
773
|
- spec/components/blacklight/document/group_component_spec.rb
|
774
|
+
- spec/components/blacklight/document/sidebar_component_spec.rb
|
772
775
|
- spec/components/blacklight/document_component_spec.rb
|
773
776
|
- spec/components/blacklight/document_metadata_component_spec.rb
|
774
777
|
- spec/components/blacklight/facet_component_spec.rb
|
@@ -776,6 +779,7 @@ files:
|
|
776
779
|
- spec/components/blacklight/facet_field_list_component_spec.rb
|
777
780
|
- spec/components/blacklight/facet_item_component_spec.rb
|
778
781
|
- spec/components/blacklight/facet_item_pivot_component_spec.rb
|
782
|
+
- spec/components/blacklight/header_component_spec.rb
|
779
783
|
- spec/components/blacklight/hidden_search_state_component_spec.rb
|
780
784
|
- spec/components/blacklight/metadata_field_component_spec.rb
|
781
785
|
- spec/components/blacklight/response/spellcheck_component_spec.rb
|
@@ -927,11 +931,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
927
931
|
version: '2.7'
|
928
932
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
929
933
|
requirements:
|
930
|
-
- - "
|
934
|
+
- - ">="
|
931
935
|
- !ruby/object:Gem::Version
|
932
|
-
version:
|
936
|
+
version: '0'
|
933
937
|
requirements: []
|
934
|
-
rubygems_version: 3.
|
938
|
+
rubygems_version: 3.4.12
|
935
939
|
signing_key:
|
936
940
|
specification_version: 4
|
937
941
|
summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
|
@@ -942,6 +946,7 @@ test_files:
|
|
942
946
|
- spec/components/blacklight/constraints_component_spec.rb
|
943
947
|
- spec/components/blacklight/document/action_component_spec.rb
|
944
948
|
- spec/components/blacklight/document/group_component_spec.rb
|
949
|
+
- spec/components/blacklight/document/sidebar_component_spec.rb
|
945
950
|
- spec/components/blacklight/document_component_spec.rb
|
946
951
|
- spec/components/blacklight/document_metadata_component_spec.rb
|
947
952
|
- spec/components/blacklight/facet_component_spec.rb
|
@@ -949,6 +954,7 @@ test_files:
|
|
949
954
|
- spec/components/blacklight/facet_field_list_component_spec.rb
|
950
955
|
- spec/components/blacklight/facet_item_component_spec.rb
|
951
956
|
- spec/components/blacklight/facet_item_pivot_component_spec.rb
|
957
|
+
- spec/components/blacklight/header_component_spec.rb
|
952
958
|
- spec/components/blacklight/hidden_search_state_component_spec.rb
|
953
959
|
- spec/components/blacklight/metadata_field_component_spec.rb
|
954
960
|
- spec/components/blacklight/response/spellcheck_component_spec.rb
|