diff --git a/src/index.js b/src/index.js index e57e755..2c1ea68 100644 --- a/src/index.js +++ b/src/index.js @@ -5,6 +5,6 @@ export default { const isBot = process.server ? true : navigator.userAgent && botRegex.test(navigator.userAgent) const shouldShow = invert ? isBot : !isBot - return shouldShow ? h('div', {}, children) : '' + return h('div', {}, shouldShow ? children : [h('div')]) } } diff --git a/test/VueIsBot.spec.js b/test/VueIsBot.spec.js index 168a128..eb6327b 100644 --- a/test/VueIsBot.spec.js +++ b/test/VueIsBot.spec.js @@ -10,13 +10,13 @@ const mockUserAgent = userAgent => { const testCanSeeOrNot = (can, wrapper) => { expect(wrapper.isVueInstance()).toBe(true) - expect(wrapper.html()).toBe(can ? `
${slotContent}
` : undefined) + expect(wrapper.html()).toBe(`
${can ? slotContent : '
'}
`) } const testCanSee = curry(w => testCanSeeOrNot(true, w)) const testCanNotSee = curry(w => testCanSeeOrNot(false, w)) -const testSsr = html => { expect(html).toBe(``) } +const testSsr = html => { expect(html).toBe(`
`) } describe('VueIfBot', () => { afterEach(() => { mockUserAgent('Normal user here') })