blacklight-spotlight 3.4.1 → 3.4.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spotlight/version.rb +1 -1
- data/spec/factories/bulk_updates.rb +21 -0
- data/spec/factories/contact_emails.rb +8 -0
- data/spec/factories/contact_images.rb +8 -0
- data/spec/factories/contacts.rb +11 -0
- data/spec/factories/custom_fields.rb +9 -0
- data/spec/factories/custom_search_fields.rb +9 -0
- data/spec/factories/exhibit_thumbnails.rb +8 -0
- data/spec/factories/exhibits.rb +17 -0
- data/spec/factories/featured_images.rb +16 -0
- data/spec/factories/group.rb +17 -0
- data/spec/factories/job_trackers.rb +11 -0
- data/spec/factories/language.rb +8 -0
- data/spec/factories/main_navigation.rb +9 -0
- data/spec/factories/pages.rb +34 -0
- data/spec/factories/resources.rb +14 -0
- data/spec/factories/roles.rb +9 -0
- data/spec/factories/searches.rb +33 -0
- data/spec/factories/tags.rb +14 -0
- data/spec/factories/translation.rb +8 -0
- data/spec/factories/users.rb +50 -0
- data/spec/fixtures/800x600.png +0 -0
- data/spec/fixtures/avatar.png +0 -0
- data/spec/fixtures/bulk-update-template.csv +57 -0
- data/spec/fixtures/csv-upload-fixture.csv +4 -0
- data/spec/fixtures/gk446cj2442-manifest.json +58 -0
- data/spec/fixtures/iiif_responses.rb +312 -0
- data/spec/fixtures/json-upload-fixture.json +3 -0
- data/spec/fixtures/sample_solr_documents.yml +9385 -0
- data/spec/fixtures/updated-bulk-update-template-no-cols.csv +4 -0
- data/spec/fixtures/updated-bulk-update-template-w-tags.csv +4 -0
- data/spec/fixtures/updated-bulk-update-template.csv +4 -0
- data/spec/support/controllers/engine_helpers.rb +9 -0
- data/spec/support/disable_friendly_id_deprecation_warnings.rb +11 -0
- data/spec/support/features/capybara_default_max_wait_metadata_helper.rb +20 -0
- data/spec/support/features/test_features_helpers.rb +92 -0
- data/spec/support/helpers/controller_level_helpers.rb +25 -0
- data/spec/support/stub_iiif_response.rb +26 -0
- data/spec/support/views/test_view_helpers.rb +21 -0
- metadata +39 -1
@@ -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.
|
4
|
+
version: 3.4.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
@@ -1573,6 +1573,44 @@ files:
|
|
1573
1573
|
- lib/spotlight/upload_field_config.rb
|
1574
1574
|
- lib/spotlight/version.rb
|
1575
1575
|
- lib/tasks/spotlight_tasks.rake
|
1576
|
+
- spec/factories/bulk_updates.rb
|
1577
|
+
- spec/factories/contact_emails.rb
|
1578
|
+
- spec/factories/contact_images.rb
|
1579
|
+
- spec/factories/contacts.rb
|
1580
|
+
- spec/factories/custom_fields.rb
|
1581
|
+
- spec/factories/custom_search_fields.rb
|
1582
|
+
- spec/factories/exhibit_thumbnails.rb
|
1583
|
+
- spec/factories/exhibits.rb
|
1584
|
+
- spec/factories/featured_images.rb
|
1585
|
+
- spec/factories/group.rb
|
1586
|
+
- spec/factories/job_trackers.rb
|
1587
|
+
- spec/factories/language.rb
|
1588
|
+
- spec/factories/main_navigation.rb
|
1589
|
+
- spec/factories/pages.rb
|
1590
|
+
- spec/factories/resources.rb
|
1591
|
+
- spec/factories/roles.rb
|
1592
|
+
- spec/factories/searches.rb
|
1593
|
+
- spec/factories/tags.rb
|
1594
|
+
- spec/factories/translation.rb
|
1595
|
+
- spec/factories/users.rb
|
1596
|
+
- spec/fixtures/800x600.png
|
1597
|
+
- spec/fixtures/avatar.png
|
1598
|
+
- spec/fixtures/bulk-update-template.csv
|
1599
|
+
- spec/fixtures/csv-upload-fixture.csv
|
1600
|
+
- spec/fixtures/gk446cj2442-manifest.json
|
1601
|
+
- spec/fixtures/iiif_responses.rb
|
1602
|
+
- spec/fixtures/json-upload-fixture.json
|
1603
|
+
- spec/fixtures/sample_solr_documents.yml
|
1604
|
+
- spec/fixtures/updated-bulk-update-template-no-cols.csv
|
1605
|
+
- spec/fixtures/updated-bulk-update-template-w-tags.csv
|
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
|
1576
1614
|
- vendor/assets/images/sir-trevor-icons.svg
|
1577
1615
|
- vendor/assets/javascripts/Leaflet.Editable.js
|
1578
1616
|
- vendor/assets/javascripts/MutationObserver.js
|