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