Skip to content

Commit

Permalink
Reorder component tests
Browse files Browse the repository at this point in the history
  • Loading branch information
josefarias committed Mar 9, 2024
1 parent e265999 commit b4ef427
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/presenters/hotwire_combobox/component_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ class HotwireCombobox::ComponentTest < ApplicationViewTestCase
end
end

test "attributes can be customized" do
component = HotwireCombobox::Component.new(view, "field-name", id: "id-string")
component.customize_input class: "my-custom-class", data: { my_custom_attr: "value" }
html = render component

assert_attrs html, tag_name: :input, class: "hw-combobox__input my-custom-class"
assert_attrs html, tag_name: :input, "data-my-custom-attr": "value"
end

test "protected attributes cannot be overridden" do
component = HotwireCombobox::Component.new(view, "field-name", id: "id-string")
component.customize_input id: "foo", name: "bar", role: "baz", value: "qux", aria: { haspopup: "foobar" }, data: { hw_combobox_target: "thud" }
Expand All @@ -26,13 +35,4 @@ class HotwireCombobox::ComponentTest < ApplicationViewTestCase

assert_no_attrs html, tag_name: :input, value: ""
end

test "attributes can be customized" do
component = HotwireCombobox::Component.new(view, "field-name", id: "id-string")
component.customize_input class: "my-custom-class", data: { my_custom_attr: "value" }
html = render component

assert_attrs html, tag_name: :input, class: "hw-combobox__input my-custom-class"
assert_attrs html, tag_name: :input, "data-my-custom-attr": "value"
end
end

0 comments on commit b4ef427

Please sign in to comment.