Skip to content

Commit

Permalink
Merge pull request #1649 from mcountis/inherit_has_required_in_priori…
Browse files Browse the repository at this point in the history
…ty_input

Allow "required" attribute in generated select elements of PriorityInput
  • Loading branch information
feliperenan authored Apr 3, 2019
2 parents de09cbf + 8b38b20 commit e2512f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 0 additions & 4 deletions lib/simple_form/inputs/priority_input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ def input_priority

protected

def has_required?
false
end

def skip_include_blank?
super || input_priority.present?
end
Expand Down
8 changes: 4 additions & 4 deletions test/inputs/priority_input_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ class PriorityInputTest < ActionView::TestCase
assert_no_select 'select option[value=""]', /^$/
end

test 'priority input does not generate invalid required html attribute' do
test 'priority input does generate select element with required html attribute' do
with_input_for @user, :country, :country
assert_select 'select.required'
assert_no_select 'select[required]'
assert_select 'select[required]'
end

test 'priority input does not generate invalid aria-required html attribute' do
test 'priority input does generate select element with aria-required html attribute' do
with_input_for @user, :country, :country
assert_select 'select.required'
assert_no_select 'select[aria-required]'
assert_select 'select[aria-required]'
end
end

0 comments on commit e2512f5

Please sign in to comment.