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