mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
DEV: Close user menu after clicking view-all notifications (#25966)
We needed to call closeUserMenu after navigating to the show all notifications url.
This commit is contained in:
parent
6c2c690479
commit
841b353d38
@ -10,13 +10,14 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<div class="panel-body-bottom">
|
<div class="panel-body-bottom">
|
||||||
{{#if this.showAllHref}}
|
{{#if this.showAllHref}}
|
||||||
<a
|
<DButton
|
||||||
class="btn btn-default btn-icon no-text show-all"
|
class="show-all"
|
||||||
href={{this.showAllHref}}
|
@action={{this.showAll}}
|
||||||
title={{this.showAllTitle}}
|
@translatedAriaLabel={{this.showAllTitle}}
|
||||||
|
@translatedTitle={{this.showAllTitle}}
|
||||||
>
|
>
|
||||||
{{d-icon "chevron-down" aria-label=this.showAllTitle}}
|
{{d-icon "chevron-down" aria-label=this.showAllTitle}}
|
||||||
</a>
|
</DButton>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if this.showDismiss}}
|
{{#if this.showDismiss}}
|
||||||
<button
|
<button
|
||||||
|
@ -2,6 +2,7 @@ import Component from "@glimmer/component";
|
|||||||
import { tracked } from "@glimmer/tracking";
|
import { tracked } from "@glimmer/tracking";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import { inject as service } from "@ember/service";
|
import { inject as service } from "@ember/service";
|
||||||
|
import DiscourseURL from "discourse/lib/url";
|
||||||
|
|
||||||
export default class UserMenuItemsList extends Component {
|
export default class UserMenuItemsList extends Component {
|
||||||
@service session;
|
@service session;
|
||||||
@ -86,4 +87,10 @@ export default class UserMenuItemsList extends Component {
|
|||||||
`dismissButtonClick must be implemented in ${this.constructor.name}.`
|
`dismissButtonClick must be implemented in ${this.constructor.name}.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
showAll() {
|
||||||
|
DiscourseURL.routeTo(this.showAllHref);
|
||||||
|
this.args.closeUserMenu();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,17 +27,13 @@ module(
|
|||||||
assert.ok(items[1].classList.contains("bookmark"));
|
assert.ok(items[1].classList.contains("bookmark"));
|
||||||
});
|
});
|
||||||
|
|
||||||
test("show all link", async function (assert) {
|
test("show all button for bookmark notifications", async function (assert) {
|
||||||
await render(template);
|
await render(template);
|
||||||
const link = query(".panel-body-bottom .show-all");
|
const link = query(".panel-body-bottom .show-all");
|
||||||
assert.ok(
|
|
||||||
link.href.endsWith("/u/eviltrout/activity/bookmarks"),
|
|
||||||
"links to the bookmarks page"
|
|
||||||
);
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
link.title,
|
link.title,
|
||||||
I18n.t("user_menu.view_all_bookmarks"),
|
I18n.t("user_menu.view_all_bookmarks"),
|
||||||
"has a title"
|
"has the correct title"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -253,17 +253,13 @@ module("Integration | Component | user-menu | messages-list", function (hooks) {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("show all link", async function (assert) {
|
test("show all button for message notifications", async function (assert) {
|
||||||
await render(template);
|
await render(template);
|
||||||
const link = query(".panel-body-bottom .show-all");
|
const link = query(".panel-body-bottom .show-all");
|
||||||
assert.ok(
|
|
||||||
link.href.endsWith("/u/eviltrout/messages"),
|
|
||||||
"links to the user's messages page"
|
|
||||||
);
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
link.title,
|
link.title,
|
||||||
I18n.t("user_menu.view_all_messages"),
|
I18n.t("user_menu.view_all_messages"),
|
||||||
"has a title"
|
"has the correct title"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -65,17 +65,13 @@ module(
|
|||||||
assert.strictEqual(queryParams.silent, undefined);
|
assert.strictEqual(queryParams.silent, undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("displays a show all button that takes to the notifications page of the current user", async function (assert) {
|
test("show all button for all notifications page", async function (assert) {
|
||||||
await render(template);
|
await render(template);
|
||||||
const showAllBtn = query(".panel-body-bottom .btn.show-all");
|
const showAllBtn = query(".panel-body-bottom .btn.show-all");
|
||||||
assert.ok(
|
|
||||||
showAllBtn.href.endsWith("/u/eviltrout/notifications"),
|
|
||||||
"it takes you to the notifications page"
|
|
||||||
);
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
showAllBtn.getAttribute("title"),
|
showAllBtn.title,
|
||||||
I18n.t("user_menu.view_all_notifications"),
|
I18n.t("user_menu.view_all_notifications"),
|
||||||
"title attribute is present"
|
"has the correct title"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -12,14 +12,13 @@ module(
|
|||||||
|
|
||||||
const template = hbs`<UserMenu::ReviewablesList/>`;
|
const template = hbs`<UserMenu::ReviewablesList/>`;
|
||||||
|
|
||||||
test("has a 'show all' link", async function (assert) {
|
test("show all button for reviewable notifications", async function (assert) {
|
||||||
await render(template);
|
await render(template);
|
||||||
const showAll = query(".panel-body-bottom a.show-all");
|
const showAll = query(".panel-body-bottom .show-all");
|
||||||
assert.ok(showAll.href.endsWith("/review"), "links to the /review page");
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
showAll.title,
|
showAll.title,
|
||||||
I18n.t("user_menu.reviewable.view_all"),
|
I18n.t("user_menu.reviewable.view_all"),
|
||||||
"the 'show all' link has a title"
|
"has the correct title"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user