2017-04-12 14:54:03 +08:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
|
|
|
acceptance("Topic Notifications button", {
|
|
|
|
loggedIn: true,
|
2017-06-14 13:57:58 -04:00
|
|
|
beforeEach() {
|
2017-04-12 14:54:03 +08:00
|
|
|
const response = object => {
|
2018-06-15 17:03:24 +02:00
|
|
|
return [200, { "Content-Type": "application/json" }, object];
|
2017-04-12 14:54:03 +08:00
|
|
|
};
|
|
|
|
|
2018-06-15 18:18:45 +02:00
|
|
|
// prettier-ignore
|
|
|
|
server.post("/t/280/notifications", () => { // eslint-disable-line no-undef
|
2017-04-12 14:54:03 +08:00
|
|
|
return response({});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
QUnit.test("Updating topic notification level", assert => {
|
2018-06-15 17:03:24 +02:00
|
|
|
const notificationOptions = selectKit(
|
|
|
|
"#topic-footer-buttons .topic-notifications-options"
|
|
|
|
);
|
2017-04-12 14:54:03 +08:00
|
|
|
|
2017-12-22 13:08:12 +01:00
|
|
|
visit("/t/internationalization-localization/280");
|
2017-04-12 14:54:03 +08:00
|
|
|
|
|
|
|
andThen(() => {
|
2017-06-14 13:57:58 -04:00
|
|
|
assert.ok(
|
2017-12-22 13:08:12 +01:00
|
|
|
notificationOptions.exists(),
|
2017-04-12 14:54:03 +08:00
|
|
|
"it should display the notification options button in the topic's footer"
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2017-12-22 13:08:12 +01:00
|
|
|
notificationOptions.expand().selectRowByValue("3");
|
2017-04-12 14:54:03 +08:00
|
|
|
|
|
|
|
andThen(() => {
|
2017-10-19 12:51:08 -07:00
|
|
|
assert.equal(
|
2017-12-22 13:08:12 +01:00
|
|
|
notificationOptions.selectedRow().name(),
|
|
|
|
"Watching",
|
2017-04-12 14:54:03 +08:00
|
|
|
"it should display the right notification level"
|
|
|
|
);
|
|
|
|
});
|
2017-09-06 16:58:00 +02:00
|
|
|
});
|