Skip to content

Commit

Permalink
chore: lint & fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
pimlie committed Sep 12, 2019
1 parent c344d60 commit ae98f65
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/shared/getComponentOption.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
10 changes: 3 additions & 7 deletions test/components/changed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
10 changes: 8 additions & 2 deletions test/unit/getComponentOptions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit ae98f65

Please sign in to comment.