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