discourse/test/javascripts/components/topic-notifications-button-test.js.es6

35 lines
866 B
Plaintext
Raw Normal View History

2017-09-12 07:36:58 +08:00
import componentTest from 'helpers/component-test';
import Topic from 'discourse/models/topic';
const buildTopic = function(level) {
2017-09-12 07:36:58 +08:00
return Topic.create({
id: 4563,
title: "Qunit Test Topic",
details: {
notification_level: level
2017-09-12 07:36:58 +08:00
}
});
};
moduleForComponent('topic-notifications-button', { integration: true });
componentTest('the header has a localized title', {
template: '{{topic-notifications-button notificationLevel=topic.details.notification_level topic=topic}}',
2017-09-12 07:36:58 +08:00
beforeEach() {
this.set("topic", buildTopic(1));
2017-09-12 07:36:58 +08:00
},
test(assert) {
andThen(() => {
assert.equal(selectKit().header().name(), "Normal", "it has the correct title");
2017-09-12 07:36:58 +08:00
});
this.set("topic", buildTopic(2));
2017-09-12 07:36:58 +08:00
andThen(() => {
assert.equal(selectKit().header().name(), "Tracking", "it correctly changes the title");
2017-09-12 07:36:58 +08:00
});
}
});