diff --git a/src/wrappers/wrapper.js b/src/wrappers/wrapper.js index 7288e2ce0..c4d402322 100644 --- a/src/wrappers/wrapper.js +++ b/src/wrappers/wrapper.js @@ -248,7 +248,7 @@ export default class Wrapper implements BaseWrapper { * Checks if node is empty */ isEmpty (): boolean { - return this.vnode.children === undefined + return this.vnode.children === undefined || this.vnode.children.length === 0 } /** diff --git a/test/unit/specs/mount/Wrapper/isEmpty.spec.js b/test/unit/specs/mount/Wrapper/isEmpty.spec.js index 8a89b1946..1f5f534ca 100644 --- a/test/unit/specs/mount/Wrapper/isEmpty.spec.js +++ b/test/unit/specs/mount/Wrapper/isEmpty.spec.js @@ -9,6 +9,13 @@ describe('isEmpty', () => { expect(wrapper.isEmpty()).to.equal(true) }) + it('returns true contains empty slot', () => { + const compiled = compileToFunctions('
') + const wrapper = mount(compiled) + + expect(wrapper.isEmpty()).to.equal(true) + }) + it('returns false if node contains other nodes', () => { const compiled = compileToFunctions('

') const wrapper = mount(compiled)