File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
app/components/primer/open_project
test/components/primer/open_project Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ class DangerDialog < Primer::Component
2020 # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
2121 renders_one :confirmation_message , lambda { |icon_arguments : { } , **system_arguments |
2222 system_arguments [ :border ] = false
23+ system_arguments [ :id ] = "#{ dialog_id } -description"
2324
2425 icon_arguments [ :icon ] ||= :"alert"
2526 icon_arguments [ :color ] ||= :danger
Original file line number Diff line number Diff line change @@ -30,6 +30,18 @@ def test_renders_alertdialog_role
3030 assert_selector ( "dialog[aria-modal=true]" )
3131 end
3232
33+ def test_renders_aria_describedby
34+ render_inline ( Primer ::OpenProject ::DangerDialog . new ( title : "Danger action" ) ) do |dialog |
35+ dialog . with_confirmation_message do |message |
36+ message . with_heading ( tag : :h2 ) { "Danger" }
37+ end
38+ end
39+
40+ dialog_labelledby_id = page . find_css ( "dialog" ) . first . attributes [ "aria-describedby" ] . value
41+ feedback_message_id = page . find_css ( ".FeedbackMessage" ) . first . attributes [ "id" ] . value
42+ assert_equal dialog_labelledby_id , feedback_message_id
43+ end
44+
3345 def test_renders_default_button_text
3446 render_inline ( Primer ::OpenProject ::DangerDialog . new ( title : "Danger action" ) ) do |dialog |
3547 dialog . with_confirmation_message do |message |
You can’t perform that action at this time.
0 commit comments