Files
Joffrey JAFFEUXandGitHub 9cc7b411d9 DEV: replaces topic-notifications-options by DMenu (#30298)
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 />`
2024-12-16 19:59:18 +01:00

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);
}