diff --git a/src/tab/index.js b/src/tab/index.js index 3a3b49b29..7b793a79f 100644 --- a/src/tab/index.js +++ b/src/tab/index.js @@ -62,6 +62,10 @@ export default createComponent({ ); return () => { + if (!slots.default) { + return; + } + const { animated, scrollspy, lazyRender } = parent.props; const active = isActive(); const show = scrollspy || active; diff --git a/src/tab/test/__snapshots__/index.spec.js.snap b/src/tab/test/__snapshots__/index.spec.js.snap index f7be7a42e..3cc7519e9 100644 --- a/src/tab/test/__snapshots__/index.spec.js.snap +++ b/src/tab/test/__snapshots__/index.spec.js.snap @@ -202,6 +202,22 @@ exports[`name prop 1`] = ` `; +exports[`render empty tab 1`] = ` +
+
+
+ + +
+
+
+
+ + +
+
+`; + exports[`render nav-left & nav-right slot 1`] = `
diff --git a/src/tab/test/index.spec.js b/src/tab/test/index.spec.js index 29bc198ce..1ca16f2a1 100644 --- a/src/tab/test/index.spec.js +++ b/src/tab/test/index.spec.js @@ -410,3 +410,16 @@ test('before-change prop', async () => { expect(onChange).toHaveBeenCalledTimes(2); expect(onChange).toHaveBeenLastCalledWith(4, 'title5'); }); + +test('render empty tab', async () => { + const wrapper = mount({ + template: ` + + + + + `, + }); + + expect(wrapper).toMatchSnapshot(); +});