2017-04-12 14:54:03 +08:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
|
|
|
acceptance("Topic Notifications button", {
|
|
|
|
loggedIn: true,
|
2017-06-15 01:57:58 +08:00
|
|
|
beforeEach() {
|
2017-04-12 14:54:03 +08:00
|
|
|
const response = object => {
|
|
|
|
return [
|
|
|
|
200,
|
|
|
|
{ "Content-Type": "application/json" },
|
|
|
|
object
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
server.post('/t/280/notifications', () => { // eslint-disable-line no-undef
|
|
|
|
return response({});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
QUnit.test("Updating topic notification level", assert => {
|
2017-04-12 14:54:03 +08:00
|
|
|
visit("/t/internationalization-localization/280");
|
|
|
|
|
2017-09-10 02:29:07 +08:00
|
|
|
const notificationOptions = "#topic-footer-buttons .topic-notifications-options";
|
2017-04-12 14:54:03 +08:00
|
|
|
|
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(
|
2017-04-12 14:54:03 +08:00
|
|
|
exists(`${notificationOptions} .tracking`),
|
|
|
|
"it should display the notification options button in the topic's footer"
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
click(`${notificationOptions} .tracking`);
|
2017-09-11 03:07:13 +08:00
|
|
|
click(`${notificationOptions} .select-box-collection .select-box-row[title=Tracking]`);
|
2017-04-12 14:54:03 +08:00
|
|
|
|
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(
|
2017-04-12 14:54:03 +08:00
|
|
|
exists(`${notificationOptions} .watching`),
|
|
|
|
"it should display the right notification level"
|
|
|
|
);
|
|
|
|
|
2017-04-12 15:52:02 +08:00
|
|
|
// TODO: tgxworld I can't figure out why the topic timeline doesn't show when
|
|
|
|
// running the tests in phantomjs
|
|
|
|
// ok(
|
2017-09-10 02:29:07 +08:00
|
|
|
// exists(".timeline-footer-controls .notifications-button .watching"),
|
2017-04-12 15:52:02 +08:00
|
|
|
// 'it should display the right notification level in topic timeline'
|
|
|
|
// );
|
2017-04-12 14:54:03 +08:00
|
|
|
});
|
2017-09-06 22:58:00 +08:00
|
|
|
});
|