Skip to content

Commit ae98f65

Browse files
committed
chore: lint & fix test
1 parent c344d60 commit ae98f65

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

src/shared/getComponentOption.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isFunction, isObject } from '../utils/is-type'
1+
import { isObject } from '../utils/is-type'
22
import { defaultInfo } from './constants'
33
import { merge } from './merge'
44
import { inMetaInfoBranch } from './meta-helpers'

test/components/changed.vue

+3-7
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,13 @@ export default {
1818
},
1919
metaInfo() {
2020
return {
21-
changed: this._changed
21+
changed: this.changed.bind(this)
2222
}
2323
},
2424
data() {
2525
return {
26-
childVisible: false,
27-
_changed: () => {}
26+
childVisible: false
2827
}
29-
},
30-
mounted() {
31-
this._changed = this.changed.bind(this)
32-
}
28+
f }
3329
}
3430
</script>

test/unit/getComponentOptions.test.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,19 @@ describe('getComponentOption', () => {
2020
expect(mergedOption.foo).toEqual('bar')
2121
})
2222

23-
test('calls a function option, injecting the component as context', () => {
23+
test('calls a function as computed prop, injecting the component as context', () => {
2424
const component = new Vue({
2525
name: 'Foobar',
2626
someFunc () {
27-
return { opt: this.$options.name }
27+
return { opt: this.name }
28+
},
29+
computed: {
30+
$metaInfo () {
31+
return this.$options.someFunc()
32+
}
2833
}
2934
})
35+
3036
const mergedOption = getComponentOption({ keyName: 'someFunc' }, component)
3137
// TODO: Should this be foobar or Foobar
3238
expect(mergedOption.opt).toBeDefined()

0 commit comments

Comments
 (0)