Skip to content

Commit

Permalink
fix: revert "feat: remove empty div for bot"
Browse files Browse the repository at this point in the history
This reverts commit 4ffb9b1
  • Loading branch information
TheAlexLichter committed May 23, 2018
1 parent 1b027c8 commit 6178f68
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')])
}
}
4 changes: 2 additions & 2 deletions test/VueIsBot.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ const mockUserAgent = userAgent => {

const testCanSeeOrNot = (can, wrapper) => {
expect(wrapper.isVueInstance()).toBe(true)
expect(wrapper.html()).toBe(can ? `<div>${slotContent}</div>` : undefined)
expect(wrapper.html()).toBe(`<div>${can ? slotContent : '<div></div>'}</div>`)
}

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(`<div data-server-rendered="true"><div></div></div>`) }

describe('VueIfBot', () => {
afterEach(() => { mockUserAgent('Normal user here') })
Expand Down

0 comments on commit 6178f68

Please sign in to comment.