blacklight-spotlight 3.4.2.1 → 3.4.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 794f8a576fd41d5dbaf29291a7becae3a6e2d813ffd607d4e9d40f101f1f8f49
4
- data.tar.gz: 49d0a55f747b3c554f973676552b1f7568f75b2e1cdc42c8fb30fa0c246516ff
3
+ metadata.gz: bc4256e20e17471f8ae0899662bb9b3560c76571bd9543c58ff55e5a921d2574
4
+ data.tar.gz: 93e66e16c4d6b556ab95752444f3990d5ce1e2e3b0bc4c7d396e1ae0c6003ce9
5
5
  SHA512:
6
- metadata.gz: fe49b3279ffc22c85273eeca2c84f0853f6b78bd8147b4f639b72e116835e09cd48add6d9bf4576c28856e16998bda0e164f6db41bd877a52b0e2ca903e1f7ff
7
- data.tar.gz: 4361e42c40cfde449e7a2a7a3ed6331379b51acb4c6c9d56bb6a0502233109193cbeea8a4903873638bd02d9c507306294b405ccf5a0eaccbdeaf3b1bd00e390
6
+ metadata.gz: 9ee7e5be23d75b7fffcaa81856222bddd90e67c09f67394b730221fbf84fe6dba5ebf77c830755ba0e77c7584c871c505ef93dc96306368577be6beb9e098b96
7
+ data.tar.gz: 0bc0941b6b371c2c7c2dc33439eccd2c9fc07a3d8a97aa0597822ec025da2e2b5f6e5a0718a26c9df46cbc0cffffbd322cc557ac5e05568dcefe24be74d5734c
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spotlight
4
- VERSION = '3.4.2.1'
4
+ VERSION = '3.4.2.2'
5
5
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Controllers
4
+ module EngineHelpers
5
+ def main_app
6
+ Rails.application.class.routes.url_helpers
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR <= 1
4
+ default_deprecation_behaviours = ActiveSupport::Deprecation.behavior
5
+ ActiveSupport::Deprecation.behavior = lambda do |message, callstack|
6
+ unless callstack.find { |l| l.path =~ %r{gems/friendly_id} } &&
7
+ message =~ /The behavior of .* inside of after callbacks will be changing/
8
+ default_deprecation_behaviours.each { |b| b.call(message, callstack) }
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CapybaraDefaultMaxWaitMetadataHelper
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ before do |example|
8
+ next unless example.metadata[:default_max_wait_time]
9
+
10
+ @previous_wait_time = Capybara.default_max_wait_time
11
+ Capybara.default_max_wait_time = example.metadata[:default_max_wait_time]
12
+ end
13
+
14
+ after do |example|
15
+ next unless example.metadata[:default_max_wait_time]
16
+
17
+ Capybara.default_max_wait_time = @previous_wait_time
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,92 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spotlight
4
+ module TestFeaturesHelpers
5
+ def fill_in_typeahead_field(opts = {})
6
+ type = opts[:type] || 'twitter'
7
+ # Poltergeist / Capybara doesn't fire the events typeahead.js
8
+ # is listening for, so we help it out a little:
9
+ page.execute_script <<-EOF
10
+ $("[data-#{type}-typeahead]:visible").val("#{opts[:with]}").trigger("input");
11
+ $("[data-#{type}-typeahead]:visible").typeahead("open");
12
+ $(".tt-suggestion").click();
13
+ EOF
14
+
15
+ find('.tt-suggestion', text: opts[:with], match: :first).click
16
+ end
17
+
18
+ ##
19
+ # For typeahead "prefetched" fields, we need to wait for a resolved selector
20
+ # before proceeding.
21
+ def fill_in_prefetched_typeahead_field(opts)
22
+ type = opts[:type] || 'twitter'
23
+ # Poltergeist / Capybara doesn't fire the events typeahead.js
24
+ # is listening for, so we help it out a little:
25
+ find(opts[:wait_for]) if opts[:wait_for]
26
+ page.execute_script <<-EOF
27
+ $("[data-#{type}-typeahead]:visible").val("#{opts[:with]}").trigger("input");
28
+ $("[data-#{type}-typeahead]:visible").typeahead("open");
29
+ $(".tt-suggestion").click();
30
+ EOF
31
+ end
32
+
33
+ # just like #fill_in_typeahead_field, but wait for the
34
+ # form fields to show up on the page too
35
+ def fill_in_solr_document_block_typeahead_field(opts)
36
+ fill_in_typeahead_field(opts)
37
+ expect(page).to have_css('li[data-resource-id="' + opts[:with] + '"]')
38
+ end
39
+
40
+ def add_widget(type)
41
+ click_add_widget
42
+
43
+ # click the item + image widget
44
+ expect(page).to have_css("button[data-type='#{type}']")
45
+ find("button[data-type='#{type}']").click
46
+ end
47
+
48
+ def click_add_widget
49
+ unless all('.st-block-replacer').present?
50
+ expect(page).to have_css('.st-block-addition')
51
+ first('.st-block-addition').click
52
+ end
53
+ expect(page).to have_css('.st-block-replacer')
54
+ first('.st-block-replacer').click
55
+ end
56
+
57
+ def save_page
58
+ page.execute_script <<-EOF
59
+ SirTrevor.getInstance().onFormSubmit();
60
+ EOF
61
+ click_button('Save changes')
62
+ # verify that the page was created
63
+ expect(page).not_to have_selector('.alert-danger')
64
+ expect(page).to have_selector('.alert-info', text: 'page was successfully updated')
65
+ end
66
+
67
+ RSpec::Matchers.define :have_breadcrumbs do |*expected|
68
+ match do |actual|
69
+ errors = []
70
+ errors << 'Unable to find breadcrumbs' unless actual.has_css? '.breadcrumb'
71
+
72
+ breadcrumbs = expected.dup
73
+
74
+ actual.within('.breadcrumb') do
75
+ last = breadcrumbs.pop
76
+ breadcrumbs.each do |e|
77
+ errors << "Unable to find breadcrumb #{e}" unless actual.has_link? e
78
+ end
79
+
80
+ errors << "Unable to find breadcrumb #{last}" unless actual.has_content? last
81
+ errors << "Expected #{last} not to be a link" if actual.has_link? last
82
+ end
83
+
84
+ errors.empty?
85
+ end
86
+
87
+ failure_message do |actual|
88
+ "expected that #{actual.all('.breadcrumb li').map(&:text).join(' / ')} would include #{expected.join(' / ')}"
89
+ end
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ControllerLevelHelpers
4
+ def search_state
5
+ @search_state ||= Blacklight::SearchState.new(params, blacklight_config)
6
+ end
7
+
8
+ def current_site
9
+ Spotlight::Site.instance
10
+ end
11
+
12
+ def blacklight_configuration_context
13
+ @blacklight_configuration_context ||= Blacklight::Configuration::Context.new(controller)
14
+ end
15
+
16
+ def initialize_controller_helpers(helper)
17
+ helper.extend ControllerLevelHelpers
18
+ initialize_routing_helpers(helper)
19
+ end
20
+
21
+ def initialize_routing_helpers(helper)
22
+ helper.class.include ::Rails.application.routes.url_helpers
23
+ helper.class.include ::Rails.application.routes.mounted_helpers if ::Rails.application.routes.respond_to?(:mounted_helpers)
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fixtures/iiif_responses'
4
+ module StubIiifResponse
5
+ def stub_iiif_response_for_url(url, response)
6
+ allow(Spotlight::Resources::IiifService).to receive(:iiif_response).with(url).and_return(response)
7
+ end
8
+
9
+ def stub_default_collection
10
+ allow_any_instance_of(Spotlight::Resources::IiifHarvester).to receive_messages(url_is_iiif?: true)
11
+ stub_iiif_response_for_url('uri://for-top-level-collection', complex_collection)
12
+ stub_iiif_response_for_url('uri://for-child-collection1', child_collection1)
13
+ stub_iiif_response_for_url('uri://for-child-collection2', child_collection2)
14
+ stub_iiif_response_for_url('uri://for-child-collection3', child_collection3)
15
+
16
+ stub_iiif_response_for_url('uri://for-manifest1', test_manifest1)
17
+ stub_iiif_response_for_url('uri://for-manifest2', test_manifest2)
18
+ stub_iiif_response_for_url('uri://for-manifest3', test_manifest3)
19
+ stub_iiif_response_for_url('uri://for-manifest4', test_manifest4)
20
+ end
21
+ end
22
+
23
+ RSpec.configure do |config|
24
+ config.include IiifResponses
25
+ config.include StubIiifResponse
26
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spotlight
4
+ module TestViewHelpers
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ before do
9
+ view.send(:extend, Spotlight::RenderingHelper)
10
+ view.send(:extend, Spotlight::MainAppHelpers)
11
+ view.send(:extend, Spotlight::CrudLinkHelpers)
12
+ view.send(:extend, Spotlight::TitleHelper)
13
+ view.send(:extend, Spotlight::NavbarHelper)
14
+ view.send(:extend, Spotlight::CropHelper)
15
+ view.send(:extend, Spotlight::PagesHelper)
16
+ view.send(:extend, Blacklight::ComponentHelperBehavior)
17
+ view.send(:extend, BreadcrumbsOnRails::ActionController::HelperMethods)
18
+ end
19
+ end
20
+ end
21
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight-spotlight
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.2.1
4
+ version: 3.4.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
@@ -1604,6 +1604,13 @@ files:
1604
1604
  - spec/fixtures/updated-bulk-update-template-no-cols.csv
1605
1605
  - spec/fixtures/updated-bulk-update-template-w-tags.csv
1606
1606
  - spec/fixtures/updated-bulk-update-template.csv
1607
+ - spec/support/controllers/engine_helpers.rb
1608
+ - spec/support/disable_friendly_id_deprecation_warnings.rb
1609
+ - spec/support/features/capybara_default_max_wait_metadata_helper.rb
1610
+ - spec/support/features/test_features_helpers.rb
1611
+ - spec/support/helpers/controller_level_helpers.rb
1612
+ - spec/support/stub_iiif_response.rb
1613
+ - spec/support/views/test_view_helpers.rb
1607
1614
  - vendor/assets/images/sir-trevor-icons.svg
1608
1615
  - vendor/assets/javascripts/Leaflet.Editable.js
1609
1616
  - vendor/assets/javascripts/MutationObserver.js