Skip to content

Commit

Permalink
[MAIN] FIX AttributeMerger (#84)
Browse files Browse the repository at this point in the history
* FIX AttributeMerger
  • Loading branch information
pierry01 authored Aug 21, 2024
1 parent 74c9811 commit 07448d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/phlex_ui/attribute_merger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def mix(*args)
when Array
old.is_a?(Array) ? (old + new) : new
when String
old.is_a?(String) ? "#{old} #{new}" : new
value = "#{old} #{new}".split.uniq.join(" ")
old.is_a?(String) ? value : new
else
new
end
Expand Down
3 changes: 2 additions & 1 deletion test/phlex_ui/select_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_render_with_all_items

output = phlex_context do
PhlexUI.Select do
PhlexUI.SelectInput
PhlexUI.SelectInput(name: "NAME")
PhlexUI.SelectTrigger do
PhlexUI.SelectValue(placeholder: "Placeholder")
end
Expand All @@ -29,5 +29,6 @@ def test_render_with_all_items
end

assert_match(/John/, output)
assert_match('name="NAME"', output)
end
end

0 comments on commit 07448d6

Please sign in to comment.