2019-06-06 16:47:10 +08:00
|
|
|
import selectKit from "helpers/select-kit-helper";
|
2017-04-12 14:54:03 +08:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
2019-06-06 16:47:10 +08:00
|
|
|
|
2017-04-12 14:54:03 +08:00
|
|
|
acceptance("Topic Notifications button", {
|
|
|
|
loggedIn: true,
|
2018-07-26 18:16:32 +08:00
|
|
|
pretend(server, helper) {
|
|
|
|
server.post("/t/280/notifications", () => {
|
|
|
|
return helper.response({});
|
2017-04-12 14:54:03 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-07-26 18:16:32 +08:00
|
|
|
QUnit.test("Updating topic notification level", async assert => {
|
2018-06-15 23:03:24 +08:00
|
|
|
const notificationOptions = selectKit(
|
|
|
|
"#topic-footer-buttons .topic-notifications-options"
|
|
|
|
);
|
2017-04-12 14:54:03 +08:00
|
|
|
|
2018-07-26 18:16:32 +08:00
|
|
|
await visit("/t/internationalization-localization/280");
|
2017-04-12 14:54:03 +08:00
|
|
|
|
2018-07-26 18:16:32 +08:00
|
|
|
assert.ok(
|
|
|
|
notificationOptions.exists(),
|
|
|
|
"it should display the notification options button in the topic's footer"
|
|
|
|
);
|
2017-04-12 14:54:03 +08:00
|
|
|
|
2018-07-30 04:51:32 +08:00
|
|
|
await notificationOptions.expand();
|
|
|
|
await notificationOptions.selectRowByValue("3");
|
2017-04-12 14:54:03 +08:00
|
|
|
|
2018-07-26 18:16:32 +08:00
|
|
|
assert.equal(
|
2020-02-03 21:22:14 +08:00
|
|
|
notificationOptions.header().label(),
|
2018-07-26 18:16:32 +08:00
|
|
|
"Watching",
|
|
|
|
"it should display the right notification level"
|
|
|
|
);
|
2020-02-22 04:32:58 +08:00
|
|
|
|
|
|
|
const timelineNotificationOptions = selectKit(
|
|
|
|
".topic-timeline .widget-component-connector .topic-notifications-options"
|
|
|
|
);
|
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
timelineNotificationOptions.header().value(),
|
|
|
|
"3",
|
|
|
|
"it should display the right notification level"
|
|
|
|
);
|
|
|
|
|
|
|
|
await timelineNotificationOptions.expand();
|
|
|
|
await timelineNotificationOptions.selectRowByValue("0");
|
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
timelineNotificationOptions.header().value(),
|
|
|
|
"0",
|
|
|
|
"it should display the right notification level"
|
|
|
|
);
|
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
notificationOptions.header().label(),
|
|
|
|
"Muted",
|
|
|
|
"it should display the right notification level"
|
|
|
|
);
|
2017-09-06 22:58:00 +08:00
|
|
|
});
|