diff --git a/src/index.js b/src/index.js index 2c1ea68..e57e755 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 h('div', {}, shouldShow ? children : [h('div')]) + return shouldShow ? h('div', {}, children) : '' } } diff --git a/test/VueIsBot.spec.js b/test/VueIsBot.spec.js index eb6327b..168a128 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 : '
'}
`) + expect(wrapper.html()).toBe(can ? `
${slotContent}
` : undefined) } 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') })