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

35 lines
858 B
Plaintext
Raw Normal View History

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