Skip to content

Commit 4e823a2

Browse files
committed
fixed radio spec and allow to use custom id for radio and checkbox inputs
1 parent c0f875d commit 4e823a2

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

app/concepts/matestack/ui/core/form/select/select.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def init_value
7575
end
7676

7777
def id_for_option value
78-
return "#{attr_key}_#{value}"
78+
return "#{@tag_attributes[:id]}_#{value}"
7979
end
8080

8181

spec/usage/components/form/select/radio_button_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ def form_config
110110

111111
visit '/example'
112112

113-
expect(page).to have_selector('#group-one-radio[name="array_input_one_foo"]')
114-
expect(page).to have_selector('#group-one-radio[name="array_input_one_bar"]')
113+
expect(page).to have_selector('#group-one-radio_foo[name="array_input_one_foo"]')
114+
expect(page).to have_selector('#group-one-radio_bar[name="array_input_one_bar"]')
115115

116-
expect(page).to have_selector('#group-two-radio[name="array_input_two_foo"]')
117-
expect(page).to have_selector('#group-two-radio[name="array_input_two_bar"]')
116+
expect(page).to have_selector('#group-two-radio_foo[name="array_input_two_foo"]')
117+
expect(page).to have_selector('#group-two-radio_bar[name="array_input_two_bar"]')
118118
end
119119

120120
end

0 commit comments

Comments
 (0)