DEV: select-kit 2 (#7998)

This new iteration of select-kit focuses on following best principales and disallowing mutations inside select-kit components. A best effort has been made to avoid breaking changes, however if you content was a flat array, eg: ["foo", "bar"] You will need to set valueProperty=null and nameProperty=null on the component.

Also almost every component should have an `onChange` handler now to decide what to do with the updated data. **select-kit will not mutate your data by itself anymore**
This commit is contained in:
Joffrey JAFFEUX
2020-02-03 14:22:14 +01:00
committed by GitHub
parent 0e2cbee339
commit 0431942f3d
278 changed files with 7566 additions and 6957 deletions

View File

@ -6,9 +6,12 @@ componentTest("adding a value", {
template: "{{value-list values=values}}",
skip: true,
async test(assert) {
this.set("values", "vinkas\nosama");
beforeEach() {
this.set("values", "vinkas\nosama");
},
async test(assert) {
await selectKit().expand();
await selectKit().fillInFilter("eviltrout");
await selectKit().keyboard("enter");
@ -29,9 +32,11 @@ componentTest("adding a value", {
componentTest("removing a value", {
template: "{{value-list values=values}}",
async test(assert) {
beforeEach() {
this.set("values", "vinkas\nosama");
},
async test(assert) {
await click(".values .value[data-index='0'] .remove-value-btn");
assert.ok(
@ -46,10 +51,14 @@ componentTest("removing a value", {
componentTest("selecting a value", {
template: "{{value-list values=values choices=choices}}",
async test(assert) {
this.set("values", "vinkas\nosama");
this.set("choices", ["maja", "michael"]);
beforeEach() {
this.setProperties({
values: "vinkas\nosama",
choices: ["maja", "michael"]
});
},
async test(assert) {
await selectKit().expand();
await selectKit().selectRowByValue("maja");
@ -69,6 +78,10 @@ componentTest("selecting a value", {
componentTest("array support", {
template: "{{value-list values=values inputType='array'}}",
beforeEach() {
this.set("values", ["vinkas", "osama"]);
},
async test(assert) {
this.set("values", ["vinkas", "osama"]);
@ -92,10 +105,13 @@ componentTest("array support", {
componentTest("delimiter support", {
template: "{{value-list values=values inputDelimiter='|'}}",
skip: true,
async test(assert) {
beforeEach() {
this.set("values", "vinkas|osama");
},
skip: true,
async test(assert) {
await selectKit().expand();
await selectKit().fillInFilter("eviltrout");
await selectKit().keyboard("enter");