diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e43d185..218780a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * Allow custom error on forms without model. [@victorperez](https://github.com/victorperez) * Do not support Ruby < 2.3 anymore. [@gssbzn](https://github.com/gssbzn) * Add color input type. [@gssbzn](https://github.com/gssbzn) +* Set multiple attribute for grouped selects also. [@ollym](https://github.com/ollym) ### Bug fix * Improve disabled option to input_field. [@betelgeuse](https://github.com/betelgeuse) diff --git a/test/form_builder/association_test.rb b/test/form_builder/association_test.rb index 7ce821bf..369d2e08 100644 --- a/test/form_builder/association_test.rb +++ b/test/form_builder/association_test.rb @@ -243,4 +243,10 @@ class AssociationTest < ActionView::TestCase assert_equal({ as: :check_boxes, collection_wrapper_tag: :ul, item_wrapper_tag: :li }, options) end + + test 'builder with group select considers multiple select by default' do + with_association_for @user, :tags, as: :grouped_select, group_method: :group_method + + assert_select 'select[multiple="multiple"].grouped_select' + end end diff --git a/test/support/models.rb b/test/support/models.rb index 28619767..da25b967 100644 --- a/test/support/models.rb +++ b/test/support/models.rb @@ -76,7 +76,11 @@ Friend = Struct.new(:id, :name) do end end -class Tag < Company; end +class Tag < Company + def group_method + ["category-1"] + end +end TagGroup = Struct.new(:id, :name, :tags)