FIX: adds select-kit api to modify header computed content (#5476)

This api would allow to simply modify header text or icons, eg:

```
      api.modifySelectKit("select-kit")
        .modifyHeaderComputedContent((context, computedContent) => {
          computedContent.title = "Not so evil";
          return computedContent;
        });
```
This commit is contained in:
Joffrey JAFFEUX
2018-01-09 10:52:32 +01:00
committed by GitHub
parent c9f42506b7
commit c9921869f1
6 changed files with 68 additions and 7 deletions

View File

@ -103,7 +103,7 @@ componentTest('custom search icon', {
andThen(() => {
assert.ok(
this.get('subject').filter().icon().hasClass("fa-shower"),
this.get('subject').filter().icon().hasClass("d-icon-shower"),
"it has a the correct icon"
);
});
@ -532,3 +532,28 @@ componentTest('with title', {
andThen(() => assert.equal(this.get('subject').header().title(), 'My title') );
}
});
componentTest('support modifying header computed content through plugin api', {
template: '{{single-select content=content}}',
beforeEach() {
withPluginApi('0.8.15', api => {
api.modifySelectKit("select-kit")
.modifyHeaderComputedContent((context, computedContent) => {
computedContent.title = "Not so evil";
return computedContent;
});
});
this.set("content", [{ id: "1", name: "robin"}]);
},
test(assert) {
andThen(() => {
assert.equal(this.get('subject').header().title(), "Not so evil");
});
andThen(() => clearCallbacks());
}
});