Skip to content

Commit beda704

Browse files
committed
test getComponentOption function call
1 parent 6502c13 commit beda704

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/getComponentOption.spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ describe('getComponentOption', () => {
1919
expect(mergedOption).to.eql('foo')
2020
})
2121

22+
it('calls a function option, injecting the component as context', () => {
23+
component = new Vue({
24+
name: 'foobar',
25+
someFunc () {
26+
return this.$options.name
27+
}
28+
})
29+
const mergedOption = getComponentOption({ component, option: 'someFunc' })
30+
expect(mergedOption).to.eql('foobar')
31+
})
32+
2233
it('fetches deeply nested component options and merges them', () => {
2334
Vue.component('merge-child', { template: '<div></div>', foo: { bar: 'baz' } })
2435

0 commit comments

Comments
 (0)