2018-06-15 23:03:24 +08:00
|
|
|
import componentTest from "helpers/component-test";
|
2017-11-10 02:57:53 +08:00
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
moduleForComponent("list-setting", { integration: true });
|
2017-11-10 02:57:53 +08:00
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
componentTest("default", {
|
|
|
|
template: "{{list-setting settingValue=settingValue choices=choices}}",
|
2017-11-10 02:57:53 +08:00
|
|
|
|
|
|
|
beforeEach() {
|
2018-06-15 23:03:24 +08:00
|
|
|
this.set("settingValue", "bold|italic");
|
|
|
|
this.set("choices", ["bold", "italic", "underline"]);
|
2017-11-10 02:57:53 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
2018-07-30 04:51:32 +08:00
|
|
|
assert.equal(
|
|
|
|
selectKit()
|
|
|
|
.header()
|
|
|
|
.title(),
|
|
|
|
"bold,italic"
|
|
|
|
);
|
|
|
|
assert.equal(
|
|
|
|
selectKit()
|
|
|
|
.header()
|
|
|
|
.value(),
|
|
|
|
"bold,italic"
|
|
|
|
);
|
2017-11-21 18:53:09 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
componentTest("with empty string as value", {
|
|
|
|
template: "{{list-setting settingValue=settingValue}}",
|
2017-11-21 18:53:09 +08:00
|
|
|
|
|
|
|
beforeEach() {
|
2018-06-15 23:03:24 +08:00
|
|
|
this.set("settingValue", "");
|
2017-11-21 18:53:09 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
2018-07-30 04:51:32 +08:00
|
|
|
assert.equal(
|
|
|
|
selectKit()
|
|
|
|
.header()
|
|
|
|
.value(),
|
|
|
|
""
|
|
|
|
);
|
2017-11-10 02:57:53 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
componentTest("with only setting value", {
|
|
|
|
template: "{{list-setting settingValue=settingValue}}",
|
2017-11-10 02:57:53 +08:00
|
|
|
|
|
|
|
beforeEach() {
|
2018-06-15 23:03:24 +08:00
|
|
|
this.set("settingValue", "bold|italic");
|
2017-11-10 02:57:53 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
2018-07-30 04:51:32 +08:00
|
|
|
assert.equal(
|
|
|
|
selectKit()
|
|
|
|
.header()
|
|
|
|
.value(),
|
|
|
|
"bold,italic"
|
|
|
|
);
|
2017-11-10 02:57:53 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
componentTest("interactions", {
|
|
|
|
template: "{{list-setting settingValue=settingValue choices=choices}}",
|
2017-11-10 02:57:53 +08:00
|
|
|
|
|
|
|
beforeEach() {
|
2018-06-15 23:03:24 +08:00
|
|
|
this.set("settingValue", "bold|italic");
|
|
|
|
this.set("choices", ["bold", "italic", "underline"]);
|
2017-11-10 02:57:53 +08:00
|
|
|
},
|
|
|
|
|
2018-07-30 04:51:32 +08:00
|
|
|
async test(assert) {
|
2017-12-22 20:08:12 +08:00
|
|
|
const listSetting = selectKit();
|
2017-11-10 02:57:53 +08:00
|
|
|
|
2018-07-30 04:51:32 +08:00
|
|
|
await listSetting.expand();
|
|
|
|
await listSetting.selectRowByValue("underline");
|
2017-11-10 02:57:53 +08:00
|
|
|
|
2018-07-30 04:51:32 +08:00
|
|
|
assert.equal(listSetting.header().value(), "bold,italic,underline");
|
2017-11-10 02:57:53 +08:00
|
|
|
|
2018-07-30 04:51:32 +08:00
|
|
|
await listSetting.expand();
|
|
|
|
await listSetting.fillInFilter("strike");
|
2017-11-10 02:57:53 +08:00
|
|
|
|
2018-07-30 04:51:32 +08:00
|
|
|
assert.equal(listSetting.highlightedRow().value(), "strike");
|
2017-11-10 02:57:53 +08:00
|
|
|
|
2018-07-30 04:51:32 +08:00
|
|
|
await listSetting.keyboard("enter");
|
2017-11-10 02:57:53 +08:00
|
|
|
|
2018-07-30 04:51:32 +08:00
|
|
|
assert.equal(listSetting.header().value(), "bold,italic,underline,strike");
|
2017-11-10 02:57:53 +08:00
|
|
|
|
2018-07-30 04:51:32 +08:00
|
|
|
await listSetting.keyboard("backspace");
|
|
|
|
await listSetting.keyboard("backspace");
|
2017-11-10 02:57:53 +08:00
|
|
|
|
2018-07-30 04:51:32 +08:00
|
|
|
assert.equal(listSetting.header().value(), "bold,italic,underline");
|
2017-11-10 02:57:53 +08:00
|
|
|
}
|
|
|
|
});
|