From b4ef427f32f70c2749f9d926433d5bf5f6d87b52 Mon Sep 17 00:00:00 2001 From: Jose Farias Date: Fri, 8 Mar 2024 18:09:10 -0600 Subject: [PATCH] Reorder component tests --- .../hotwire_combobox/component_test.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/presenters/hotwire_combobox/component_test.rb b/test/presenters/hotwire_combobox/component_test.rb index e8218ae..930119d 100644 --- a/test/presenters/hotwire_combobox/component_test.rb +++ b/test/presenters/hotwire_combobox/component_test.rb @@ -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" } @@ -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