2
0
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:
pimlie
2019-09-12 15:43:09 +02:00
parent c344d60d5f
commit ae98f65511
3 changed files with 12 additions and 10 deletions
+1 -1
View File
@@ -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'
+3 -7
View File
@@ -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>
+8 -2
View File
@@ -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()