mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-24 22:50: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 { defaultInfo } from './constants'
|
||||||
import { merge } from './merge'
|
import { merge } from './merge'
|
||||||
import { inMetaInfoBranch } from './meta-helpers'
|
import { inMetaInfoBranch } from './meta-helpers'
|
||||||
|
|||||||
@@ -18,17 +18,13 @@ export default {
|
|||||||
},
|
},
|
||||||
metaInfo() {
|
metaInfo() {
|
||||||
return {
|
return {
|
||||||
changed: this._changed
|
changed: this.changed.bind(this)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
childVisible: false,
|
childVisible: false
|
||||||
_changed: () => {}
|
|
||||||
}
|
}
|
||||||
},
|
f }
|
||||||
mounted() {
|
|
||||||
this._changed = this.changed.bind(this)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -20,13 +20,19 @@ describe('getComponentOption', () => {
|
|||||||
expect(mergedOption.foo).toEqual('bar')
|
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({
|
const component = new Vue({
|
||||||
name: 'Foobar',
|
name: 'Foobar',
|
||||||
someFunc () {
|
someFunc () {
|
||||||
return { opt: this.$options.name }
|
return { opt: this.name }
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
$metaInfo () {
|
||||||
|
return this.$options.someFunc()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const mergedOption = getComponentOption({ keyName: 'someFunc' }, component)
|
const mergedOption = getComponentOption({ keyName: 'someFunc' }, component)
|
||||||
// TODO: Should this be foobar or Foobar
|
// TODO: Should this be foobar or Foobar
|
||||||
expect(mergedOption.opt).toBeDefined()
|
expect(mergedOption.opt).toBeDefined()
|
||||||
|
|||||||
Reference in New Issue
Block a user