mirror of
https://github.com/hanzoai/forum.git
synced 2026-09-30 21:51:19 +00:00
This commit introduces <NotificationsTracking /> which is a wrapper component around <DMenu /> which replaces the select-kit component <TopicNotificationsButton />. Each tracking case has its dedicated component: - topic -> `<TopicNotificationsTracking />` - group -> `<GroupNotificationsTracking />` - tag -> `<TagNotificationsTracking />` - category -> `<CategoryNotificationsTracking />` - chat thread -> `<ThreadNotificationsTracking />`
32 lines
799 B
JavaScript
32 lines
799 B
JavaScript
import { click } from "@ember/test-helpers";
|
|
import { query } from "discourse/tests/helpers/qunit-helpers";
|
|
|
|
class Notificationstracking {
|
|
constructor(selector) {
|
|
if (selector instanceof HTMLElement) {
|
|
this.element = selector;
|
|
} else {
|
|
this.element = query(selector);
|
|
}
|
|
}
|
|
|
|
async selectLevelId(levelId) {
|
|
await click(this.element);
|
|
const content = this.content();
|
|
await click(content.querySelector(`[data-level-id="${levelId}"]`));
|
|
}
|
|
|
|
content() {
|
|
const identifier = this.element.dataset.identifier;
|
|
return document.querySelector(
|
|
`[data-content][data-identifier="${identifier}"]`
|
|
);
|
|
}
|
|
}
|
|
|
|
export default function notificationsTracking(
|
|
selector = ".notifications-tracking-trigger"
|
|
) {
|
|
return new Notificationstracking(selector);
|
|
}
|