blacklight 7.13.2 → 7.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +23 -3
- data/README.md +1 -1
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight/blacklight.js +4 -2
- data/app/components/blacklight/constraints_component.rb +7 -1
- data/app/components/blacklight/document/thumbnail_component.html.erb +1 -1
- data/app/components/blacklight/document/thumbnail_component.rb +1 -1
- data/app/components/blacklight/hidden_search_state_component.rb +54 -0
- data/app/helpers/blacklight/component_helper_behavior.rb +1 -1
- data/app/helpers/blacklight/hash_as_hidden_fields_helper_behavior.rb +2 -38
- data/app/helpers/blacklight/icon_helper_behavior.rb +1 -1
- data/app/javascript/blacklight/button_focus.js +1 -0
- data/app/javascript/blacklight/modal.js +10 -4
- data/app/presenters/blacklight/facet_item_presenter.rb +1 -1
- data/app/views/bookmarks/_tools.html.erb +1 -1
- data/blacklight.gemspec +5 -4
- data/package.json +1 -1
- data/spec/components/blacklight/constraint_layout_component_spec.rb +1 -1
- data/spec/components/blacklight/document_component_spec.rb +2 -0
- data/spec/components/blacklight/hidden_search_state_component_spec.rb +24 -0
- data/spec/features/facets_spec.rb +2 -17
- data/spec/features/search_filters_spec.rb +0 -20
- data/spec/helpers/blacklight/hash_as_hidden_fields_behavior_spec.rb +1 -0
- data/spec/helpers/blacklight/url_helper_behavior_spec.rb +1 -0
- data/spec/models/blacklight/solr/response/facets_spec.rb +1 -1
- data/spec/spec_helper.rb +8 -3
- data/spec/test_app_templates/Gemfile.extra +1 -1
- data/spec/views/catalog/_document.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_thumbnail.html.erb_spec.rb +2 -0
- metadata +44 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 125e5713e43315d9fdbae35677048bb1a1bb9830970f8ff43101ecaed9979385
|
4
|
+
data.tar.gz: 34d83a1474edd010642bc2ddf9f72a5409dd66f80bd28f3e6576fafdaa119475
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab411c9cd2690a01b3d61fa1c8f602b910686b920e26ac638eddfb08e4b43af86d6beca036509056f510a2d56041059dadcfa0ee92cccedcbe238bfe5d7abc4b
|
7
|
+
data.tar.gz: ed2cea2667023dbe7720c4939f4dc4b3cd98d26be0e7a1bc89dba416d0b077bf3792b810fe9e479ef5890f2cad3b3003154822778722b5528051df106f570e51
|
data/.github/workflows/ruby.yml
CHANGED
@@ -30,7 +30,7 @@ jobs:
|
|
30
30
|
runs-on: ubuntu-latest
|
31
31
|
strategy:
|
32
32
|
matrix:
|
33
|
-
ruby: [2.
|
33
|
+
ruby: [2.7, 3.0]
|
34
34
|
steps:
|
35
35
|
- uses: actions/checkout@v2
|
36
36
|
- name: Set up Ruby
|
@@ -43,11 +43,31 @@ jobs:
|
|
43
43
|
run: bundle exec rake ci
|
44
44
|
env:
|
45
45
|
ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test'
|
46
|
-
|
46
|
+
test_rails6_0:
|
47
47
|
runs-on: ubuntu-latest
|
48
48
|
strategy:
|
49
49
|
matrix:
|
50
|
-
ruby: [2.
|
50
|
+
ruby: [2.6]
|
51
|
+
steps:
|
52
|
+
- uses: actions/checkout@v2
|
53
|
+
- name: Set up Ruby
|
54
|
+
uses: ruby/setup-ruby@v1
|
55
|
+
with:
|
56
|
+
ruby-version: ${{ matrix.ruby }}
|
57
|
+
- name: Install dependencies
|
58
|
+
run: bundle install
|
59
|
+
env:
|
60
|
+
RAILS_VERSION: 6.0.3.4
|
61
|
+
- name: Run tests
|
62
|
+
run: bundle exec rake ci
|
63
|
+
env:
|
64
|
+
RAILS_VERSION: 6.0.3.4
|
65
|
+
ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test'
|
66
|
+
test_rails5_2:
|
67
|
+
runs-on: ubuntu-latest
|
68
|
+
strategy:
|
69
|
+
matrix:
|
70
|
+
ruby: [2.5]
|
51
71
|
steps:
|
52
72
|
- uses: actions/checkout@v2
|
53
73
|
- name: Set up Ruby
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Blacklight
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.
|
3
|
+
[![Build Status](https://travis-ci.com/projectblacklight/blacklight.png?branch=master)](https://travis-ci.com/projectblacklight/blacklight) [![Gem Version](https://badge.fury.io/rb/blacklight.png)](http://badge.fury.io/rb/blacklight) [![Test Coverage](https://api.codeclimate.com/v1/badges/83fd270492c136594e59/test_coverage)](https://codeclimate.com/github/projectblacklight/blacklight/test_coverage)
|
4
4
|
|
5
5
|
Blacklight is an open source Solr user interface discovery platform.
|
6
6
|
You can use Blacklight to enable searching and browsing of your collections.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.
|
1
|
+
7.14.0
|
@@ -99,6 +99,7 @@ Blacklight.onLoad(function () {
|
|
99
99
|
Blacklight.onLoad(function () {
|
100
100
|
// Button clicks should change focus. As of 10/3/19, Firefox for Mac and
|
101
101
|
// Safari both do not set focus to a button on button click.
|
102
|
+
// See https://zellwk.com/blog/inconsistent-button-behavior/ for background information
|
102
103
|
document.querySelectorAll('button.collapse-toggle').forEach(button => {
|
103
104
|
button.addEventListener('click', () => {
|
104
105
|
event.target.focus();
|
@@ -349,8 +350,9 @@ Blacklight.modal.modalCloseSelector = '[data-blacklight-modal~=close]'; // Calle
|
|
349
350
|
// to show to user in modal. Right now called only for extreme
|
350
351
|
// network errors.
|
351
352
|
|
352
|
-
Blacklight.modal.onFailure = function (
|
353
|
-
|
353
|
+
Blacklight.modal.onFailure = function (jqXHR, textStatus, errorThrown) {
|
354
|
+
console.error('Server error:', this.url, jqXHR.status, errorThrown);
|
355
|
+
var contents = '<div class="modal-header">' + '<div class="modal-title">There was a problem with your request.</div>' + '<button type="button" class="blacklight-modal-close close" data-dismiss="modal" aria-label="Close">' + ' <span aria-hidden="true">×</span>' + '</button></div>' + ' <div class="modal-body"><p>Expected a successful response from the server, but got an error</p>' + '<pre>' + this.type + ' ' + this.url + "\n" + jqXHR.status + ': ' + errorThrown + '</pre></div>';
|
354
356
|
$(Blacklight.modal.modalSelector).find('.modal-content').html(contents);
|
355
357
|
$(Blacklight.modal.modalSelector).modal('show');
|
356
358
|
};
|
@@ -22,7 +22,7 @@ module Blacklight
|
|
22
22
|
@query_constraint_component.new(
|
23
23
|
search_state: @search_state,
|
24
24
|
value: @search_state.query_param,
|
25
|
-
label:
|
25
|
+
label: label,
|
26
26
|
remove_path: @view_context.remove_constraint_url(@search_state),
|
27
27
|
classes: 'query'
|
28
28
|
)
|
@@ -46,6 +46,12 @@ module Blacklight
|
|
46
46
|
|
47
47
|
private
|
48
48
|
|
49
|
+
def label
|
50
|
+
Deprecation.silence(Blacklight::ConfigurationHelperBehavior) do
|
51
|
+
@view_context.constraint_query_label(@search_state.params)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
49
55
|
def facet_item_presenters
|
50
56
|
Deprecation.silence(Blacklight::SearchState) do
|
51
57
|
@search_state.filter_params.each_pair.flat_map do |facet, values|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<% warn_about_deprecated_behavior %>
|
7
7
|
<%= value %>
|
8
8
|
<% else %>
|
9
|
-
<%=
|
9
|
+
<%= helpers.link_to_document(@presenter.document, value, 'aria-hidden': true, tabindex: -1, counter: @counter) %>
|
10
10
|
<% end %>
|
11
11
|
</div>
|
12
12
|
<% end %>
|
@@ -10,7 +10,7 @@ module Blacklight
|
|
10
10
|
def initialize(presenter:, counter:)
|
11
11
|
@presenter = presenter
|
12
12
|
@counter = counter
|
13
|
-
@use_thumbnail_tag =
|
13
|
+
@use_thumbnail_tag = !@presenter.thumbnail.instance_of?(Blacklight::ThumbnailPresenter)
|
14
14
|
end
|
15
15
|
|
16
16
|
def render?
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Blacklight
|
4
|
+
# Writes out zero or more <input type="hidden"> elements, completely
|
5
|
+
# representing a hash passed in using Rails-style request parameters
|
6
|
+
# for hashes nested with arrays and other hashes.
|
7
|
+
class HiddenSearchStateComponent < ::ViewComponent::Base
|
8
|
+
# @param [Hash] hash
|
9
|
+
def initialize(params:)
|
10
|
+
Deprecation.warn(self, "Passing page as a parameter to HiddenSearchStateComponent is deprecated and will not be supported in Blacklight 8") if params.key?(:page)
|
11
|
+
@params = params.except(:utf8)
|
12
|
+
end
|
13
|
+
|
14
|
+
def call
|
15
|
+
hidden_fields = []
|
16
|
+
flatten_hash(@params).each do |name, value|
|
17
|
+
value = Array.wrap(value)
|
18
|
+
value.each do |v|
|
19
|
+
hidden_fields << hidden_field_tag(name, v.to_s, id: nil)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
safe_join(hidden_fields, "\n")
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def flatten_hash(hash = params, ancestor_names = [])
|
29
|
+
flat_hash = {}
|
30
|
+
hash.each do |k, v|
|
31
|
+
names = Array.new(ancestor_names)
|
32
|
+
names << k
|
33
|
+
if v.is_a?(Hash)
|
34
|
+
flat_hash.merge!(flatten_hash(v, names))
|
35
|
+
else
|
36
|
+
key = flat_hash_key(names)
|
37
|
+
key += "[]" if v.is_a?(Array)
|
38
|
+
flat_hash[key] = v
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
flat_hash
|
43
|
+
end
|
44
|
+
|
45
|
+
def flat_hash_key(names)
|
46
|
+
names = Array.new(names)
|
47
|
+
name = names.shift.to_s.dup
|
48
|
+
names.each do |n|
|
49
|
+
name << "[#{n}]"
|
50
|
+
end
|
51
|
+
name
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -10,7 +10,7 @@ module Blacklight
|
|
10
10
|
deprecation_deprecate :document_action_label
|
11
11
|
|
12
12
|
# @deprecated
|
13
|
-
def document_action_path action_opts, url_opts =
|
13
|
+
def document_action_path action_opts, url_opts = {}
|
14
14
|
if action_opts.path
|
15
15
|
send(action_opts.path, url_opts)
|
16
16
|
elsif url_opts[:id].class.respond_to?(:model_name)
|
@@ -21,43 +21,7 @@ module Blacklight::HashAsHiddenFieldsHelperBehavior
|
|
21
21
|
# @param [Hash] hash
|
22
22
|
# @return [String]
|
23
23
|
def render_hash_as_hidden_fields(hash)
|
24
|
-
|
25
|
-
flatten_hash(hash).each do |name, value|
|
26
|
-
value = Array.wrap(value)
|
27
|
-
value.each do |v|
|
28
|
-
hidden_fields << hidden_field_tag(name, v.to_s, id: nil)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
safe_join(hidden_fields, "\n")
|
33
|
-
end
|
34
|
-
deprecation_deprecate render_hash_as_hidden_fields: 'Moving to a private method of Blacklight::SearchBarComponent'
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def flatten_hash(hash = params, ancestor_names = [])
|
39
|
-
flat_hash = {}
|
40
|
-
hash.each do |k, v|
|
41
|
-
names = Array.new(ancestor_names)
|
42
|
-
names << k
|
43
|
-
if v.is_a?(Hash)
|
44
|
-
flat_hash.merge!(flatten_hash(v, names))
|
45
|
-
else
|
46
|
-
key = flat_hash_key(names)
|
47
|
-
key += "[]" if v.is_a?(Array)
|
48
|
-
flat_hash[key] = v
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
flat_hash
|
53
|
-
end
|
54
|
-
|
55
|
-
def flat_hash_key(names)
|
56
|
-
names = Array.new(names)
|
57
|
-
name = names.shift.to_s.dup
|
58
|
-
names.each do |n|
|
59
|
-
name << "[#{n}]"
|
60
|
-
end
|
61
|
-
name
|
24
|
+
render Blacklight::HiddenSearchStateComponent.new(params: hash)
|
62
25
|
end
|
26
|
+
deprecation_deprecate render_hash_as_hidden_fields: 'Use Blacklight::HiddenSearchStateComponent instead'
|
63
27
|
end
|
@@ -12,7 +12,7 @@ module Blacklight::IconHelperBehavior
|
|
12
12
|
def blacklight_icon(icon_name, options = {})
|
13
13
|
Rails.cache.fetch([:blacklight_icons, icon_name, options]) do
|
14
14
|
icon = Blacklight::Icon.new(icon_name, **options)
|
15
|
-
tag.span(icon.svg.html_safe, icon.options)
|
15
|
+
tag.span(icon.svg.html_safe, **icon.options)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
Blacklight.onLoad(function() {
|
2
2
|
// Button clicks should change focus. As of 10/3/19, Firefox for Mac and
|
3
3
|
// Safari both do not set focus to a button on button click.
|
4
|
+
// See https://zellwk.com/blog/inconsistent-button-behavior/ for background information
|
4
5
|
document.querySelectorAll('button.collapse-toggle').forEach((button) => {
|
5
6
|
button.addEventListener('click', () => {
|
6
7
|
event.target.focus();
|
@@ -101,12 +101,18 @@ Blacklight.modal.modalCloseSelector = '[data-blacklight-modal~=close]';
|
|
101
101
|
// Called on fatal failure of ajax load, function returns content
|
102
102
|
// to show to user in modal. Right now called only for extreme
|
103
103
|
// network errors.
|
104
|
-
Blacklight.modal.onFailure = function(
|
105
|
-
|
106
|
-
|
104
|
+
Blacklight.modal.onFailure = function(jqXHR, textStatus, errorThrown) {
|
105
|
+
console.error('Server error:', this.url, jqXHR.status, errorThrown);
|
106
|
+
|
107
|
+
var contents = '<div class="modal-header">' +
|
108
|
+
'<div class="modal-title">There was a problem with your request.</div>' +
|
107
109
|
'<button type="button" class="blacklight-modal-close close" data-dismiss="modal" aria-label="Close">' +
|
108
110
|
' <span aria-hidden="true">×</span>' +
|
109
|
-
'</button>'
|
111
|
+
'</button></div>' +
|
112
|
+
' <div class="modal-body"><p>Expected a successful response from the server, but got an error</p>' +
|
113
|
+
'<pre>' +
|
114
|
+
this.type + ' ' + this.url + "\n" + jqXHR.status + ': ' + errorThrown +
|
115
|
+
'</pre></div>';
|
110
116
|
$(Blacklight.modal.modalSelector).find('.modal-content').html(contents);
|
111
117
|
$(Blacklight.modal.modalSelector).modal('show');
|
112
118
|
}
|
@@ -46,7 +46,7 @@ module Blacklight
|
|
46
46
|
facet_config.query[value][:label]
|
47
47
|
elsif facet_config.date
|
48
48
|
localization_options = facet_config.date == true ? {} : facet_config.date
|
49
|
-
I18n.l(Time.zone.parse(value), localization_options)
|
49
|
+
I18n.l(Time.zone.parse(value), **localization_options)
|
50
50
|
else
|
51
51
|
value
|
52
52
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% if render_show_doc_actions_method_from_blacklight? %>
|
2
|
-
<%= render(Blacklight::Document::ActionsComponent.new(document: nil, tag: 'ul', classes: "#{controller_name}Tools nav nav-pills", wrapping_tag: 'li', wrapping_classes: 'nav-item', actions: document_actions(document_list), options: { document_list: @response.documents }, url_opts: Blacklight::Parameters.sanitize(params.to_unsafe_h))) %>
|
2
|
+
<%= render(Blacklight::Document::ActionsComponent.new(document: nil, tag: 'ul', classes: "#{controller_name}Tools nav nav-pills", wrapping_tag: 'li', wrapping_classes: 'nav-item', actions: document_actions(document_list, options: { document: nil }), options: { document_list: @response.documents }, url_opts: Blacklight::Parameters.sanitize(params.to_unsafe_h))) %>
|
3
3
|
<% else %>
|
4
4
|
<% Deprecation.warn(self, '#render_show_doc_actions is deprecated; use ActionComponents instead') %>
|
5
5
|
<ul class="<%= controller_name %>Tools nav nav-pills">
|
data/blacklight.gemspec
CHANGED
@@ -23,22 +23,23 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
s.require_paths = ["lib"]
|
25
25
|
|
26
|
-
s.required_ruby_version = '
|
26
|
+
s.required_ruby_version = '>= 2.3'
|
27
27
|
|
28
28
|
s.add_dependency "rails", '>= 5.1', '< 7'
|
29
29
|
s.add_dependency "globalid"
|
30
30
|
s.add_dependency "jbuilder", '~> 2.7'
|
31
31
|
s.add_dependency "kaminari", ">= 0.15" # the pagination (page 1,2,3, etc..) of our search results
|
32
32
|
s.add_dependency "deprecation"
|
33
|
-
s.add_dependency "
|
33
|
+
s.add_dependency "i18n", '>= 1.7.0' # added named parameters
|
34
|
+
s.add_dependency "ostruct", '>= 0.3.2'
|
35
|
+
s.add_dependency "view_component", '>= 2.23.0'
|
34
36
|
|
35
37
|
s.add_development_dependency "rsolr", ">= 1.0.6", "< 3" # Library for interacting with rSolr.
|
36
38
|
s.add_development_dependency "rspec-rails", "~> 4.0.0.beta2"
|
37
39
|
s.add_development_dependency "rspec-its"
|
38
40
|
s.add_development_dependency "rspec-collection_matchers", ">= 1.0"
|
39
41
|
s.add_development_dependency "capybara", '~> 3'
|
40
|
-
s.add_development_dependency '
|
41
|
-
s.add_development_dependency "selenium-webdriver", '>= 3.13.1'
|
42
|
+
s.add_development_dependency 'apparition'
|
42
43
|
s.add_development_dependency 'engine_cart', '~> 2.1'
|
43
44
|
s.add_development_dependency "equivalent-xml"
|
44
45
|
s.add_development_dependency "simplecov"
|
data/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "blacklight-frontend",
|
3
3
|
"version": "7.10.0",
|
4
|
-
"description": "[![Build Status](https://travis-ci.
|
4
|
+
"description": "[![Build Status](https://travis-ci.com/projectblacklight/blacklight.png?branch=master)](https://travis-ci.com/projectblacklight/blacklight) [![Gem Version](https://badge.fury.io/rb/blacklight.png)](http://badge.fury.io/rb/blacklight) [![Coverage Status](https://coveralls.io/repos/github/projectblacklight/blacklight/badge.svg?branch=master)](https://coveralls.io/github/projectblacklight/blacklight?branch=master)",
|
5
5
|
"main": "app/assets/javascripts/blacklight",
|
6
6
|
"scripts": {
|
7
7
|
"js-compile-bundle": "shx cat app/javascript/blacklight/core.js app/javascript/blacklight/autocomplete.js app/javascript/blacklight/bookmark_toggle.js app/javascript/blacklight/button_focus.js app/javascript/blacklight/checkbox_submit.js app/javascript/blacklight/facet_load.js app/javascript/blacklight/modal.js app/javascript/blacklight/search_context.js | shx sed \"s/^(import|export).*//\" | babel --filename app/javascript/blacklight/blacklight.js > app/assets/javascripts/blacklight/blacklight.js"
|
@@ -33,6 +33,8 @@ RSpec.describe Blacklight::DocumentComponent, type: :component do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
before do
|
36
|
+
# Every call to view_context returns a different object. This ensures it stays stable.
|
37
|
+
allow(controller).to receive(:view_context).and_return(view_context)
|
36
38
|
allow(controller).to receive(:current_or_guest_user).and_return(User.new)
|
37
39
|
allow(controller).to receive(:blacklight_config).and_return(blacklight_config)
|
38
40
|
allow(view_context).to receive(:search_session).and_return({})
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.describe Blacklight::HiddenSearchStateComponent, type: :component do
|
4
|
+
subject(:render) { render_inline(instance) }
|
5
|
+
|
6
|
+
let(:params) do
|
7
|
+
{ q: "query",
|
8
|
+
search_field: "search_field",
|
9
|
+
per_page: 10,
|
10
|
+
extra_arbitrary_key: "arbitrary_value",
|
11
|
+
f: { field1: %w[a b], field2: ["z"] } }
|
12
|
+
end
|
13
|
+
let(:instance) { described_class.new(params: params) }
|
14
|
+
let(:generated) { Capybara::Node::Simple.new("<div>#{render.to_html}</div>") }
|
15
|
+
|
16
|
+
it "converts a hash with nested complex data to Rails-style hidden form fields" do
|
17
|
+
expect(generated).to have_selector("input[type='hidden'][name='q'][value='query']", visible: :hidden)
|
18
|
+
expect(generated).to have_selector("input[type='hidden'][name='per_page'][value='10']", visible: :hidden)
|
19
|
+
expect(generated).to have_selector("input[type='hidden'][name='extra_arbitrary_key'][value='arbitrary_value']", visible: :hidden)
|
20
|
+
expect(generated).to have_selector("input[type='hidden'][name='f[field2][]'][value='z']", visible: :hidden)
|
21
|
+
expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='a']", visible: :hidden)
|
22
|
+
expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='b']", visible: :hidden)
|
23
|
+
end
|
24
|
+
end
|
@@ -56,10 +56,6 @@ RSpec.describe "Facets" do
|
|
56
56
|
|
57
57
|
expect(page).to have_css('#facet-format', visible: false)
|
58
58
|
|
59
|
-
within('#facets .facets-header') do
|
60
|
-
page.find('button.navbar-toggler').click
|
61
|
-
end
|
62
|
-
|
63
59
|
page.find('h3.facet-field-heading button', text: 'Format').click
|
64
60
|
|
65
61
|
sleep(1) # let facet animation finish and wait for it to potentially re-collapse
|
@@ -70,14 +66,10 @@ RSpec.describe "Facets" do
|
|
70
66
|
it 'is able to expand pivot facets when javascript is enabled', js: true do
|
71
67
|
visit root_path
|
72
68
|
|
73
|
-
within('#facets .facets-header') do
|
74
|
-
page.find('button.navbar-toggler').click
|
75
|
-
end
|
76
|
-
|
77
69
|
page.find('h3.facet-field-heading button', text: 'Pivot Field').click
|
78
70
|
|
79
71
|
within '#facet-example_pivot_field' do
|
80
|
-
expect(page).to have_css('.facet-leaf-node', text:
|
72
|
+
expect(page).to have_css('.facet-leaf-node', text: "Book\t30")
|
81
73
|
expect(page).not_to have_css('.facet-select', text: 'Tibetan')
|
82
74
|
page.find('.facet-toggle-handle').click
|
83
75
|
click_link 'Tibetan'
|
@@ -88,15 +80,8 @@ RSpec.describe "Facets" do
|
|
88
80
|
end
|
89
81
|
|
90
82
|
describe 'heading button focus with Firefox' do
|
91
|
-
before do
|
92
|
-
Capybara.current_driver = :selenium_headless
|
93
|
-
end
|
94
|
-
|
95
|
-
after do
|
96
|
-
Capybara.current_driver = :rack_test
|
97
|
-
end
|
98
|
-
|
99
83
|
it 'changes to the button on button click in Firefox' do
|
84
|
+
pending 'Capybara::NotSupportedByDriverError: Capybara::Driver::Base#evaluate_script'
|
100
85
|
visit root_path
|
101
86
|
page.find('h3.facet-field-heading button', text: 'Format').click
|
102
87
|
focused_element_data_target = page.evaluate_script("document.activeElement")['data-target']
|
@@ -168,26 +168,16 @@ RSpec.describe "Facets" do
|
|
168
168
|
end
|
169
169
|
|
170
170
|
it "is collapsed when not selected", js: true do
|
171
|
-
skip("Test passes locally but not on Travis.") if ENV['TRAVIS']
|
172
171
|
visit root_path
|
173
172
|
|
174
|
-
within('#facets .facets-header') do
|
175
|
-
page.find('button.navbar-toggler').click
|
176
|
-
end
|
177
|
-
|
178
173
|
within(".blacklight-subject_ssim") do
|
179
174
|
expect(page).not_to have_selector(".card-body", visible: true)
|
180
175
|
end
|
181
176
|
end
|
182
177
|
|
183
178
|
it "expands when the heading button is clicked", js: true do
|
184
|
-
skip("Test passes locally but not on Travis.") if ENV['TRAVIS']
|
185
179
|
visit root_path
|
186
180
|
|
187
|
-
within('#facets .facets-header') do
|
188
|
-
page.find('button.navbar-toggler').click
|
189
|
-
end
|
190
|
-
|
191
181
|
within(".blacklight-subject_ssim") do
|
192
182
|
expect(page).not_to have_selector(".card-body", visible: true)
|
193
183
|
find(".card-header button").click
|
@@ -196,13 +186,8 @@ RSpec.describe "Facets" do
|
|
196
186
|
end
|
197
187
|
|
198
188
|
it "expands when the button is clicked", js: true do
|
199
|
-
skip("Test passes locally but not on Travis.") if ENV['TRAVIS']
|
200
189
|
visit root_path
|
201
190
|
|
202
|
-
within('#facets .facets-header') do
|
203
|
-
page.find('button.navbar-toggler').click
|
204
|
-
end
|
205
|
-
|
206
191
|
within(".blacklight-subject_ssim") do
|
207
192
|
expect(page).not_to have_selector(".card-body", visible: true)
|
208
193
|
find(".card-header").click
|
@@ -211,13 +196,8 @@ RSpec.describe "Facets" do
|
|
211
196
|
end
|
212
197
|
|
213
198
|
it "keeps selected facets expanded on page load", js: true do
|
214
|
-
skip("Test passes locally but not on Travis.") if ENV['TRAVIS']
|
215
199
|
visit root_path
|
216
200
|
|
217
|
-
within('#facets .facets-header') do
|
218
|
-
page.find('button.navbar-toggler').click
|
219
|
-
end
|
220
|
-
|
221
201
|
within(".blacklight-subject_ssim") do
|
222
202
|
page.find('h3.facet-field-heading', text: 'Topic').click
|
223
203
|
expect(page).to have_selector(".panel-collapse", visible: true)
|
@@ -14,6 +14,7 @@ RSpec.describe Blacklight::HashAsHiddenFieldsHelperBehavior do
|
|
14
14
|
let(:generated) { helper.render_hash_as_hidden_fields(params) }
|
15
15
|
|
16
16
|
it "converts a hash with nested complex data to Rails-style hidden form fields" do
|
17
|
+
allow(Deprecation).to receive(:warn)
|
17
18
|
expect(generated).to have_selector("input[type='hidden'][name='q'][value='query']", visible: false)
|
18
19
|
expect(generated).to have_selector("input[type='hidden'][name='per_page'][value='10']", visible: false)
|
19
20
|
expect(generated).to have_selector("input[type='hidden'][name='page'][value='5']", visible: false)
|
@@ -13,6 +13,7 @@ RSpec.describe Blacklight::UrlHelperBehavior do
|
|
13
13
|
let(:parameter_class) { ActionController::Parameters }
|
14
14
|
|
15
15
|
before do
|
16
|
+
allow(controller).to receive(:controller_name).and_return('test')
|
16
17
|
allow(helper).to receive(:search_action_path) do |*args|
|
17
18
|
search_catalog_url *args
|
18
19
|
end
|
@@ -109,7 +109,7 @@ RSpec.describe Blacklight::Solr::Response::Facets, api: true do
|
|
109
109
|
let(:facet) { { name: "foo", value: "bar", hits: 1 } }
|
110
110
|
|
111
111
|
before do
|
112
|
-
response.merge_facet(facet)
|
112
|
+
response.merge_facet(**facet)
|
113
113
|
end
|
114
114
|
|
115
115
|
context "facet does not already exist" do
|
data/spec/spec_helper.rb
CHANGED
@@ -20,12 +20,17 @@ require 'rspec/rails'
|
|
20
20
|
require 'rspec/its'
|
21
21
|
require 'rspec/collection_matchers'
|
22
22
|
require 'capybara/rspec'
|
23
|
-
require '
|
23
|
+
require 'capybara/apparition'
|
24
24
|
require 'equivalent-xml'
|
25
|
-
require 'webdrivers'
|
26
25
|
|
27
|
-
Capybara.javascript_driver = :
|
26
|
+
Capybara.javascript_driver = :apparition
|
28
27
|
Capybara.disable_animation = true
|
28
|
+
# Capybara.enable_aria_label = true
|
29
|
+
|
30
|
+
# Uncomment for a headed browser
|
31
|
+
# Capybara.register_driver :apparition do |app|
|
32
|
+
# Capybara::Apparition::Driver.new(app, headless: false)
|
33
|
+
# end
|
29
34
|
|
30
35
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
31
36
|
# in spec/support/ and its subdirectories.
|
@@ -1,2 +1,2 @@
|
|
1
1
|
gem 'rails-controller-testing'
|
2
|
-
gem 'thor', '~> 0.20'
|
2
|
+
gem 'thor', '~> 0.20' if /^5.[12]/.match?(ENV['RAILS_VERSION'])
|
@@ -5,6 +5,7 @@ RSpec.describe "catalog/_document" do
|
|
5
5
|
let(:blacklight_config) { Blacklight::Configuration.new }
|
6
6
|
|
7
7
|
before do
|
8
|
+
allow(controller).to receive(:controller_name).and_return('test')
|
8
9
|
allow(view).to receive(:render_grouped_response?).and_return(false)
|
9
10
|
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
|
10
11
|
assign(:response, instance_double(Blacklight::Solr::Response, start: 20))
|
@@ -16,6 +16,8 @@ RSpec.describe "catalog/_thumbnail" do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
before do
|
19
|
+
# Every call to view_context returns a different object. This ensures it stays stable.
|
20
|
+
allow(controller).to receive(:view_context).and_return(view)
|
19
21
|
allow(controller).to receive(:action_name).and_return('index')
|
20
22
|
assign :response, instance_double(Blacklight::Solr::Response, start: 0)
|
21
23
|
allow(view).to receive(:render_grouped_response?).and_return false
|
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: 7.
|
4
|
+
version: 7.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
@@ -14,10 +14,10 @@ authors:
|
|
14
14
|
- Dan Funk
|
15
15
|
- Naomi Dushay
|
16
16
|
- Justin Coyne
|
17
|
-
autorequire:
|
17
|
+
autorequire:
|
18
18
|
bindir: exe
|
19
19
|
cert_chain: []
|
20
|
-
date:
|
20
|
+
date: 2021-01-10 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|
@@ -95,20 +95,48 @@ dependencies:
|
|
95
95
|
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: i18n
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 1.7.0
|
105
|
+
type: :runtime
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 1.7.0
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: ostruct
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 0.3.2
|
119
|
+
type: :runtime
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.3.2
|
98
126
|
- !ruby/object:Gem::Dependency
|
99
127
|
name: view_component
|
100
128
|
requirement: !ruby/object:Gem::Requirement
|
101
129
|
requirements:
|
102
130
|
- - ">="
|
103
131
|
- !ruby/object:Gem::Version
|
104
|
-
version:
|
132
|
+
version: 2.23.0
|
105
133
|
type: :runtime
|
106
134
|
prerelease: false
|
107
135
|
version_requirements: !ruby/object:Gem::Requirement
|
108
136
|
requirements:
|
109
137
|
- - ">="
|
110
138
|
- !ruby/object:Gem::Version
|
111
|
-
version:
|
139
|
+
version: 2.23.0
|
112
140
|
- !ruby/object:Gem::Dependency
|
113
141
|
name: rsolr
|
114
142
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,33 +214,19 @@ dependencies:
|
|
186
214
|
- !ruby/object:Gem::Version
|
187
215
|
version: '3'
|
188
216
|
- !ruby/object:Gem::Dependency
|
189
|
-
name:
|
190
|
-
requirement: !ruby/object:Gem::Requirement
|
191
|
-
requirements:
|
192
|
-
- - "~>"
|
193
|
-
- !ruby/object:Gem::Version
|
194
|
-
version: '3.0'
|
195
|
-
type: :development
|
196
|
-
prerelease: false
|
197
|
-
version_requirements: !ruby/object:Gem::Requirement
|
198
|
-
requirements:
|
199
|
-
- - "~>"
|
200
|
-
- !ruby/object:Gem::Version
|
201
|
-
version: '3.0'
|
202
|
-
- !ruby/object:Gem::Dependency
|
203
|
-
name: selenium-webdriver
|
217
|
+
name: apparition
|
204
218
|
requirement: !ruby/object:Gem::Requirement
|
205
219
|
requirements:
|
206
220
|
- - ">="
|
207
221
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
222
|
+
version: '0'
|
209
223
|
type: :development
|
210
224
|
prerelease: false
|
211
225
|
version_requirements: !ruby/object:Gem::Requirement
|
212
226
|
requirements:
|
213
227
|
- - ">="
|
214
228
|
- !ruby/object:Gem::Version
|
215
|
-
version:
|
229
|
+
version: '0'
|
216
230
|
- !ruby/object:Gem::Dependency
|
217
231
|
name: engine_cart
|
218
232
|
requirement: !ruby/object:Gem::Requirement
|
@@ -415,6 +429,7 @@ files:
|
|
415
429
|
- app/components/blacklight/facet_field_pagination_component.rb
|
416
430
|
- app/components/blacklight/facet_item_component.rb
|
417
431
|
- app/components/blacklight/facet_item_pivot_component.rb
|
432
|
+
- app/components/blacklight/hidden_search_state_component.rb
|
418
433
|
- app/components/blacklight/metadata_field_component.html.erb
|
419
434
|
- app/components/blacklight/metadata_field_component.rb
|
420
435
|
- app/components/blacklight/metadata_field_layout_component.html.erb
|
@@ -712,6 +727,7 @@ files:
|
|
712
727
|
- spec/components/blacklight/facet_field_list_component_spec.rb
|
713
728
|
- spec/components/blacklight/facet_item_component_spec.rb
|
714
729
|
- spec/components/blacklight/facet_item_pivot_component_spec.rb
|
730
|
+
- spec/components/blacklight/hidden_search_state_component_spec.rb
|
715
731
|
- spec/components/blacklight/metadata_field_component_spec.rb
|
716
732
|
- spec/components/blacklight/system/flash_message_component_spec.rb
|
717
733
|
- spec/controllers/alternate_controller_spec.rb
|
@@ -848,23 +864,23 @@ homepage: http://projectblacklight.org/
|
|
848
864
|
licenses:
|
849
865
|
- Apache 2.0
|
850
866
|
metadata: {}
|
851
|
-
post_install_message:
|
867
|
+
post_install_message:
|
852
868
|
rdoc_options: []
|
853
869
|
require_paths:
|
854
870
|
- lib
|
855
871
|
required_ruby_version: !ruby/object:Gem::Requirement
|
856
872
|
requirements:
|
857
|
-
- - "
|
873
|
+
- - ">="
|
858
874
|
- !ruby/object:Gem::Version
|
859
|
-
version: '2.
|
875
|
+
version: '2.3'
|
860
876
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
861
877
|
requirements:
|
862
878
|
- - ">="
|
863
879
|
- !ruby/object:Gem::Version
|
864
880
|
version: '0'
|
865
881
|
requirements: []
|
866
|
-
rubygems_version: 3.
|
867
|
-
signing_key:
|
882
|
+
rubygems_version: 3.2.3
|
883
|
+
signing_key:
|
868
884
|
specification_version: 4
|
869
885
|
summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
|
870
886
|
index.
|
@@ -877,6 +893,7 @@ test_files:
|
|
877
893
|
- spec/components/blacklight/facet_field_list_component_spec.rb
|
878
894
|
- spec/components/blacklight/facet_item_component_spec.rb
|
879
895
|
- spec/components/blacklight/facet_item_pivot_component_spec.rb
|
896
|
+
- spec/components/blacklight/hidden_search_state_component_spec.rb
|
880
897
|
- spec/components/blacklight/metadata_field_component_spec.rb
|
881
898
|
- spec/components/blacklight/system/flash_message_component_spec.rb
|
882
899
|
- spec/controllers/alternate_controller_spec.rb
|