DEV: ctrl+click on user menu items should open in new tab (#18243)
This commit is contained in:
parent
5ee760dc2c
commit
2f428023da
|
@ -1,4 +1,5 @@
|
|||
import DiscourseURL from "discourse/lib/url";
|
||||
import { wantsNewWindow } from "discourse/lib/intercept-click";
|
||||
|
||||
export default class UserMenuBaseItem {
|
||||
get className() {}
|
||||
|
@ -30,6 +31,9 @@ export default class UserMenuBaseItem {
|
|||
get topicId() {}
|
||||
|
||||
onClick({ event, closeUserMenu }) {
|
||||
if (wantsNewWindow(event)) {
|
||||
return;
|
||||
}
|
||||
closeUserMenu();
|
||||
const href = this.linkHref;
|
||||
if (href) {
|
||||
|
|
|
@ -112,6 +112,25 @@ acceptance("User menu", function (needs) {
|
|||
exists(".user-menu"),
|
||||
"clicking on the same item again closes the menu"
|
||||
);
|
||||
|
||||
await click(".d-header-icons .current-user");
|
||||
await click("#user-menu-button-review-queue");
|
||||
// this may not be ideal because it actually attempts to open a new tab
|
||||
// which gets blocked by the browser, but otherwise it seems harmless and
|
||||
// doesn't cause the test to fail. if it causes problems for you, feel free
|
||||
// to remove the ctrl+click tests.
|
||||
await click("#quick-access-review-queue li.reviewable.reviewed a", {
|
||||
ctrlKey: true,
|
||||
});
|
||||
assert.strictEqual(
|
||||
currentURL(),
|
||||
"/review/17",
|
||||
"ctrl-clicking on an item doesn't navigate to a new page"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".user-menu"),
|
||||
"ctrl-clicking on an item doesn't close the menu"
|
||||
);
|
||||
});
|
||||
|
||||
test("tabs added via the plugin API", async function (assert) {
|
||||
|
|
Loading…
Reference in New Issue