-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #580 from sul-dlss/select-all
Add '(De)Select all' buttons to the Metadata Curation page.
- Loading branch information
Showing
6 changed files
with
114 additions
and
4 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 |
---|---|---|
|
@@ -56,5 +56,8 @@ | |
} | ||
text-align:center; | ||
} | ||
|
||
.metadata-select { | ||
display: inline-block; | ||
min-width: 72px; | ||
} | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require "spec_helper" | ||
|
||
feature "Metadata Administration", js: true do | ||
let(:exhibit) { FactoryGirl.create(:exhibit) } | ||
let(:admin) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) } | ||
before { login_as admin } | ||
describe "Select/Deselect all button" do | ||
it "should deselect all checkboxes when all are selected" do | ||
visit spotlight.exhibit_edit_metadata_path exhibit | ||
# No checkboxes should be unchecked | ||
expect(page).not_to have_css("tr td:nth-child(2) input[type='checkbox']:not(:checked)") | ||
within("tr th:nth-child(2)") do | ||
click_button "Deselect all" | ||
expect(page).to have_css("button", text: "Select all", visible: true) | ||
end | ||
# No checkboxes should be checked | ||
expect(page).not_to have_css("tr td:nth-child(2) input[type='checkbox']:checked") | ||
end | ||
it "should select all checkboxes when any are unselected" do | ||
visit spotlight.exhibit_edit_metadata_path exhibit | ||
# No checkboxes should be unchecked | ||
expect(page).not_to have_css("tr td:nth-child(2) input[type='checkbox']:not(:checked)") | ||
first_button_area = find("tr th:nth-child(2)") | ||
within first_button_area do | ||
expect(page).to have_css("button", text: "Deselect all") | ||
end | ||
# Uncheck first checkbox | ||
find("tr:first-child td:nth-child(2) input[type='checkbox']").set(false) | ||
# A checkbox should be checked | ||
expect(page).to have_css("tr td:nth-child(2) input[type='checkbox']:checked") | ||
within first_button_area do | ||
click_button "Select all" | ||
end | ||
# No checkboxes should be unchecked | ||
expect(page).not_to have_css("tr td:nth-child(2) input[type='checkbox']:not(:checked)") | ||
end | ||
end | ||
end |