Skip to content

Commit 79ca4f9

Browse files
authoredNov 25, 2024··
Ensure full_width: option is respected by the auto_complete input (#3205)
1 parent 14dd0d3 commit 79ca4f9

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed
 

‎.changeset/seven-experts-return.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/view-components': patch
3+
---
4+
5+
Ensure `full_width:` option is respected by the auto_complete input

‎app/lib/primer/forms/auto_complete.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ def auto_complete_arguments
4040
input_name: all_args[:name],
4141
input_id: all_args[:id],
4242
label_text: @input.label,
43-
list_id: "#{all_args[:id]}-list"
43+
list_id: "#{all_args[:id]}-list",
44+
full_width: @input.full_width?
4445
)
4546
end
4647

‎test/lib/primer/forms/auto_complete_input_test.rb

+24
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,28 @@ def test_only_primer_error_markup
3636
# no rails error markup
3737
refute_selector ".field_with_errors", visible: :all
3838
end
39+
40+
def test_full_width_by_default
41+
render_in_view_context do
42+
primer_form_with(url: "/foo") do |f|
43+
render_inline_form(f) do |auto_complete_form|
44+
auto_complete_form.auto_complete(name: :foo, label: "Foo", src: "/foo")
45+
end
46+
end
47+
end
48+
49+
assert_selector ".FormControl--fullWidth"
50+
end
51+
52+
def test_full_width_can_be_disabled
53+
render_in_view_context do
54+
primer_form_with(url: "/foo") do |f|
55+
render_inline_form(f) do |auto_complete_form|
56+
auto_complete_form.auto_complete(name: :foo, label: "Foo", src: "/foo", full_width: false)
57+
end
58+
end
59+
end
60+
61+
refute_selector ".FormControl--fullWidth"
62+
end
3963
end

0 commit comments

Comments
 (0)
Please sign in to comment.