Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure full_width: option is respected by the auto_complete input #3205

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/seven-experts-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/view-components': patch
---

Ensure `full_width:` option is respected by the auto_complete input
3 changes: 2 additions & 1 deletion app/lib/primer/forms/auto_complete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ def auto_complete_arguments
input_name: all_args[:name],
input_id: all_args[:id],
label_text: @input.label,
list_id: "#{all_args[:id]}-list"
list_id: "#{all_args[:id]}-list",
full_width: @input.full_width?
)
end

Expand Down
24 changes: 24 additions & 0 deletions test/lib/primer/forms/auto_complete_input_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,28 @@ def test_only_primer_error_markup
# no rails error markup
refute_selector ".field_with_errors", visible: :all
end

def test_full_width_by_default
render_in_view_context do
primer_form_with(url: "/foo") do |f|
render_inline_form(f) do |auto_complete_form|
auto_complete_form.auto_complete(name: :foo, label: "Foo", src: "/foo")
end
end
end

assert_selector ".FormControl--fullWidth"
end

def test_full_width_can_be_disabled
render_in_view_context do
primer_form_with(url: "/foo") do |f|
render_inline_form(f) do |auto_complete_form|
auto_complete_form.auto_complete(name: :foo, label: "Foo", src: "/foo", full_width: false)
end
end
end

refute_selector ".FormControl--fullWidth"
end
end
Loading