-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change: add novalidate attribute to the form tag when browser_validat…
…ions are disabled
- Loading branch information
Showing
3 changed files
with
45 additions
and
2 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,39 @@ | ||
require 'spec_helper' | ||
|
||
describe RailsAdmin::MainHelper, type: :helper do | ||
describe '#rails_admin_form_for' do | ||
let(:html_form) do | ||
helper.rails_admin_form_for(FieldTest.new, url: new_path(model_name: 'field_test')) {} | ||
end | ||
|
||
context 'with html5 browser_validations enabled' do | ||
before do | ||
RailsAdmin.config.browser_validations = true | ||
RailsAdmin.config FieldTest do | ||
field :address, :string do | ||
required true | ||
end | ||
end | ||
end | ||
|
||
it 'should do something' do | ||
expect(html_form).to_not include 'novalidate' | ||
end | ||
end | ||
|
||
context 'with html5 browser_validations disabled' do | ||
before do | ||
RailsAdmin.config.browser_validations = false | ||
RailsAdmin.config FieldTest do | ||
field :address, :string do | ||
required true | ||
end | ||
end | ||
end | ||
|
||
it 'should do something' do | ||
expect(html_form).to include "novalidate=\"novalidate\"" | ||
end | ||
end | ||
end | ||
end |