From beda7041d0d13815332ea5a6649eb5541554532e Mon Sep 17 00:00:00 2001 From: Declan de Wet Date: Thu, 10 Nov 2016 15:51:00 +0200 Subject: [PATCH] test getComponentOption function call --- test/getComponentOption.spec.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/getComponentOption.spec.js b/test/getComponentOption.spec.js index 4dac96a..af2e2a9 100644 --- a/test/getComponentOption.spec.js +++ b/test/getComponentOption.spec.js @@ -19,6 +19,17 @@ describe('getComponentOption', () => { expect(mergedOption).to.eql('foo') }) + it('calls a function option, injecting the component as context', () => { + component = new Vue({ + name: 'foobar', + someFunc () { + return this.$options.name + } + }) + const mergedOption = getComponentOption({ component, option: 'someFunc' }) + expect(mergedOption).to.eql('foobar') + }) + it('fetches deeply nested component options and merges them', () => { Vue.component('merge-child', { template: '
', foo: { bar: 'baz' } })