mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 12:21:11 +08:00
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:
@ -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");
|
||||
|
Reference in New Issue
Block a user