FIX: Share topic shortcut (shift+s) (#22826)
This has been broken for a long time (since 04a63cfaaa
)
This commit is contained in:
parent
7b3f9dc86b
commit
507433f45c
|
@ -106,7 +106,10 @@ const DEFAULT_BINDINGS = {
|
||||||
"shift+k": { handler: "prevSection", anonymous: true },
|
"shift+k": { handler: "prevSection", anonymous: true },
|
||||||
"shift+p": { handler: "pinUnpinTopic" },
|
"shift+p": { handler: "pinUnpinTopic" },
|
||||||
"shift+r": { handler: "replyToTopic" },
|
"shift+r": { handler: "replyToTopic" },
|
||||||
"shift+s": { click: "#topic-footer-buttons button.share", anonymous: true }, // share topic
|
"shift+s": {
|
||||||
|
click: "#topic-footer-buttons button.share-and-invite",
|
||||||
|
anonymous: true,
|
||||||
|
}, // share topic
|
||||||
"shift+l": { handler: "goToUnreadPost" },
|
"shift+l": { handler: "goToUnreadPost" },
|
||||||
"shift+z shift+z": { handler: "logout" },
|
"shift+z shift+z": { handler: "logout" },
|
||||||
"shift+f11": { handler: "fullscreenComposer", global: true },
|
"shift+f11": { handler: "fullscreenComposer", global: true },
|
||||||
|
|
|
@ -244,4 +244,36 @@ acceptance("Keyboard Shortcuts - Authenticated Users", function (needs) {
|
||||||
|
|
||||||
assert.strictEqual(resetNewCalled, 1);
|
assert.strictEqual(resetNewCalled, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("share shortcuts", async function (assert) {
|
||||||
|
await visit("/t/this-is-a-test-topic/9");
|
||||||
|
await triggerKeyEvent(document, "keypress", "J");
|
||||||
|
assert.ok(
|
||||||
|
exists(".post-stream .topic-post.selected #post_1"),
|
||||||
|
"first post is selected"
|
||||||
|
);
|
||||||
|
|
||||||
|
await triggerKeyEvent(document, "keypress", "J");
|
||||||
|
assert.ok(
|
||||||
|
exists(".post-stream .topic-post.selected #post_2"),
|
||||||
|
"pressing j moves selection to next post"
|
||||||
|
);
|
||||||
|
|
||||||
|
await triggerKeyEvent(document, "keypress", "S");
|
||||||
|
assert
|
||||||
|
.dom(".d-modal.share-topic-modal")
|
||||||
|
.exists("post-specific share modal is open");
|
||||||
|
assert
|
||||||
|
.dom("#discourse-modal-title")
|
||||||
|
.hasText(I18n.t("post.share.title", { post_number: 2 }));
|
||||||
|
await click(".modal-close");
|
||||||
|
|
||||||
|
await triggerKeyEvent(document, "keydown", "S", { shiftKey: true });
|
||||||
|
assert
|
||||||
|
.dom(".d-modal.share-topic-modal")
|
||||||
|
.exists("topic level share modal is open");
|
||||||
|
assert.dom("#discourse-modal-title").hasText(I18n.t("topic.share.title"));
|
||||||
|
|
||||||
|
await click(".modal-close");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue