-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unpin the version of capybara (#1677)
This was originally set in 0ddf30a but this blocks us from using Rails 5.1
- Loading branch information
Showing
2 changed files
with
16 additions
and
15 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
29 changes: 15 additions & 14 deletions
29
spec/helpers/blacklight/hash_as_hidden_fields_behavior_spec.rb
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,22 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
describe Blacklight::HashAsHiddenFieldsHelperBehavior do | ||
before(:each) do | ||
@hash = {:q => "query", :search_field => "search_field", :per_page=>10, :page=>5, :extra_arbitrary_key=>"arbitrary_value", :f=> {:field1 => ["a", "b"], :field2=> ["z"]}} | ||
let(:params) do | ||
{ q: "query", | ||
search_field: "search_field", | ||
per_page: 10, | ||
page: 5, | ||
extra_arbitrary_key: "arbitrary_value", | ||
f: { field1: %w(a b), field2: ["z"] } } | ||
end | ||
let(:generated) { helper.render_hash_as_hidden_fields(params) } | ||
|
||
it "converts a hash with nested complex data to Rails-style hidden form fields" do | ||
|
||
generated = helper.render_hash_as_hidden_fields(@hash) | ||
|
||
expect(generated).to have_selector("input[type='hidden'][name='q'][value='query']") | ||
expect(generated).to have_selector("input[type='hidden'][name='per_page'][value='10']") | ||
expect(generated).to have_selector("input[type='hidden'][name='page'][value='5']") | ||
expect(generated).to have_selector("input[type='hidden'][name='extra_arbitrary_key'][value='arbitrary_value']") | ||
expect(generated).to have_selector("input[type='hidden'][name='f[field2][]'][value='z']") | ||
expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='a']") | ||
expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='b']") | ||
|
||
expect(generated).to have_selector("input[type='hidden'][name='q'][value='query']", visible: false) | ||
expect(generated).to have_selector("input[type='hidden'][name='per_page'][value='10']", visible: false) | ||
expect(generated).to have_selector("input[type='hidden'][name='page'][value='5']", visible: false) | ||
expect(generated).to have_selector("input[type='hidden'][name='extra_arbitrary_key'][value='arbitrary_value']", visible: false) | ||
expect(generated).to have_selector("input[type='hidden'][name='f[field2][]'][value='z']", visible: false) | ||
expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='a']", visible: false) | ||
expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='b']", visible: false) | ||
end | ||
|
||
end |