cleaner title attribute for select-box

This commit is contained in:
Joffrey JAFFEUX
2017-09-12 01:36:58 +02:00
committed by GitHub
parent 18114c7bdb
commit c06c88b479
7 changed files with 85 additions and 14 deletions

View File

@ -0,0 +1,23 @@
import componentTest from 'helpers/component-test';
moduleForComponent('dropdown-select-box', { integration: true });
componentTest('the header has a title', {
template: '{{dropdown-select-box content=content value=value}}',
beforeEach() {
this.set("value", 1);
this.set("content", [{ id: 1, text: "apple" }, { id: 2, text: "peach" }]);
},
test(assert) {
andThen(() => {
assert.equal(find(".select-box-header .btn").attr("title"), "apple", "it has the correct title");
});
andThen(() => {
this.set("value", 2);
assert.equal(find(".select-box-header .btn").attr("title"), "peach", "it correctly changes the title");
});
}
});

View File

@ -0,0 +1,34 @@
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");
});
}
});