Skip to content

Commit 3620082

Browse files
committed
add a test case
1 parent 374c05b commit 3620082

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

test/components/primer/open_project/danger_dialog_test.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,4 +282,24 @@ def test_renders_additional_details
282282
assert_selector(".DangerDialog-additionalDetails", text: "Additional important information.")
283283
end
284284
end
285+
286+
def test_renders_live_region_for_confirmation_checkbox
287+
render_inline(Primer::OpenProject::DangerDialog.new(
288+
title: "Danger confirmation action",
289+
confirmation_live_message_checked: "Checkbox checked — you can proceed.",
290+
confirmation_live_message_unchecked: "Please check the confirmation box to continue."
291+
)) do |dialog|
292+
dialog.with_confirmation_message do |message|
293+
message.with_heading(tag: :h2) { "Danger" }
294+
end
295+
dialog.with_confirmation_check_box { "I confirm this deletion" }
296+
end
297+
298+
# Check that the live region exists and is sr-only
299+
assert_selector("div.sr-only[data-target='danger-dialog-form-helper.liveRegion']")
300+
301+
live_region = page.find_css("div.sr-only[data-target='danger-dialog-form-helper.liveRegion']").first
302+
assert_equal "assertive", live_region.attributes["aria-live"].value
303+
assert_equal "true", live_region.attributes["aria-atomic"].value
304+
end
285305
end

0 commit comments

Comments
 (0)