Add afterLoad plugin interface

This commit is contained in:
Kyle Shockey
2017-12-14 21:01:37 -08:00
parent 85c83931c4
commit c1ae4c133d
3 changed files with 65 additions and 1 deletions

View File

@@ -683,4 +683,31 @@ describe("bound system", function(){
})
})
describe("afterLoad", function() {
it("should call an plugin's `afterLoad` method after the plugin is loaded", function() {
// Given
const system = new System({
plugins: [
{
afterLoad(system) {
system.wow = system.dogeSelectors.wow
},
statePlugins: {
doge: {
selectors: {
wow: () => (system) => {
return "so selective"
}
}
}
}
}
]
})
// When
var res = system.getSystem().wow()
expect(res).toEqual("so selective")
})
})
})