2019-10-29 15:23:50 -04:00
|
|
|
import EmberObject from "@ember/object";
|
2019-06-06 04:47:10 -04:00
|
|
|
import selectKit from "helpers/select-kit-helper";
|
2019-04-18 13:44:58 -04:00
|
|
|
import componentTest from "helpers/component-test";
|
|
|
|
|
|
|
|
moduleForComponent("group-list", { integration: true });
|
|
|
|
|
|
|
|
componentTest("default", {
|
|
|
|
template: "{{site-setting setting=setting}}",
|
|
|
|
|
|
|
|
beforeEach() {
|
|
|
|
this.site.groups = [
|
|
|
|
{
|
|
|
|
id: 1,
|
|
|
|
name: "Donuts"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 2,
|
|
|
|
name: "Cheese cake"
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
this.set(
|
|
|
|
"setting",
|
2019-10-29 15:23:50 -04:00
|
|
|
EmberObject.create({
|
2019-04-18 13:44:58 -04:00
|
|
|
allowsNone: undefined,
|
|
|
|
category: "foo",
|
|
|
|
default: "",
|
|
|
|
description: "Choose groups",
|
|
|
|
overridden: false,
|
|
|
|
placeholder: null,
|
|
|
|
preview: null,
|
|
|
|
secret: false,
|
|
|
|
setting: "foo_bar",
|
|
|
|
type: "group_list",
|
|
|
|
validValues: undefined,
|
2019-07-19 14:17:58 -04:00
|
|
|
value: "1"
|
2019-04-18 13:44:58 -04:00
|
|
|
})
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
|
|
|
async test(assert) {
|
|
|
|
const subject = selectKit(".list-setting");
|
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
subject.header().value(),
|
2019-07-19 14:17:58 -04:00
|
|
|
"1",
|
2019-04-18 13:44:58 -04:00
|
|
|
"it selects the setting's value"
|
|
|
|
);
|
|
|
|
|
|
|
|
await subject.expand();
|
2019-07-19 14:17:58 -04:00
|
|
|
await subject.selectRowByValue("2");
|
2019-04-18 13:44:58 -04:00
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
subject.header().value(),
|
2019-07-19 14:17:58 -04:00
|
|
|
"1,2",
|
2019-04-18 13:44:58 -04:00
|
|
|
"it allows to select a setting from the list of choices"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|