discourse/test/javascripts/acceptance/topic-notifications-button-...

40 lines
996 B
Plaintext
Raw Normal View History

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