diff --git a/src/shared/getComponentOption.js b/src/shared/getComponentOption.js index dfcca9c..ae819a8 100644 --- a/src/shared/getComponentOption.js +++ b/src/shared/getComponentOption.js @@ -36,7 +36,6 @@ export default function getComponentOption(options = {}, result = {}) { // ignore data if its not an object, then we keep our previous result if (!isObject(data)) { - console.log(data) return result } diff --git a/test/getComponentOptions.test.js b/test/getComponentOptions.test.js index 2517745..85a0272 100644 --- a/test/getComponentOptions.test.js +++ b/test/getComponentOptions.test.js @@ -13,21 +13,23 @@ describe('getComponentOption', () => { }) it('fetches the given option from the given component', () => { - const component = new Vue({ someOption: 'foo' }) + const component = new Vue({ someOption: { foo: 'bar' } }) const mergedOption = getComponentOption({ component, keyName: 'someOption' }) - expect(mergedOption).toEqual('foo') + expect(mergedOption.foo).toBeDefined() + expect(mergedOption.foo).toEqual('bar') }) it('calls a function option, injecting the component as context', () => { const component = new Vue({ name: 'Foobar', someFunc() { - return this.$options.name + return { opt: this.$options.name } } }) const mergedOption = getComponentOption({ component, keyName: 'someFunc' }) // TODO: Should this be foobar or Foobar - expect(mergedOption).toEqual('Foobar') + expect(mergedOption.opt).toBeDefined() + expect(mergedOption.opt).toEqual('Foobar') }) it('fetches deeply nested component options and merges them', () => { diff --git a/test/getMetaInfo.test.js b/test/getMetaInfo.test.js index 416c180..a6159fe 100644 --- a/test/getMetaInfo.test.js +++ b/test/getMetaInfo.test.js @@ -117,7 +117,7 @@ describe('getMetaInfo', () => { { vmid: 'a', property: 'a', - content: 'b' + content: 'a' } ], base: [], @@ -592,4 +592,29 @@ describe('getMetaInfo', () => { __dangerouslyDisableSanitizersByTagID: {} }) }) + + test('no errors when metaInfo returns nothing', () => { + const component = new Vue({ + metaInfo() {}, + el: document.createElement('div'), + render: h => h('div', null, []) + }) + + expect(getMetaInfo(component)).toEqual({ + title: '', + titleChunk: '', + titleTemplate: '%s', + htmlAttrs: {}, + headAttrs: {}, + bodyAttrs: {}, + meta: [], + base: [], + link: [], + style: [], + script: [], + noscript: [], + __dangerouslyDisableSanitizers: [], + __dangerouslyDisableSanitizersByTagID: {} + }) + }) })