diff --git a/packages/test-utils/src/wrapper.js b/packages/test-utils/src/wrapper.js index 54f7d46e1..fe0c32210 100644 --- a/packages/test-utils/src/wrapper.js +++ b/packages/test-utils/src/wrapper.js @@ -335,6 +335,9 @@ export default class Wrapper implements BaseWrapper { if (!this.vnode) { return this.element.innerHTML === '' } + if (this.vnode.children) { + return this.vnode.children.every(vnode => vnode.isComment) + } return this.vnode.children === undefined || this.vnode.children.length === 0 } diff --git a/test/specs/wrapper/isEmpty.spec.js b/test/specs/wrapper/isEmpty.spec.js index 2b30b2fdd..69c9b838f 100644 --- a/test/specs/wrapper/isEmpty.spec.js +++ b/test/specs/wrapper/isEmpty.spec.js @@ -9,6 +9,12 @@ describeWithShallowAndMount('isEmpty', (mountingMethod) => { expect(wrapper.isEmpty()).to.equal(true) }) + it('returns true if node contains comment', () => { + const compiled = compileToFunctions('