File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 33require 'test_helper'
44
55class CountryInputTest < ActionView ::TestCase
6+ COUNTRY_SELECT_SEPARATOR =
7+ if Gem ::Version . new ( CountrySelect ::VERSION ) >= Gem ::Version . new ( "11.0.0" )
8+ "hr"
9+ else
10+ 'option[value="---------------"][disabled=disabled]'
11+ end
12+
613 test 'input generates a country select field' do
714 with_input_for @user , :country , :country
815 assert_select 'select#user_country'
916 assert_select 'select option[value=BR]' , 'Brazil'
1017 assert_no_select 'select option[value=""][disabled=disabled]'
18+ assert_no_select "select #{ COUNTRY_SELECT_SEPARATOR } "
1119 end
1220
1321 test 'input generates a country select with SimpleForm default' do
1422 swap SimpleForm , country_priority : [ 'Brazil' ] do
1523 with_input_for @user , :country , :country
16- assert_select ' select option[value="BR"] + option[value="---------------"][disabled=disabled]'
24+ assert_select %( select option[value="BR"] + #{ COUNTRY_SELECT_SEPARATOR } )
1725 end
1826 end
1927
2028 test 'input generates a country select using options priority' do
2129 with_input_for @user , :country , :country , priority : [ 'Ukraine' ]
22- assert_select ' select option[value="UA"] + option[value="---------------"][disabled=disabled]'
30+ assert_select %( select option[value="UA"] + #{ COUNTRY_SELECT_SEPARATOR } )
2331 end
2432
2533 test 'input does generate select element with required html attribute' do
You can’t perform that action at this time.
0 commit comments