mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-05 23:32:23 +03:00
committed by
Alexander Lichter
parent
23c3380c90
commit
7615f4120c
@@ -13,21 +13,23 @@ describe('getComponentOption', () => {
|
||||
})
|
||||
|
||||
it('fetches the given option from the given component', () => {
|
||||
const component = new Vue({ someOption: 'foo' })
|
||||
const component = new Vue({ someOption: { foo: 'bar' } })
|
||||
const mergedOption = getComponentOption({ component, keyName: 'someOption' })
|
||||
expect(mergedOption).toEqual('foo')
|
||||
expect(mergedOption.foo).toBeDefined()
|
||||
expect(mergedOption.foo).toEqual('bar')
|
||||
})
|
||||
|
||||
it('calls a function option, injecting the component as context', () => {
|
||||
const component = new Vue({
|
||||
name: 'Foobar',
|
||||
someFunc() {
|
||||
return this.$options.name
|
||||
return { opt: this.$options.name }
|
||||
}
|
||||
})
|
||||
const mergedOption = getComponentOption({ component, keyName: 'someFunc' })
|
||||
// TODO: Should this be foobar or Foobar
|
||||
expect(mergedOption).toEqual('Foobar')
|
||||
expect(mergedOption.opt).toBeDefined()
|
||||
expect(mergedOption.opt).toEqual('Foobar')
|
||||
})
|
||||
|
||||
it('fetches deeply nested component options and merges them', () => {
|
||||
|
||||
Reference in New Issue
Block a user