-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 #1782 from heartcombo/country-timezone-split
Split country and timezone inputs to fix deprecated way of passing priority countries to country input.
- Loading branch information
Showing
7 changed files
with
66 additions
and
37 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
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,36 @@ | ||
# frozen_string_literal: true | ||
# encoding: UTF-8 | ||
require 'test_helper' | ||
|
||
class CountryInputTest < ActionView::TestCase | ||
test 'input generates a country select field' do | ||
with_input_for @user, :country, :country | ||
assert_select 'select#user_country' | ||
assert_select 'select option[value=BR]', 'Brazil' | ||
assert_no_select 'select option[value=""][disabled=disabled]' | ||
end | ||
|
||
test 'input generates a country select with SimpleForm default' do | ||
swap SimpleForm, country_priority: [ 'Brazil' ] do | ||
with_input_for @user, :country, :country | ||
assert_select 'select option[value="BR"] + option[value="---------------"][disabled=disabled]' | ||
end | ||
end | ||
|
||
test 'input generates a country select using options priority' do | ||
with_input_for @user, :country, :country, priority: [ 'Ukraine' ] | ||
assert_select 'select option[value="UA"] + option[value="---------------"][disabled=disabled]' | ||
end | ||
|
||
test 'input does generate select element with required html attribute' do | ||
with_input_for @user, :country, :country | ||
assert_select 'select.required' | ||
assert_select 'select[required]' | ||
end | ||
|
||
test 'input does generate select element with aria-required html attribute' do | ||
with_input_for @user, :country, :country | ||
assert_select 'select.required' | ||
assert_select 'select[aria-required]' | ||
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