Skip to content

Commit a14131e

Browse files
authored
fix: radio field on actions & improve accessibility (#3600)
* fix: radio field on actions * Update spec/features/avo/radio_field_spec.rb
1 parent 20a3646 commit a14131e

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

app/components/avo/fields/radio_field/edit_component.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<% @field.options.each do |key, value| %>
44
<div>
55
<%= form.radio_button @field.id, key %>
6-
<%= form.label @field.id, value: value %>
6+
<%= form.label @field.id, value, value: value %>
77
</div>
88
<% end %>
99
</div>

spec/dummy/app/avo/actions/sub/dummy_action.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class Avo::Actions::Sub::DummyAction < Avo::BaseAction
1313
end
1414

1515
def fields
16+
field :size, as: :radio, options: {small: "Small Option", medium: "Medium Option", large: "Large Option"}
1617
TestBuddy.hi("Dummy action fields")
1718
field :keep_modal_open, as: :boolean
1819
field :persistent_text, as: :text

spec/features/avo/radio_field_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,20 @@
6262
end
6363
end
6464
end
65+
66+
describe "on actions" do
67+
it "display options" do
68+
visit avo.resources_users_path
69+
70+
expect(page).not_to have_text("Small Option")
71+
expect(page).not_to have_text("Medium Option")
72+
expect(page).not_to have_text("Large Option")
73+
74+
open_panel_action(action_name: "Dummy action")
75+
76+
expect(page).to have_text("Small Option")
77+
expect(page).to have_text("Medium Option")
78+
expect(page).to have_text("Large Option")
79+
end
80+
end
6581
end

0 commit comments

Comments
 (0)