-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: christinach <actspatial@gmail.com>
- Loading branch information
1 parent
4201489
commit 8aada76
Showing
4 changed files
with
47 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<%= link_to 'Bulk Edit', bulk_edit_resources_edit_url, id: "bulk_edit", class: 'btn btn-primary' %> | ||
<%= link_to 'Bulk Edit', bulk_edit_resources_edit_url, id: "bulk-edit", class: 'btn btn-primary' %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# frozen_string_literal: true | ||
require "rails_helper" | ||
|
||
RSpec.feature "Bulk edit", javascript: true do | ||
let(:user) { FactoryBot.create(:admin) } | ||
let(:adapter) { Valkyrie::MetadataAdapter.find(:indexing_persister) } | ||
let(:collection_title) { "My Collection" } | ||
let(:collection) { FactoryBot.create_for_repository(:collection, title: collection_title) } | ||
let(:member_scanned_resource) do | ||
FactoryBot.create_for_repository(:scanned_resource, title: ["Member Resource"], member_of_collection_ids: [collection.id]) | ||
end | ||
let(:nonmember_scanned_resource) do | ||
FactoryBot.create_for_repository(:scanned_resource, title: ["Nonmember Resource"]) | ||
end | ||
let(:change_set_persister) do | ||
ChangeSetPersister.new(metadata_adapter: adapter, storage_adapter: Valkyrie.config.storage_adapter) | ||
end | ||
|
||
before do | ||
[collection, member_scanned_resource, nonmember_scanned_resource].each do |resource| | ||
change_set = DynamicChangeSet.new(resource) | ||
change_set_persister.save(change_set: change_set) | ||
end | ||
sign_in user | ||
end | ||
|
||
context "the bulk edit button" do | ||
it "will not display in an empty search" do | ||
visit root_path(q: "") | ||
|
||
expect(page).not_to have_css("#bulk-edit") | ||
expect(page).to have_content("My Collection") | ||
expect(page).to have_content("Member Resource") | ||
expect(page).to have_content("Nonmember Resource") | ||
end | ||
|
||
it "will display when a collection is selected" do | ||
visit root_path("q" => "", "f[member_of_collection_titles_ssim][]" => "My Collection") | ||
|
||
expect(page).to have_content("Member Resource") | ||
expect(page).not_to have_content("Nonmember Resource") | ||
expect(page).to have_css("#bulk-edit") | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters