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

fix: radio field on actions & improve accessibility #3600

Merged
merged 2 commits into from
Jan 21, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<% @field.options.each do |key, value| %>
<div>
<%= form.radio_button @field.id, key %>
<%= form.label @field.id, value: value %>
<%= form.label @field.id, value, value: value %>
</div>
<% end %>
</div>
Expand Down
1 change: 1 addition & 0 deletions spec/dummy/app/avo/actions/sub/dummy_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Avo::Actions::Sub::DummyAction < Avo::BaseAction
end

def fields
field :size, as: :radio, options: {small: "Small Option", medium: "Medium Option", large: "Large Option"}
TestBuddy.hi("Dummy action fields")
field :keep_modal_open, as: :boolean
field :persistent_text, as: :text
Expand Down
16 changes: 16 additions & 0 deletions spec/features/avo/radio_field_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,20 @@
end
end
end

describe "on actions" do
it "display options" do
visit avo.resources_users_path

expect(page).not_to have_text("Small Option")
expect(page).not_to have_text("Medium Option")
expect(page).not_to have_text("Large Option")

open_panel_action(action_name: "Dummy action")

expect(page).to have_text("Small Option")
expect(page).to have_text("Medium Option")
expect(page).to have_text("Large Option")
end
end
end
Loading