mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 13:52:50 +08:00
A11Y: Allow dismissing the discard drafts modal via keyboard (#29802)
This commit is contained in:
parent
d85bc1eff6
commit
f1849199e9
|
@ -21,7 +21,7 @@ export default class DiscardDraftModal extends Component {
|
|||
<DModal
|
||||
@closeModal={{@closeModal}}
|
||||
class="discard-draft-modal"
|
||||
@dismissable={{false}}
|
||||
@hideHeader={{true}}
|
||||
>
|
||||
<:body>
|
||||
<div class="instructions" role="heading" aria-level="1">
|
||||
|
|
|
@ -994,6 +994,31 @@ acceptance("Composer", function (needs) {
|
|||
await click(".save-or-cancel .cancel");
|
||||
assert.dom(".discard-draft-modal .save-draft").exists();
|
||||
});
|
||||
|
||||
test("Discard drafts modal can be dismissed via keyboard", async function (assert) {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .create");
|
||||
|
||||
await fillIn(".d-editor-input", "[quote]some quote[/quote]");
|
||||
|
||||
await click(".save-or-cancel .cancel");
|
||||
assert.dom(".discard-draft-modal .save-draft").exists();
|
||||
|
||||
await triggerKeyEvent(
|
||||
".discard-draft-modal .save-draft",
|
||||
"keydown",
|
||||
"Escape"
|
||||
);
|
||||
|
||||
assert.dom(".discard-draft-modal").doesNotExist();
|
||||
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
"[quote]some quote[/quote]",
|
||||
"composer textarea is not cleared"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
acceptance("Composer - Customizations", function (needs) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user