FIX: allows to define label/title properties for display instead of name
Usage:
```
const content = [{foo: "FOO", bar: "BAR", value: 1, name: "foo-bar"}];
{{combo-box
content=content
value=value
labelProperty="foo"
titleProperty="bar"
}}
```
This commit is contained in:
@@ -296,3 +296,45 @@ componentTest("focusAfterOnChange", {
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
componentTest("labelProperty", {
|
||||
template: '{{single-select labelProperty="foo" value=value content=content}}',
|
||||
|
||||
beforeEach() {
|
||||
this.setProperties({
|
||||
content: [{ id: 1, name: "john", foo: "JACKSON" }],
|
||||
value: 1
|
||||
});
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
assert.equal(this.subject.header().label(), "JACKSON");
|
||||
|
||||
await this.subject.expand();
|
||||
|
||||
const row = this.subject.rowByValue(1);
|
||||
|
||||
assert.equal(row.label(), "JACKSON");
|
||||
}
|
||||
});
|
||||
|
||||
componentTest("titleProperty", {
|
||||
template: '{{single-select titleProperty="foo" value=value content=content}}',
|
||||
|
||||
beforeEach() {
|
||||
this.setProperties({
|
||||
content: [{ id: 1, name: "john", foo: "JACKSON" }],
|
||||
value: 1
|
||||
});
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
assert.equal(this.subject.header().title(), "JACKSON");
|
||||
|
||||
await this.subject.expand();
|
||||
|
||||
const row = this.subject.rowByValue(1);
|
||||
|
||||
assert.equal(row.title(), "JACKSON");
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user