-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change the way params are parsed from JS (especially arrays). Fixing …
…super select functionality and adding a regression spec. Fixes #79. For super select, stop requesting new results from API as soon as the number of documents returned is below the chosen number of documents per page.
- Loading branch information
Showing
8 changed files
with
3,757 additions
and
26 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
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
3,708 changes: 3,708 additions & 0 deletions
3,708
spec/cassettes/filter_by_journal/considers_journal_filtering_for_select_all.yml
Large diffs are not rendered by default.
Oops, something went wrong.
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,23 @@ | ||
require "spec_helper" | ||
|
||
if Search.plos? | ||
describe "filter by journal", type: :feature, vcr: true do | ||
it "considers journal filtering for select all", js: true do | ||
## Before VCR, requests to foreign APIs can take more than the default 2s | ||
Capybara.default_wait_time = 20 | ||
|
||
visit "/" | ||
fill_in "author", with: "Eisen" | ||
select "PLOS ONE", from: "filterJournals_" | ||
click_button "Search" | ||
page.should have_content "journals: PLOS ONE" | ||
page.should have_content "1 - 25 of 38 results" | ||
page.should have_content "for author: Eisen" | ||
expect(page).to have_button("Preview List (0)", disabled: true) | ||
find(".select-all-articles-link", text: "select all").click | ||
click_link "Select the remaining 13 articles" | ||
wait_for_ajax | ||
expect(page).to have_button("Preview List (38)") | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module WaitForAjax | ||
def wait_for_ajax | ||
Timeout.timeout(Capybara.default_wait_time) do | ||
loop until finished_all_ajax_requests? | ||
end | ||
end | ||
|
||
def finished_all_ajax_requests? | ||
page.evaluate_script('jQuery.active').zero? | ||
end | ||
end | ||
|
||
RSpec.configure do |config| | ||
config.include WaitForAjax, type: :feature | ||
end |