mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 17:02:45 +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
|
<DModal
|
||||||
@closeModal={{@closeModal}}
|
@closeModal={{@closeModal}}
|
||||||
class="discard-draft-modal"
|
class="discard-draft-modal"
|
||||||
@dismissable={{false}}
|
@hideHeader={{true}}
|
||||||
>
|
>
|
||||||
<:body>
|
<:body>
|
||||||
<div class="instructions" role="heading" aria-level="1">
|
<div class="instructions" role="heading" aria-level="1">
|
||||||
|
|
|
@ -994,6 +994,31 @@ acceptance("Composer", function (needs) {
|
||||||
await click(".save-or-cancel .cancel");
|
await click(".save-or-cancel .cancel");
|
||||||
assert.dom(".discard-draft-modal .save-draft").exists();
|
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) {
|
acceptance("Composer - Customizations", function (needs) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user