-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display edit button when checking boxes on shared works tab
Patched in the code that Scholarsphere was using on its sort_and_per_page partial Fixes #2419
- Loading branch information
Showing
3 changed files
with
42 additions
and
9 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
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,33 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe 'my/_sort_and_per_page.html.erb', type: :view do | ||
let(:mock_response) { double(response: { 'numFound' => 7 }) } | ||
let(:sort_fields) { double(empty?: true) } | ||
|
||
before do | ||
@response = mock_response | ||
allow(view).to receive(:sort_fields).and_return(sort_fields) | ||
end | ||
|
||
context "on my works page" do | ||
before do | ||
allow(view).to receive(:on_my_works?).and_return(true) | ||
render | ||
end | ||
it "has buttons" do | ||
expect(rendered).to have_selector('button', text: 'Add to Collection') | ||
expect(rendered).to have_selector('input[value="Edit Selected"]') | ||
end | ||
end | ||
|
||
context "not on my works page (i.e. Works shared with me)" do | ||
before do | ||
allow(view).to receive(:on_my_works?).and_return(false) | ||
render | ||
end | ||
it "has buttons" do | ||
expect(rendered).not_to have_selector('button', text: 'Add to Collection') | ||
expect(rendered).to have_selector('input[value="Edit Selected"]') | ||
end | ||
end | ||
end |