blacklight-spotlight 3.0.0.rc2 → 3.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/assets/images/blacklight/arrow-alt-circle-left.svg +1 -0
- data/app/assets/images/blacklight/arrow-alt-circle-right.svg +1 -0
- data/app/assets/javascripts/spotlight/admin/{add_new_page_button.js → add_new_button.js} +7 -0
- data/app/assets/javascripts/spotlight/admin/block_mixins/autocompleteable.js +4 -4
- data/app/assets/javascripts/spotlight/admin/blocks/browse_group_categories_block.js +88 -0
- data/app/assets/javascripts/spotlight/admin/blocks/pages_block.js +1 -1
- data/app/assets/javascripts/spotlight/admin/blocks/solr_documents_base_block.js +1 -1
- data/app/assets/javascripts/spotlight/admin/croppable.js +1 -1
- data/app/assets/javascripts/spotlight/admin/index.js +0 -2
- data/app/assets/javascripts/spotlight/admin/search_typeahead.js +2 -2
- data/app/assets/javascripts/spotlight/admin/sir-trevor/locales.js +7 -0
- data/app/assets/javascripts/spotlight/user/browse_group_categories.js +59 -0
- data/app/assets/javascripts/spotlight/user/index.js +1 -0
- data/app/assets/stylesheets/spotlight/_breadcrumbs.scss +8 -0
- data/app/assets/stylesheets/spotlight/_featured_browse_categories_block.scss +34 -1
- data/app/assets/stylesheets/spotlight/_spotlight.scss +2 -0
- data/app/assets/stylesheets/spotlight/browse_group_categories_block.scss +69 -0
- data/app/builders/spotlight/bootstrap_breadcrumbs_builder.rb +1 -2
- data/app/controllers/concerns/spotlight/search_helper.rb +2 -8
- data/app/controllers/spotlight/appearances_controller.rb +0 -13
- data/app/controllers/spotlight/browse_controller.rb +7 -3
- data/app/controllers/spotlight/catalog_controller.rb +1 -1
- data/app/controllers/spotlight/concerns/application_controller.rb +13 -2
- data/app/controllers/spotlight/groups_controller.rb +80 -0
- data/app/controllers/spotlight/pages_controller.rb +5 -8
- data/app/controllers/spotlight/searches_controller.rb +4 -17
- data/app/helpers/spotlight/application_helper.rb +1 -1
- data/app/helpers/spotlight/crud_link_helpers.rb +1 -1
- data/app/helpers/spotlight/main_app_helpers.rb +1 -1
- data/app/models/sir_trevor_rails/blocks/browse_group_categories_block.rb +25 -0
- data/app/models/spotlight/ability.rb +2 -0
- data/app/models/spotlight/about_page.rb +1 -1
- data/app/models/spotlight/blacklight_configuration.rb +2 -1
- data/app/models/spotlight/exhibit.rb +14 -2
- data/app/models/spotlight/feature_page.rb +1 -1
- data/app/models/spotlight/featured_image.rb +1 -1
- data/app/models/spotlight/group.rb +22 -0
- data/app/models/spotlight/group_member.rb +11 -0
- data/app/models/spotlight/home_page.rb +1 -1
- data/app/models/spotlight/page.rb +2 -2
- data/app/models/spotlight/page_configurations.rb +5 -0
- data/app/models/spotlight/resources/iiif_manifest.rb +6 -6
- data/app/models/spotlight/search.rb +5 -0
- data/app/services/spotlight/exhibit_import_export_service.rb +50 -22
- data/app/views/spotlight/browse/_search.html.erb +2 -1
- data/app/views/spotlight/browse/index.html.erb +13 -0
- data/app/views/spotlight/catalog/_document.html.erb +2 -4
- data/app/views/spotlight/catalog/index.iiif_json.jbuilder +22 -0
- data/app/views/spotlight/searches/_form.html.erb +12 -0
- data/app/views/spotlight/searches/_group.html.erb +27 -0
- data/app/views/spotlight/searches/index.html.erb +58 -17
- data/app/views/spotlight/sir_trevor/blocks/_browse_group_categories_block.html.erb +44 -0
- data/app/views/spotlight/translations/_groups.html.erb +34 -0
- data/app/views/spotlight/translations/edit.html.erb +6 -0
- data/config/i18n-tasks.yml +5 -0
- data/config/locales/spotlight.en.yml +37 -1
- data/config/routes.rb +10 -0
- data/db/migrate/20210113092223_create_spotlight_groups.rb +23 -0
- data/lib/generators/spotlight/install_generator.rb +3 -3
- data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +1 -1
- data/lib/spotlight/engine.rb +4 -3
- data/lib/spotlight/version.rb +1 -1
- data/spec/controllers/spotlight/browse_controller_spec.rb +23 -0
- data/spec/controllers/spotlight/feature_pages_controller_spec.rb +11 -0
- data/spec/controllers/spotlight/groups_controller_spec.rb +103 -0
- data/spec/controllers/spotlight/searches_controller_spec.rb +10 -3
- data/spec/controllers/spotlight/view_configurations_controller_spec.rb +1 -1
- data/spec/examples.txt +1437 -136
- data/spec/factories/group.rb +17 -0
- data/spec/factories/searches.rb +10 -0
- data/spec/features/browse_category_admin_spec.rb +36 -4
- data/spec/features/browse_category_navigation_spec.rb +44 -0
- data/spec/features/browse_category_spec.rb +2 -2
- data/spec/features/exhibits/translation_editing_spec.rb +49 -0
- data/spec/features/home_page_spec.rb +4 -4
- data/spec/features/javascript/about_page_admin_spec.rb +1 -1
- data/spec/features/javascript/block_controls_spec.rb +1 -1
- data/spec/features/javascript/blocks/browse_group_categories_block_spec.rb +64 -0
- data/spec/features/javascript/browse_group_admin_spec.rb +45 -0
- data/spec/features/javascript/edit_in_place_spec.rb +2 -2
- data/spec/features/javascript/feature_page_admin_spec.rb +1 -1
- data/spec/helpers/spotlight/crud_link_helpers_spec.rb +3 -3
- data/spec/models/sir_trevor_rails/blocks/browse_group_categories_block_spec.rb +41 -0
- data/spec/models/spotlight/exhibit_spec.rb +8 -0
- data/spec/models/spotlight/group_spec.rb +19 -0
- data/spec/models/spotlight/role_spec.rb +1 -1
- data/spec/models/spotlight/search_spec.rb +30 -3
- data/spec/services/spotlight/exhibit_import_export_service_spec.rb +48 -1
- data/spec/services/spotlight/solr_document_builder_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/support/features/test_features_helpers.rb +15 -0
- data/spec/test_app_templates/Gemfile.extra +1 -0
- data/spec/test_app_templates/catalog_controller.rb +6 -3
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
- data/spec/views/spotlight/browse/index.html.erb_spec.rb +2 -0
- data/spec/views/spotlight/pages/show.html.erb_spec.rb +1 -0
- data/vendor/assets/javascripts/tiny-slider.js +3218 -0
- data/vendor/assets/stylesheets/tiny-slider.css +1 -0
- metadata +339 -263
- data/vendor/assets/javascripts/handlebars-v1.3.0.js +0 -2746
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :group, class: 'Spotlight::Group' do
|
5
|
+
exhibit
|
6
|
+
|
7
|
+
factory :group_with_searches do
|
8
|
+
transient do
|
9
|
+
searches_count { 5 }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
after(:create) do |group, evaluator|
|
14
|
+
create_list(:search, evaluator.searches_count, groups: [group]) if evaluator.respond_to?(:searches_count)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/spec/factories/searches.rb
CHANGED
@@ -7,6 +7,16 @@ FactoryBot.define do
|
|
7
7
|
sequence(:slug) { |n| "Search#{n}" }
|
8
8
|
|
9
9
|
after(:build) { |search| search.thumbnail = FactoryBot.create(:featured_image) }
|
10
|
+
|
11
|
+
factory :search_with_groups do
|
12
|
+
transient do
|
13
|
+
groups_count { 2 }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
after(:create) do |search, evaluator|
|
18
|
+
create_list(:group, evaluator.groups_count, searches: [search]) if evaluator.respond_to?(:groups_count)
|
19
|
+
end
|
10
20
|
end
|
11
21
|
|
12
22
|
factory :published_search, parent: :search do
|
@@ -48,6 +48,38 @@ describe 'Browse Category Administration', type: :feature do
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
+
describe 'with a group present' do
|
52
|
+
let!(:group) { FactoryBot.create(:group, exhibit: exhibit, title: 'Good group') }
|
53
|
+
|
54
|
+
it 'enables group selection' do
|
55
|
+
visit spotlight.edit_exhibit_search_path(exhibit, search)
|
56
|
+
click_link 'Group'
|
57
|
+
expect(page).to have_content 'You can add this browse category'
|
58
|
+
|
59
|
+
within '#search-group' do
|
60
|
+
expect(find('input[type="checkbox"]')).not_to be_checked
|
61
|
+
check 'Good group'
|
62
|
+
end
|
63
|
+
|
64
|
+
click_button 'Save changes'
|
65
|
+
expect(page).to have_content('The browse category was successfully updated.')
|
66
|
+
visit spotlight.edit_exhibit_search_path(exhibit, search)
|
67
|
+
click_link 'Group'
|
68
|
+
|
69
|
+
within '#search-group' do
|
70
|
+
expect(find('input[type="checkbox"]')).to be_checked
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe 'without a group present' do
|
76
|
+
it 'displays no group help text' do
|
77
|
+
visit spotlight.edit_exhibit_search_path(exhibit, search)
|
78
|
+
click_link 'Group'
|
79
|
+
expect(page).to have_content 'You cannot add this browse category'
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
51
83
|
it 'attaches a masthead image' do
|
52
84
|
visit spotlight.edit_exhibit_search_path exhibit, search
|
53
85
|
|
@@ -63,7 +95,7 @@ describe 'Browse Category Administration', type: :feature do
|
|
63
95
|
|
64
96
|
click_button 'Save changes'
|
65
97
|
|
66
|
-
expect(page).to have_content('The
|
98
|
+
expect(page).to have_content('The browse category was successfully updated.')
|
67
99
|
|
68
100
|
search.reload
|
69
101
|
|
@@ -83,7 +115,7 @@ describe 'Browse Category Administration', type: :feature do
|
|
83
115
|
|
84
116
|
click_button 'Save changes'
|
85
117
|
|
86
|
-
expect(page).to have_content('The
|
118
|
+
expect(page).to have_content('The browse category was successfully updated.')
|
87
119
|
|
88
120
|
search.reload
|
89
121
|
|
@@ -97,7 +129,7 @@ describe 'Browse Category Administration', type: :feature do
|
|
97
129
|
check 'Search box'
|
98
130
|
|
99
131
|
click_button 'Save changes'
|
100
|
-
expect(page).to have_content('The
|
132
|
+
expect(page).to have_content('The browse category was successfully updated.')
|
101
133
|
search.reload
|
102
134
|
|
103
135
|
expect(search.search_box).to eq true
|
@@ -109,7 +141,7 @@ describe 'Browse Category Administration', type: :feature do
|
|
109
141
|
|
110
142
|
click_button 'Save changes'
|
111
143
|
|
112
|
-
expect(page).to have_content('The
|
144
|
+
expect(page).to have_content('The browse category was successfully updated.')
|
113
145
|
|
114
146
|
search.reload
|
115
147
|
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe 'Browse pages' do
|
4
|
+
let(:exhibit) { FactoryBot.create(:exhibit) }
|
5
|
+
let!(:search) { FactoryBot.create(:search, title: 'Some Saved Search', exhibit: exhibit, published: true) }
|
6
|
+
let!(:search_2) { FactoryBot.create(:search, title: 'Some Other Saved Search', exhibit: exhibit, published: true) }
|
7
|
+
let!(:group) { FactoryBot.create(:group, title: 'Awesome group', exhibit: exhibit, published: true, searches: [search]) }
|
8
|
+
|
9
|
+
describe 'landing page' do
|
10
|
+
before do
|
11
|
+
visit spotlight.exhibit_browse_index_path(exhibit)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'displays all categories and tabs for each group' do
|
15
|
+
within '.browse-group-navigation' do
|
16
|
+
expect(page).to have_css 'li.nav-item a.nav-link.active', text: 'All'
|
17
|
+
expect(page).to have_css 'li.nav-item a.nav-link', count: exhibit.groups.count + 1
|
18
|
+
end
|
19
|
+
within '.browse-landing' do
|
20
|
+
expect(page).to have_css '.category', count: 2
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'filters browse categories when navigated' do
|
25
|
+
within '.browse-group-navigation' do
|
26
|
+
click_link group.title
|
27
|
+
expect(page).to have_css 'li.nav-item a.nav-link.active', text: group.title
|
28
|
+
end
|
29
|
+
within '.browse-landing' do
|
30
|
+
expect(page).to have_css '.category', count: 1
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'clicking through from the context of a category provides the breadcrums' do
|
35
|
+
within '.browse-group-navigation' do
|
36
|
+
click_link group.title
|
37
|
+
expect(page).to have_css 'li.nav-item a.nav-link.active', text: group.title
|
38
|
+
end
|
39
|
+
click_link 'Some Saved Search'
|
40
|
+
expect(page).to have_css 'ul.breadcrumb li.breadcrumb-item', count: 4
|
41
|
+
expect(page).to have_css 'li.breadcrumb-item', text: 'Awesome group'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -100,7 +100,7 @@ describe 'Browse pages' do
|
|
100
100
|
it 'uses the appropriate view config' do
|
101
101
|
visit spotlight.exhibit_browse_path(exhibit, search)
|
102
102
|
|
103
|
-
expect(page).to have_css('#documents.gallery .document', count: 1)
|
103
|
+
expect(page).to have_css('#documents.documents-gallery .document', count: 1)
|
104
104
|
|
105
105
|
within '.document' do
|
106
106
|
expect(page).not_to have_css('dt')
|
@@ -113,7 +113,7 @@ describe 'Browse pages' do
|
|
113
113
|
it 'renders the gallery view' do
|
114
114
|
visit spotlight.exhibit_browse_path(exhibit, search)
|
115
115
|
expect(page).to have_selector '.view-type-gallery.active'
|
116
|
-
expect(page).to have_selector '#documents.gallery'
|
116
|
+
expect(page).to have_selector '#documents.documents-gallery'
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
@@ -378,6 +378,55 @@ describe 'Translation editing', type: :feature do
|
|
378
378
|
end
|
379
379
|
end
|
380
380
|
|
381
|
+
describe 'Browse groups' do
|
382
|
+
before do
|
383
|
+
FactoryBot.create(:group, exhibit: exhibit, title: 'Browse Group 1')
|
384
|
+
FactoryBot.create(:group, exhibit: exhibit, title: 'Browse Group 2')
|
385
|
+
|
386
|
+
visit spotlight.edit_exhibit_translations_path(exhibit, language: 'fr')
|
387
|
+
end
|
388
|
+
|
389
|
+
it 'has a title browse group' do
|
390
|
+
within '#groups' do
|
391
|
+
expect(page).to have_css('input[type="text"]', count: 2)
|
392
|
+
|
393
|
+
expect(page).to have_field 'Browse Group 1'
|
394
|
+
expect(page).to have_field 'Browse Group 2'
|
395
|
+
end
|
396
|
+
end
|
397
|
+
|
398
|
+
it 'redirects to the same form tab' do
|
399
|
+
click_link 'Browse categories'
|
400
|
+
within('#groups', visible: true) do
|
401
|
+
fill_in 'Browse Group 1', with: 'parcourir le groupe 1'
|
402
|
+
click_button 'Save changes'
|
403
|
+
end
|
404
|
+
|
405
|
+
expect(page).to have_css '.nav-pills .nav-link.active', text: 'French'
|
406
|
+
expect(page).to have_css '.nav-tabs .nav-link.active', text: 'Browse groups'
|
407
|
+
end
|
408
|
+
|
409
|
+
it 'persists changes', js: true do
|
410
|
+
click_link 'Browse groups'
|
411
|
+
|
412
|
+
within('#groups', visible: true) do
|
413
|
+
fill_in 'Browse Group 1', with: 'parcourir le groupe 1'
|
414
|
+
|
415
|
+
click_button 'Save changes'
|
416
|
+
end
|
417
|
+
|
418
|
+
expect(page).to have_css('.flash_messages', text: 'The exhibit was successfully updated.')
|
419
|
+
|
420
|
+
expect(exhibit.groups.first.title).to eq 'Browse Group 1'
|
421
|
+
|
422
|
+
I18n.locale = :fr
|
423
|
+
Translation.current_exhibit = exhibit
|
424
|
+
expect(exhibit.groups.first.title).to eq 'parcourir le groupe 1'
|
425
|
+
I18n.locale = I18n.default_locale
|
426
|
+
Translation.current_exhibit = nil
|
427
|
+
end
|
428
|
+
end
|
429
|
+
|
381
430
|
describe 'home page translation table entry' do
|
382
431
|
let(:feature_page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
|
383
432
|
let(:about_page) { FactoryBot.create(:about_page, exhibit: exhibit) }
|
@@ -32,7 +32,7 @@ describe 'Home page', type: :feature, versioning: true do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'redirects back to the correct home page URL after updating (no format param to interfere w/ faceting)' do
|
35
|
-
visit spotlight.exhibit_home_page_path(exhibit
|
35
|
+
visit spotlight.exhibit_home_page_path(exhibit)
|
36
36
|
|
37
37
|
click_link 'Edit'
|
38
38
|
click_button 'Save changes'
|
@@ -41,7 +41,7 @@ describe 'Home page', type: :feature, versioning: true do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'has working facet links' do
|
44
|
-
visit spotlight.exhibit_home_page_path(exhibit
|
44
|
+
visit spotlight.exhibit_home_page_path(exhibit)
|
45
45
|
click_button 'Genre'
|
46
46
|
click_link 'map'
|
47
47
|
expect(page).to have_content exhibit.title
|
@@ -49,7 +49,7 @@ describe 'Home page', type: :feature, versioning: true do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'has a search box' do
|
52
|
-
visit spotlight.exhibit_home_page_path(exhibit
|
52
|
+
visit spotlight.exhibit_home_page_path(exhibit)
|
53
53
|
fill_in 'q', with: 'query'
|
54
54
|
click_button 'Search'
|
55
55
|
|
@@ -62,7 +62,7 @@ describe 'Home page', type: :feature, versioning: true do
|
|
62
62
|
TopHat.current['opengraph'] = nil
|
63
63
|
Spotlight::Site.instance.update(title: 'some title')
|
64
64
|
|
65
|
-
visit spotlight.exhibit_home_page_path(exhibit
|
65
|
+
visit spotlight.exhibit_home_page_path(exhibit)
|
66
66
|
|
67
67
|
expect(page).to have_css "meta[name='twitter:card'][value='summary']", visible: false
|
68
68
|
expect(page).to have_css "meta[name='twitter:url'][value='#{spotlight.exhibit_root_url(exhibit)}']", visible: false
|
@@ -12,7 +12,7 @@ describe 'About Pages Adminstration', js: true do
|
|
12
12
|
|
13
13
|
click_link 'About pages'
|
14
14
|
|
15
|
-
|
15
|
+
add_new_via_button('My New Page')
|
16
16
|
|
17
17
|
expect(page).to have_content 'The about page was created.'
|
18
18
|
expect(page).to have_css('li.dd-item')
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe 'Browse Group Categories', type: :feature, js: true do
|
4
|
+
let(:exhibit) { FactoryBot.create(:exhibit) }
|
5
|
+
let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
|
6
|
+
|
7
|
+
let(:feature_page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
|
8
|
+
let(:search1) { FactoryBot.create(:published_search, exhibit: exhibit, title: 'All of the good dogs') }
|
9
|
+
let(:search2) { FactoryBot.create(:published_search, exhibit: exhibit, title: 'All of the good cats') }
|
10
|
+
let(:search3) { FactoryBot.create(:published_search, exhibit: exhibit, title: 'All of the good birds') }
|
11
|
+
let(:search4) { FactoryBot.create(:published_search, exhibit: exhibit, title: 'All of the good pigs') }
|
12
|
+
let(:search5) { FactoryBot.create(:published_search, exhibit: exhibit, title: 'All of the good tigers') }
|
13
|
+
let(:search6) { FactoryBot.create(:published_search, exhibit: exhibit, title: 'All of the good ferrets') }
|
14
|
+
let(:search7) { FactoryBot.create(:search, exhibit: exhibit, title: 'All of the good turtles') }
|
15
|
+
let!(:group) { FactoryBot.create(:group, exhibit: exhibit, searches: [search1, search2, search3, search4, search5, search6], title: 'Pets', published: true) }
|
16
|
+
let!(:group2) { FactoryBot.create(:group, exhibit: exhibit, searches: [search1, search2], title: 'Good animals', published: true) }
|
17
|
+
|
18
|
+
before do
|
19
|
+
login_as exhibit_curator
|
20
|
+
|
21
|
+
visit spotlight.edit_exhibit_feature_page_path(exhibit, feature_page)
|
22
|
+
add_widget 'browse_group_categories'
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'allows a curator to select a caption to display' do
|
26
|
+
fill_in_prefetched_typeahead_field with: 'Pets', wait_for: '[data-type="browse_group_categories"] [data-browse-groups-fetched]'
|
27
|
+
within '.dd-list' do
|
28
|
+
expect(page).to have_css '.title', text: 'Pets'
|
29
|
+
end
|
30
|
+
|
31
|
+
save_page
|
32
|
+
|
33
|
+
expect(page).to have_css 'h2', text: 'Pets'
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'can navigate using arrows' do
|
37
|
+
fill_in_prefetched_typeahead_field with: 'Pets', wait_for: '[data-type="browse_group_categories"] [data-browse-groups-fetched]'
|
38
|
+
within '.dd-list' do
|
39
|
+
expect(page).to have_css '.title', text: 'Pets'
|
40
|
+
end
|
41
|
+
|
42
|
+
save_page
|
43
|
+
|
44
|
+
expect(page).to have_css 'h2', text: 'Pets'
|
45
|
+
|
46
|
+
expect(page).to have_css '.category-title', text: 'All of the good dogs'
|
47
|
+
expect(page).not_to have_css '.category-title', text: 'All of the good tigers'
|
48
|
+
find('[data-controls="next"]').click
|
49
|
+
expect(page).not_to have_css '.category-title', text: 'All of the good dogs'
|
50
|
+
expect(page).to have_css '.category-title', text: 'All of the good tigers'
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'only published searches are displayed' do
|
54
|
+
fill_in_prefetched_typeahead_field with: 'Pets', wait_for: '[data-type="browse_group_categories"] [data-browse-groups-fetched]'
|
55
|
+
within '.dd-list' do
|
56
|
+
expect(page).to have_css '.title', text: 'Pets'
|
57
|
+
end
|
58
|
+
|
59
|
+
save_page
|
60
|
+
|
61
|
+
expect(page).to have_css 'h2', text: 'Pets'
|
62
|
+
expect(page).to have_css '.box.category-1', count: 6, visible: false
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe 'Browse Group Adminstration', js: true do
|
4
|
+
let(:exhibit) { FactoryBot.create(:exhibit) }
|
5
|
+
let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
|
6
|
+
let!(:group1) do
|
7
|
+
FactoryBot.create(
|
8
|
+
:group,
|
9
|
+
title: 'Good group 1',
|
10
|
+
exhibit: exhibit
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
before { login_as exhibit_curator }
|
15
|
+
|
16
|
+
it 'is able to create new groups' do
|
17
|
+
visit spotlight.exhibit_searches_path(exhibit, anchor: 'browse-groups')
|
18
|
+
|
19
|
+
add_new_via_button('My New Group')
|
20
|
+
|
21
|
+
expect(page).to have_content 'The browse group was created.'
|
22
|
+
expect(page).to have_css('li.dd-item')
|
23
|
+
expect(page).to have_css('h4', text: 'My New Group')
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'updates the page titles' do
|
27
|
+
visit spotlight.exhibit_searches_path(exhibit, anchor: 'browse-groups')
|
28
|
+
|
29
|
+
within("[data-id='#{group1.id}']") do
|
30
|
+
within('h4') do
|
31
|
+
expect(page).to have_content('Good group 1')
|
32
|
+
expect(page).to have_css('.title-field', visible: false)
|
33
|
+
click_link('Good group 1')
|
34
|
+
expect(page).to have_css('.title-field', visible: true)
|
35
|
+
find('.title-field').set('New good group 1')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
click_button('Save changes')
|
39
|
+
within("[data-id='#{group1.id}']") do
|
40
|
+
within('h4') do
|
41
|
+
expect(page).to have_content('New good group 1')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -12,7 +12,7 @@ describe 'Edit in place', type: :feature, js: true do
|
|
12
12
|
|
13
13
|
click_link 'Feature pages'
|
14
14
|
|
15
|
-
|
15
|
+
add_new_via_button('My New Feature Page')
|
16
16
|
|
17
17
|
expect(page).to have_css('h3', text: 'My New Feature Page')
|
18
18
|
|
@@ -38,7 +38,7 @@ describe 'Edit in place', type: :feature, js: true do
|
|
38
38
|
|
39
39
|
click_link 'Feature pages'
|
40
40
|
|
41
|
-
|
41
|
+
add_new_via_button('My New Feature Page')
|
42
42
|
|
43
43
|
expect(page).to have_css('h3', text: 'My New Feature Page')
|
44
44
|
|
@@ -26,7 +26,7 @@ describe 'Feature Pages Adminstration', js: true do
|
|
26
26
|
|
27
27
|
click_link 'Feature pages'
|
28
28
|
|
29
|
-
|
29
|
+
add_new_via_button('My New Page')
|
30
30
|
|
31
31
|
expect(page).to have_content 'The feature page was created.'
|
32
32
|
expect(page).to have_css('li.dd-item')
|
@@ -104,7 +104,7 @@ describe Spotlight::CrudLinkHelpers, type: :helper do
|
|
104
104
|
describe '#action_default_value' do
|
105
105
|
it 'attempts i18n lookups for models' do
|
106
106
|
expect(I18n).to receive(:t).with(:'helpers.action.spotlight/feature_page.edit',
|
107
|
-
model: some_model.class.model_name.human,
|
107
|
+
model: some_model.class.model_name.human.downcase,
|
108
108
|
default: [:'helpers.action.edit', 'Edit Feature page'])
|
109
109
|
expect(helper.send(:action_default_value, some_model))
|
110
110
|
end
|
@@ -112,14 +112,14 @@ describe Spotlight::CrudLinkHelpers, type: :helper do
|
|
112
112
|
it 'attempts i18n lookups for unpersisted models' do
|
113
113
|
some_model = Spotlight::FeaturePage.new
|
114
114
|
expect(I18n).to receive(:t).with(:'helpers.action.spotlight/feature_page.create',
|
115
|
-
model: some_model.class.model_name.human,
|
115
|
+
model: some_model.class.model_name.human.downcase,
|
116
116
|
default: [:'helpers.action.create', 'Create Feature page'])
|
117
117
|
expect(helper.send(:action_default_value, some_model))
|
118
118
|
end
|
119
119
|
|
120
120
|
it 'attempts i18n lookups for models with an explicit action' do
|
121
121
|
expect(I18n).to receive(:t).with(:'helpers.action.spotlight/feature_page.custom_action',
|
122
|
-
model: some_model.class.model_name.human,
|
122
|
+
model: some_model.class.model_name.human.downcase,
|
123
123
|
default: [:'helpers.action.custom_action', 'Custom action Feature page'])
|
124
124
|
expect(helper.send(:action_default_value, some_model, :custom_action))
|
125
125
|
end
|