mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-17 17:30:34 +03:00
chore: lint & fix test
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { isFunction, isObject } from '../utils/is-type'
|
||||
import { isObject } from '../utils/is-type'
|
||||
import { defaultInfo } from './constants'
|
||||
import { merge } from './merge'
|
||||
import { inMetaInfoBranch } from './meta-helpers'
|
||||
|
||||
@@ -18,17 +18,13 @@ export default {
|
||||
},
|
||||
metaInfo() {
|
||||
return {
|
||||
changed: this._changed
|
||||
changed: this.changed.bind(this)
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
childVisible: false,
|
||||
_changed: () => {}
|
||||
childVisible: false
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this._changed = this.changed.bind(this)
|
||||
}
|
||||
f }
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -20,13 +20,19 @@ describe('getComponentOption', () => {
|
||||
expect(mergedOption.foo).toEqual('bar')
|
||||
})
|
||||
|
||||
test('calls a function option, injecting the component as context', () => {
|
||||
test('calls a function as computed prop, injecting the component as context', () => {
|
||||
const component = new Vue({
|
||||
name: 'Foobar',
|
||||
someFunc () {
|
||||
return { opt: this.$options.name }
|
||||
return { opt: this.name }
|
||||
},
|
||||
computed: {
|
||||
$metaInfo () {
|
||||
return this.$options.someFunc()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const mergedOption = getComponentOption({ keyName: 'someFunc' }, component)
|
||||
// TODO: Should this be foobar or Foobar
|
||||
expect(mergedOption.opt).toBeDefined()
|
||||
|
||||
Reference in New Issue
Block a user