blacklight-spotlight 2.0.2 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spotlight/edit_in_place.js +8 -1
  3. data/app/helpers/spotlight/pages_helper.rb +4 -0
  4. data/app/models/spotlight/blacklight_configuration.rb +12 -9
  5. data/app/models/spotlight/page_configurations.rb +93 -0
  6. data/app/services/spotlight/clone_translated_page_from_locale.rb +2 -4
  7. data/app/views/spotlight/pages/_form.html.erb +1 -12
  8. data/lib/generators/spotlight/install_generator.rb +1 -11
  9. data/lib/generators/spotlight/scaffold_resource_generator.rb +1 -1
  10. data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +5 -0
  11. data/lib/spotlight/engine.rb +4 -0
  12. data/lib/spotlight/version.rb +1 -1
  13. data/spec/controllers/spotlight/about_pages_controller_spec.rb +6 -0
  14. data/spec/controllers/spotlight/admin_users_controller_spec.rb +2 -0
  15. data/spec/controllers/spotlight/browse_controller_spec.rb +2 -0
  16. data/spec/controllers/spotlight/catalog_controller_spec.rb +5 -0
  17. data/spec/controllers/spotlight/confirmations_controller_spec.rb +1 -0
  18. data/spec/controllers/spotlight/contact_forms_controller_spec.rb +1 -0
  19. data/spec/controllers/spotlight/contacts_controller_spec.rb +4 -0
  20. data/spec/controllers/spotlight/dashboards_controller_spec.rb +2 -1
  21. data/spec/controllers/spotlight/feature_pages_controller_spec.rb +2 -0
  22. data/spec/controllers/spotlight/filters_controller_spec.rb +2 -0
  23. data/spec/controllers/spotlight/home_pages_controller_spec.rb +2 -0
  24. data/spec/controllers/spotlight/languages_controller_spec.rb +2 -0
  25. data/spec/controllers/spotlight/pages_controller_spec.rb +1 -0
  26. data/spec/controllers/spotlight/resources/csv_upload_controller_spec.rb +1 -1
  27. data/spec/controllers/spotlight/resources/upload_controller_spec.rb +1 -1
  28. data/spec/controllers/spotlight/roles_controller_spec.rb +2 -0
  29. data/spec/controllers/spotlight/searches_controller_spec.rb +2 -0
  30. data/spec/controllers/spotlight/sites_controller_spec.rb +1 -0
  31. data/spec/controllers/spotlight/solr_controller_spec.rb +1 -0
  32. data/spec/controllers/spotlight/tags_controller_spec.rb +2 -0
  33. data/spec/controllers/spotlight/translations_controller_spec.rb +2 -0
  34. data/spec/examples.txt +1228 -1291
  35. data/spec/features/about_page_spec.rb +2 -0
  36. data/spec/features/add_contacts_spec.rb +1 -0
  37. data/spec/features/browse_category_admin_spec.rb +4 -0
  38. data/spec/features/edit_contact_spec.rb +1 -0
  39. data/spec/features/exhibit_masthead_spec.rb +1 -0
  40. data/spec/features/exhibit_themes_spec.rb +1 -0
  41. data/spec/features/exhibits/add_tags_spec.rb +0 -1
  42. data/spec/features/exhibits/custom_metadata_fields_spec.rb +0 -1
  43. data/spec/features/exhibits/edit_metadata_fields_spec.rb +0 -1
  44. data/spec/features/exhibits/language_create_edit_spec.rb +3 -0
  45. data/spec/features/exhibits/translation_editing_spec.rb +6 -0
  46. data/spec/features/feature_page_spec.rb +9 -0
  47. data/spec/features/home_page_spec.rb +2 -0
  48. data/spec/features/javascript/blocks/featured_browse_categories_block_spec.rb +0 -1
  49. data/spec/features/javascript/blocks/featured_pages_block_spec.rb +0 -1
  50. data/spec/features/javascript/blocks/search_result_block_spec.rb +0 -1
  51. data/spec/features/javascript/edit_in_place_spec.rb +28 -0
  52. data/spec/features/javascript/metadata_admin_spec.rb +1 -0
  53. data/spec/features/slideshow_spec.rb +1 -0
  54. data/spec/features/translation_scope_spec.rb +1 -0
  55. data/spec/helpers/spotlight/application_helper_spec.rb +3 -0
  56. data/spec/helpers/spotlight/languages_helper_spec.rb +1 -0
  57. data/spec/helpers/spotlight/main_app_helpers_spec.rb +8 -1
  58. data/spec/helpers/spotlight/navbar_helper_spec.rb +1 -0
  59. data/spec/helpers/spotlight/pages_helper_spec.rb +1 -0
  60. data/spec/jobs/spotlight/default_thumbnail_job_spec.rb +0 -1
  61. data/spec/jobs/spotlight/reindex_job_spec.rb +0 -1
  62. data/spec/jobs/spotlight/rename_sidecar_field_job_spec.rb +0 -1
  63. data/spec/lib/migration/page_language_spec.rb +1 -0
  64. data/spec/lib/spotlight/controller_spec.rb +1 -1
  65. data/spec/mailers/spotlight/indexing_complete_mailer_spec.rb +0 -1
  66. data/spec/models/sir_trevor_rails/blocks/browse_block_spec.rb +1 -1
  67. data/spec/models/sir_trevor_rails/blocks/featured_pages_block_spec.rb +1 -0
  68. data/spec/models/sir_trevor_rails/blocks/solr_documents_block_spec.rb +0 -1
  69. data/spec/models/sir_trevor_rails/blocks/textable_spec.rb +2 -1
  70. data/spec/models/spotlight/ability_spec.rb +1 -0
  71. data/spec/models/spotlight/analytics/ga_spec.rb +0 -1
  72. data/spec/models/spotlight/blacklight_configuration_spec.rb +17 -5
  73. data/spec/models/spotlight/contact_email_spec.rb +2 -0
  74. data/spec/models/spotlight/contact_form_spec.rb +1 -0
  75. data/spec/models/spotlight/contact_spec.rb +1 -0
  76. data/spec/models/spotlight/custom_field_spec.rb +7 -1
  77. data/spec/models/spotlight/exhibit_spec.rb +6 -0
  78. data/spec/models/spotlight/feature_page_spec.rb +1 -0
  79. data/spec/models/spotlight/featured_image_spec.rb +2 -0
  80. data/spec/models/spotlight/home_page_spec.rb +2 -0
  81. data/spec/models/spotlight/masthead_spec.rb +2 -0
  82. data/spec/models/spotlight/page_configurations_spec.rb +44 -0
  83. data/spec/models/spotlight/page_spec.rb +2 -0
  84. data/spec/models/spotlight/resource_spec.rb +1 -0
  85. data/spec/models/spotlight/resources/iiif_harvester_spec.rb +4 -0
  86. data/spec/models/spotlight/resources/upload_spec.rb +0 -1
  87. data/spec/models/spotlight/role_spec.rb +4 -0
  88. data/spec/models/spotlight/search_spec.rb +1 -0
  89. data/spec/models/spotlight/solr_document/atomic_updates_spec.rb +0 -1
  90. data/spec/models/spotlight/solr_document/uploaded_resource_spec.rb +1 -0
  91. data/spec/services/spotlight/clone_translated_page_from_locale_spec.rb +4 -4
  92. data/spec/services/spotlight/iiif_resource_resolver_spec.rb +1 -0
  93. data/spec/services/spotlight/solr_document_builder_spec.rb +1 -0
  94. data/spec/test_app_templates/Gemfile.extra +0 -4
  95. data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
  96. data/spec/views/_user_util_links.html.erb_spec.rb +4 -0
  97. data/spec/views/shared/_header_navbar.html.erb_spec.rb +1 -0
  98. data/spec/views/shared/_masthead.html.erb_spec.rb +1 -0
  99. data/spec/views/spotlight/about_pages/_empty.html.erb_spec.rb +2 -1
  100. data/spec/views/spotlight/about_pages/_sidebar.html.erb_spec.rb +0 -1
  101. data/spec/views/spotlight/about_pages/index.html.erb_spec.rb +0 -1
  102. data/spec/views/spotlight/browse/_search.html.erb_spec.rb +0 -1
  103. data/spec/views/spotlight/browse/_sort_and_per_page.html.erb_spec.rb +0 -1
  104. data/spec/views/spotlight/browse/index.html.erb_spec.rb +0 -1
  105. data/spec/views/spotlight/browse/show.html.erb_spec.rb +0 -1
  106. data/spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb +0 -1
  107. data/spec/views/spotlight/catalog/admin.html.erb_spec.rb +1 -0
  108. data/spec/views/spotlight/catalog/edit.html.erb_spec.rb +0 -1
  109. data/spec/views/spotlight/contacts/edit.html.erb_spec.rb +0 -1
  110. data/spec/views/spotlight/dashboards/_analytics.html.erb_spec.rb +0 -1
  111. data/spec/views/spotlight/dashboards/analytics.html.erb_spec.rb +0 -1
  112. data/spec/views/spotlight/exhibits/_exhibit_card_front.html.erb_spec.rb +0 -1
  113. data/spec/views/spotlight/exhibits/_form.html.erb_spec.rb +2 -0
  114. data/spec/views/spotlight/feature_pages/_empty.html.erb_spec.rb +2 -1
  115. data/spec/views/spotlight/feature_pages/_sidebar.html.erb_spec.rb +0 -1
  116. data/spec/views/spotlight/home_pages/_empty.html.erb_spec.rb +1 -1
  117. data/spec/views/spotlight/home_pages/_sidebar.html.erb_spec.rb +0 -1
  118. data/spec/views/spotlight/pages/_form.html.erb_spec.rb +2 -3
  119. data/spec/views/spotlight/pages/edit.html.erb_spec.rb +2 -3
  120. data/spec/views/spotlight/pages/index.html.erb_spec.rb +0 -1
  121. data/spec/views/spotlight/pages/new.html.erb_spec.rb +2 -3
  122. data/spec/views/spotlight/resources/_external_resources_form.html.erb_spec.rb +0 -1
  123. data/spec/views/spotlight/resources/new.html.erb_spec.rb +0 -1
  124. data/spec/views/spotlight/searches/_search.html.erb_spec.rb +0 -1
  125. data/spec/views/spotlight/searches/index.html.erb_spec.rb +0 -1
  126. data/spec/views/spotlight/sir_trevor/blocks/_browse_block.html.erb_spec.rb +0 -1
  127. data/spec/views/spotlight/sir_trevor/blocks/_iframe_block.html.erb_spec.rb +0 -1
  128. data/spec/views/spotlight/sir_trevor/blocks/_rule_block.html.erb_spec.rb +0 -1
  129. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb +0 -1
  130. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb_spec.rb +0 -1
  131. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb_spec.rb +0 -1
  132. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb_spec.rb +0 -1
  133. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb +0 -1
  134. data/spec/views/spotlight/tags/index.html.erb_spec.rb +1 -1
  135. metadata +13 -4
@@ -19,8 +19,10 @@ describe 'About page', type: :feature, versioning: true do
19
19
  end
20
20
  end
21
21
  end
22
+
22
23
  describe 'page options' do
23
24
  before { login_as exhibit_curator }
25
+
24
26
  describe 'publish' do
25
27
  it 'is updatable from the edit page' do
26
28
  expect(unpublished_page).not_to be_published
@@ -3,6 +3,7 @@ describe 'Add a contact to an exhibit', type: :feature do
3
3
  let(:exhibit) { FactoryBot.create(:exhibit) }
4
4
  let!(:about_page) { FactoryBot.create(:about_page, exhibit: exhibit) }
5
5
  before { login_as curator }
6
+
6
7
  it 'displays a newly added contact in the sidebar' do
7
8
  visit spotlight.exhibit_about_pages_path(exhibit)
8
9
  click_link 'Add contact'
@@ -3,12 +3,14 @@ describe 'Browse Category Administration', type: :feature do
3
3
  let(:curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
4
4
  let!(:search) { FactoryBot.create(:search, exhibit: exhibit, query_params: { f: { 'genre_ssim' => ['Value'] } }) }
5
5
  before { login_as curator }
6
+
6
7
  describe 'index' do
7
8
  it 'has searches' do
8
9
  visit spotlight.exhibit_searches_path(exhibit)
9
10
  expect(page).to have_css('.panel .search .title', text: search.title)
10
11
  end
11
12
  end
13
+
12
14
  describe 'create' do
13
15
  it 'creates a new browse category with the current search parameters', js: true do
14
16
  visit spotlight.search_exhibit_catalog_path(exhibit, q: 'xyz')
@@ -30,6 +32,7 @@ describe 'Browse Category Administration', type: :feature do
30
32
  expect(search.reload.query_params).to eq 'q' => 'xyz'
31
33
  end
32
34
  end
35
+
33
36
  describe 'edit' do
34
37
  it 'displays an edit form' do
35
38
  visit spotlight.edit_exhibit_search_path(exhibit, search)
@@ -109,6 +112,7 @@ describe 'Browse Category Administration', type: :feature do
109
112
  expect(search.default_index_view_type).to eq 'list'
110
113
  end
111
114
  end
115
+
112
116
  describe 'destroy' do
113
117
  it 'destroys a tag' do
114
118
  skip('TODO: Allow searches to be destroyed without javascript')
@@ -4,6 +4,7 @@ describe 'Add a contact to an exhibit', type: :feature do
4
4
  let!(:about_page) { FactoryBot.create(:about_page, exhibit: exhibit) }
5
5
  let!(:contact) { FactoryBot.create(:contact, name: 'Marcus Aurelius', exhibit: exhibit) }
6
6
  before { login_as curator }
7
+
7
8
  it 'displays a newly added contact in the sidebar' do
8
9
  visit spotlight.exhibit_about_pages_path(exhibit)
9
10
 
@@ -3,6 +3,7 @@ describe 'Add and update the site masthead', type: :feature do
3
3
  let(:user) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
4
4
 
5
5
  before { login_as user }
6
+
6
7
  it 'updates exhibit masthead options' do
7
8
  visit spotlight.exhibit_dashboard_path(exhibit)
8
9
 
@@ -3,6 +3,7 @@ describe 'Update the site theme', type: :feature do
3
3
  let(:user) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
4
4
 
5
5
  before { login_as user }
6
+
6
7
  it 'updates the exhibit theme' do
7
8
  visit spotlight.edit_exhibit_appearance_path(exhibit)
8
9
 
@@ -1,4 +1,3 @@
1
-
2
1
  describe 'Add tags to an item in an exhibit', type: :feature do
3
2
  let(:exhibit) { FactoryBot.create(:exhibit) }
4
3
  let(:curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
@@ -1,4 +1,3 @@
1
-
2
1
  describe 'Adding custom metadata fields', type: :feature do
3
2
  let(:exhibit) { FactoryBot.create(:exhibit) }
4
3
  let(:admin) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
@@ -1,4 +1,3 @@
1
-
2
1
  describe 'Editing metadata fields', type: :feature do
3
2
  let(:exhibit) { FactoryBot.create(:exhibit) }
4
3
  let(:admin) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
@@ -5,6 +5,7 @@ describe 'Language', type: :feature do
5
5
  login_as admin
6
6
  visit spotlight.edit_exhibit_path(exhibit)
7
7
  end
8
+
8
9
  describe 'creation' do
9
10
  it 'successfully adds languages' do
10
11
  within '#language' do
@@ -18,6 +19,7 @@ describe 'Language', type: :feature do
18
19
  end
19
20
  end
20
21
  end
22
+
21
23
  describe 'making public' do
22
24
  it 'successfully updates the language' do
23
25
  within '#language' do
@@ -33,6 +35,7 @@ describe 'Language', type: :feature do
33
35
  expect(exhibit.languages.last).to be_public
34
36
  end
35
37
  end
38
+
36
39
  describe 'deleting' do
37
40
  it 'successfully updates the language' do
38
41
  within '#language' do
@@ -8,6 +8,7 @@ describe 'Translation editing', type: :feature do
8
8
  FactoryBot.create(:language, exhibit: exhibit, locale: 'fr')
9
9
  login_as admin
10
10
  end
11
+
11
12
  describe 'general' do
12
13
  before do
13
14
  visit spotlight.edit_exhibit_translations_path(exhibit, language: 'fr')
@@ -39,6 +40,7 @@ describe 'Translation editing', type: :feature do
39
40
  end
40
41
  end
41
42
  end
43
+
42
44
  describe 'main menu' do
43
45
  it 'adds translations to exhibit navbar' do
44
46
  within '.translation-edit-form #general' do
@@ -76,6 +78,7 @@ describe 'Translation editing', type: :feature do
76
78
  click_button 'Save changes'
77
79
  end
78
80
  end
81
+
79
82
  it 'adds translations to user-facing breadcrumbs' do
80
83
  expect(page).to have_css '.flash_messages', text: 'The exhibit was successfully updated.'
81
84
  visit spotlight.exhibit_browse_index_path(exhibit, locale: 'fr')
@@ -122,6 +125,7 @@ describe 'Translation editing', type: :feature do
122
125
  click_button 'Save changes'
123
126
  end
124
127
  end
128
+
125
129
  it 'adds breadcrumbs to pages' do
126
130
  visit spotlight.exhibit_about_page_path(about_page2.exhibit, about_page2, locale: 'fr')
127
131
  expect(page).to have_breadcrumbs 'Maison', 'Sur', about_page2.title
@@ -141,6 +145,7 @@ describe 'Translation editing', type: :feature do
141
145
  click_button 'Save changes'
142
146
  end
143
147
  end
148
+
144
149
  it 'adds breadcrumbs user facing catalog' do
145
150
  visit spotlight.search_exhibit_catalog_path(exhibit, q: '*', locale: 'fr')
146
151
  expect(page).to have_breadcrumbs 'Maison', 'Résultats de la recherche'
@@ -387,6 +392,7 @@ describe 'Translation editing', type: :feature do
387
392
  before do
388
393
  FactoryBot.create(:translation, exhibit: exhibit, locale: 'fr', key: "#{exhibit.slug}.title", value: 'Titre')
389
394
  end
395
+
390
396
  it 'counts existing and total available translations' do
391
397
  visit spotlight.edit_exhibit_translations_path(exhibit, language: 'fr')
392
398
  expect(page).to have_link('General 1/8')
@@ -32,6 +32,7 @@ describe 'Feature page', type: :feature, versioning: true do
32
32
  end
33
33
  describe 'when configured to display' do
34
34
  before { parent_feature_page.update display_sidebar: true }
35
+
35
36
  after { parent_feature_page.update display_sidebar: false }
36
37
 
37
38
  it 'is present' do
@@ -48,8 +49,10 @@ describe 'Feature page', type: :feature, versioning: true do
48
49
  end
49
50
  end
50
51
  end
52
+
51
53
  describe 'when configured to not display' do
52
54
  before { parent_feature_page.update display_sidebar: false }
55
+
53
56
  context 'with a child page' do
54
57
  it 'is present anyway' do
55
58
  visit spotlight.exhibit_feature_page_path(parent_feature_page.exhibit, parent_feature_page)
@@ -60,6 +63,7 @@ describe 'Feature page', type: :feature, versioning: true do
60
63
 
61
64
  context 'with an unpublished child page' do
62
65
  before { child_feature_page.update published: false }
66
+
63
67
  it 'does not be present' do
64
68
  visit spotlight.exhibit_feature_page_path(parent_feature_page.exhibit, parent_feature_page)
65
69
  expect(page).not_to have_css('#sidebar')
@@ -68,8 +72,10 @@ describe 'Feature page', type: :feature, versioning: true do
68
72
  end
69
73
  end
70
74
  end
75
+
71
76
  describe 'page options' do
72
77
  before { login_as exhibit_curator }
78
+
73
79
  describe 'publish' do
74
80
  let!(:unpublished_page) { FactoryBot.create(:feature_page, published: false, exhibit: exhibit) }
75
81
  it 'is updatable from the edit page' do
@@ -87,9 +93,11 @@ describe 'Feature page', type: :feature, versioning: true do
87
93
  expect(find('#feature_page_published')).to be_checked
88
94
  end
89
95
  end
96
+
90
97
  describe 'display_sidebar' do
91
98
  let!(:feature_page) { FactoryBot.create(:feature_page, display_sidebar: false, exhibit: exhibit) }
92
99
  before { feature_page.update display_sidebar: false }
100
+
93
101
  it 'is updatable from the edit page' do
94
102
  expect(feature_page.display_sidebar?).to be_falsey
95
103
 
@@ -109,6 +117,7 @@ describe 'Feature page', type: :feature, versioning: true do
109
117
 
110
118
  describe 'page locking' do
111
119
  before { login_as exhibit_curator }
120
+
112
121
  let!(:feature_page) { FactoryBot.create(:feature_page, display_sidebar: false, exhibit: exhibit) }
113
122
 
114
123
  it 'shows a lock message if someone is currently editing the page' do
@@ -2,6 +2,7 @@ describe 'Home page', type: :feature, versioning: true do
2
2
  let(:exhibit) { FactoryBot.create(:exhibit) }
3
3
  let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
4
4
  before { login_as exhibit_curator }
5
+
5
6
  it 'exists by default on exhibits' do
6
7
  visit spotlight.exhibit_dashboard_path(exhibit)
7
8
  click_link 'Feature pages'
@@ -79,6 +80,7 @@ describe 'Home page', type: :feature, versioning: true do
79
80
  exhibit.home_page.display_sidebar = false
80
81
  exhibit.home_page.save
81
82
  end
83
+
82
84
  it 'does not display the facet sidebar' do
83
85
  visit spotlight.exhibit_home_page_path(exhibit)
84
86
  expect(page).not_to have_css('#sidebar')
@@ -1,4 +1,3 @@
1
-
2
1
  describe 'Featured Browse Category Block', type: :feature, js: true do
3
2
  let(:exhibit) { FactoryBot.create(:exhibit) }
4
3
  let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
@@ -1,4 +1,3 @@
1
-
2
1
  describe 'Featured Pages Blocks', type: :feature, js: true do
3
2
  let(:exhibit) { FactoryBot.create(:exhibit) }
4
3
  let!(:feature_page1) do
@@ -1,4 +1,3 @@
1
-
2
1
  describe 'Search Result Block', type: :feature, js: true do
3
2
  let(:exhibit) { FactoryBot.create(:exhibit) }
4
3
  let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
@@ -2,6 +2,7 @@ describe 'Edit in place', type: :feature, js: true do
2
2
  let(:exhibit) { FactoryBot.create(:exhibit) }
3
3
  let(:admin) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
4
4
  before { login_as admin }
5
+
5
6
  describe 'Feature Pages' do
6
7
  it 'updates the label' do
7
8
  visit spotlight.exhibit_dashboard_path(exhibit)
@@ -26,7 +27,34 @@ describe 'Edit in place', type: :feature, js: true do
26
27
  expect(page).to have_css('h3', text: 'My Newer Feature Page')
27
28
  expect(page).to_not have_css('h3', text: 'My New Feature Page')
28
29
  end
30
+
31
+ it 'rejects blank values' do
32
+ visit spotlight.exhibit_dashboard_path(exhibit)
33
+
34
+ click_link 'Feature pages'
35
+
36
+ add_new_page_via_button('My New Feature Page')
37
+
38
+ expect(page).to have_css('h3', text: 'My New Feature Page')
39
+
40
+ within('.feature_pages_admin') do
41
+ expect(page).to have_css('#exhibit_feature_pages_attributes_0_title[type="hidden"]', visible: false)
42
+ expect(page).not_to have_css('#exhibit_feature_pages_attributes_0_title[type="text"]')
43
+ click_link('My New Feature Page')
44
+ expect(page).not_to have_css('#exhibit_feature_pages_attributes_0_title[type="hidden"]')
45
+ expect(page).to have_css('#exhibit_feature_pages_attributes_0_title[type="text"]')
46
+ fill_in 'exhibit_feature_pages_attributes_0_title', with: ''
47
+ # blur out of the now-emptytitle field
48
+ field = page.find_field('exhibit_feature_pages_attributes_0_title')
49
+ field.native.send_keys :tab
50
+
51
+ expect(page).to have_css('#exhibit_feature_pages_attributes_0_title[type="hidden"]', visible: false)
52
+ expect(page).not_to have_css('#exhibit_feature_pages_attributes_0_title[type="text"]')
53
+ expect(page).to have_css('h3', text: 'My New Feature Page')
54
+ end
55
+ end
29
56
  end
57
+
30
58
  describe 'Main navigation' do
31
59
  it 'updates the label' do
32
60
  visit spotlight.exhibit_dashboard_path(exhibit)
@@ -2,6 +2,7 @@ feature 'Metadata Administration', js: true do
2
2
  let(:exhibit) { FactoryBot.create(:exhibit) }
3
3
  let(:admin) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
4
4
  before { login_as admin }
5
+
5
6
  describe 'Select/Deselect all button' do
6
7
  it 'deselects all checkboxes when all are selected' do
7
8
  visit spotlight.edit_exhibit_metadata_configuration_path exhibit
@@ -6,6 +6,7 @@ describe 'Slideshow', type: :feature, js: true do
6
6
  login_as user
7
7
  exhibit.blacklight_configuration.update(document_index_view_types: %w(list gallery slideshow))
8
8
  end
9
+
9
10
  it 'has slideshow' do
10
11
  visit spotlight.search_exhibit_catalog_path(exhibit, f: { genre_ssim: ['map'] })
11
12
  expect(page).to have_content 'You searched for:'
@@ -9,6 +9,7 @@ describe 'Translations scope setting', type: :feature do
9
9
  FactoryBot.create(:translation, exhibit: exhibit)
10
10
  FactoryBot.create(:translation, exhibit: other_exhibit)
11
11
  end
12
+
12
13
  it 'default scope of Translation should be limited to current exhibit' do
13
14
  visit spotlight.exhibit_path(exhibit)
14
15
  expect(Translation.all.count).to eq 1
@@ -78,6 +78,7 @@ describe Spotlight::ApplicationHelper, type: :helper do
78
78
  expect(helper.selected_search_block_views(block)).to eq %w(a d)
79
79
  end
80
80
  end
81
+
81
82
  describe 'blacklight_view_config_for_search_block' do
82
83
  let(:sir_trevor_block) do
83
84
  SirTrevorRails::Block.new({ type: 'xyz', data: { view: %w(list gallery) } }, 'parent')
@@ -93,6 +94,7 @@ describe Spotlight::ApplicationHelper, type: :helper do
93
94
  before do
94
95
  allow(helper).to receive_messages(blacklight_config: config)
95
96
  end
97
+
96
98
  it 'returns a blacklight configuration object that has reduced the views to those that are configured in the block' do
97
99
  new_config = helper.blacklight_view_config_for_search_block(sir_trevor_block)
98
100
  expect(new_config.keys).to eq [:list, :gallery]
@@ -109,6 +111,7 @@ describe Spotlight::ApplicationHelper, type: :helper do
109
111
  config.index.display_type_field = :some_field
110
112
  end)
111
113
  end
114
+
112
115
  it 'returns blacklight-private when the document is private' do
113
116
  allow(document).to receive(:private?).with(current_exhibit).and_return(true)
114
117
  expect(helper.render_document_class(document)).to include 'blacklight-private'
@@ -63,6 +63,7 @@ describe Spotlight::LanguagesHelper, type: :helper do
63
63
  expect(helper.default_language?).to eq true
64
64
  end
65
65
  end
66
+
66
67
  context 'when using a different locale' do
67
68
  it do
68
69
  expect(helper).to receive_messages(params: { locale: :it })
@@ -1,4 +1,3 @@
1
-
2
1
  describe Spotlight::MainAppHelpers, type: :helper do
3
2
  describe '#show_contact_form?' do
4
3
  subject { helper }
@@ -14,29 +13,37 @@ describe Spotlight::MainAppHelpers, type: :helper do
14
13
  end
15
14
  end
16
15
  end
16
+
17
17
  before { allow(helper).to receive_messages current_exhibit: exhibit_with_contacts }
18
+
18
19
  its(:show_contact_form?) { should be_truthy }
19
20
  end
20
21
 
21
22
  context 'with an exhibit with only unconfirmed contacts' do
22
23
  before { exhibit_with_contacts.contact_emails.build email: 'cabeer@stanford.edu' }
24
+
23
25
  before { allow(helper).to receive_messages current_exhibit: exhibit_with_contacts }
26
+
24
27
  its(:show_contact_form?) { should be_falsey }
25
28
  end
26
29
 
27
30
  context 'with an exhibit without contacts' do
28
31
  before { allow(helper).to receive_messages current_exhibit: exhibit }
32
+
29
33
  its(:show_contact_form?) { should be_falsey }
30
34
  end
31
35
 
32
36
  context 'outside the context of an exhibit' do
33
37
  before { allow(helper).to receive_messages current_exhibit: nil }
38
+
34
39
  its(:show_contact_form?) { should be_falsey }
35
40
  end
36
41
 
37
42
  context 'with a default contact address' do
38
43
  before { allow(Spotlight::Engine.config).to receive_messages default_contact_email: 'root@localhost' }
44
+
39
45
  before { allow(helper).to receive_messages current_exhibit: exhibit }
46
+
40
47
  its(:show_contact_form?) { should be_truthy }
41
48
  end
42
49
  end
@@ -4,6 +4,7 @@ describe Spotlight::NavbarHelper, type: :helper do
4
4
  allow(helper).to receive_messages(current_exhibit: nil)
5
5
  allow(helper).to receive_messages(exhibit_masthead?: true)
6
6
  end
7
+
7
8
  it 'returns false when there is no exhibit context' do
8
9
  expect(helper.should_render_spotlight_search_bar?).to be_falsey
9
10
  end
@@ -77,6 +77,7 @@ describe Spotlight::PagesHelper, type: :helper do
77
77
  expect(helper.nestable_data_attributes('something_else')).to eq ''
78
78
  end
79
79
  end
80
+
80
81
  describe 'nestable data attributes hash' do
81
82
  it 'returns the appropriate hash for feature pages' do
82
83
  expect(helper.nestable_data_attributes_hash('feature_pages')).to eq('data-max-depth' => '2',
@@ -1,4 +1,3 @@
1
-
2
1
  describe Spotlight::DefaultThumbnailJob do
3
2
  let(:thumbnailable) { double('Thumbnailable') }
4
3
  subject { described_class.new(thumbnailable) }
@@ -1,4 +1,3 @@
1
-
2
1
  describe Spotlight::ReindexJob do
3
2
  let(:exhibit) { FactoryBot.create(:exhibit) }
4
3
  let(:resource) { FactoryBot.create(:resource) }
@@ -1,4 +1,3 @@
1
-
2
1
  describe Spotlight::RenameSidecarFieldJob do
3
2
  include ActiveJob::TestHelper
4
3
 
@@ -11,6 +11,7 @@ RSpec.describe Migration::PageLanguage do
11
11
  slug.save
12
12
  slug.reload
13
13
  end
14
+
14
15
  it 'sets the scope to the default locale' do
15
16
  expect(slug.scope).not_to include(',locale:en')
16
17
  subject.run
@@ -1,4 +1,3 @@
1
-
2
1
  describe Spotlight::Controller do
3
2
  class MockController < ActionController::Base
4
3
  include Spotlight::Controller
@@ -92,6 +91,7 @@ describe Spotlight::Controller do
92
91
  before do
93
92
  allow(subject).to receive(:current_exhibit).and_return(exhibit)
94
93
  end
94
+
95
95
  it 'adds the current exhibit context to the route' do
96
96
  expect(subject.spotlight).to receive(:facet_exhibit_catalog_url).with(exhibit, id: 'some_field', q: 'xyz')
97
97
  subject.exhibit_search_facet_url(id: 'some_field')