From cabeb031564b204da0c61f8ec221918790ea0796 Mon Sep 17 00:00:00 2001 From: Pierre Romera Date: Fri, 20 Mar 2020 11:06:20 +0000 Subject: [PATCH] Datashare Core has now its own plugin --- src/core/Core.js | 9 +++++++++ tests/unit/specs/core/Core.spec.js | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/src/core/Core.js b/src/core/Core.js index 7aacfba2e7..159146044a 100644 --- a/src/core/Core.js +++ b/src/core/Core.js @@ -46,6 +46,7 @@ export default class Core extends Behaviors { this.useCommons() this.useRouter() this.useWait() + this.useCore() return this } useI18n () { @@ -84,6 +85,14 @@ export default class Core extends Behaviors { this.use(VueWait) this.wait = new VueWait({ useVuex: true }) } + useCore () { + const core = this + this.use(class VueCore { + static install (Vue) { + Vue.prototype.$core = core + } + }) + } async configure () { // Get the config object const config = await this.api.getConfig() diff --git a/tests/unit/specs/core/Core.spec.js b/tests/unit/specs/core/Core.spec.js index 7c760244d3..4149e29310 100644 --- a/tests/unit/specs/core/Core.spec.js +++ b/tests/unit/specs/core/Core.spec.js @@ -89,4 +89,11 @@ describe('Core', () => { core.configure() await expect(core.ready).resolves.toBe(core) }) + + it('should install the internal `VueCore` plugin', async () => { + // Create and configure the core + const core = Core.init(localVue).useAll() + const vm = core.mount('#core') + expect(vm.$core).toBeInstanceOf(Core) + }) })