From 9c841da26d8d2a1473cc8b689ed6d3d1b9dce7be Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Sun, 8 Nov 2020 20:19:08 +0800 Subject: [PATCH] test(ActionBarButton): update test cases --- .../test/__snapshots__/index.spec.js.snap | 10 ++++++++++ src/action-bar-button/test/index.spec.js | 11 +++++++++++ src/action-bar/test/index.legacy.js | 17 ----------------- 3 files changed, 21 insertions(+), 17 deletions(-) create mode 100644 src/action-bar-button/test/__snapshots__/index.spec.js.snap create mode 100644 src/action-bar-button/test/index.spec.js diff --git a/src/action-bar-button/test/__snapshots__/index.spec.js.snap b/src/action-bar-button/test/__snapshots__/index.spec.js.snap new file mode 100644 index 000000000..81f731eb4 --- /dev/null +++ b/src/action-bar-button/test/__snapshots__/index.spec.js.snap @@ -0,0 +1,10 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render default slot and match snapshot 1`] = ` + +`; diff --git a/src/action-bar-button/test/index.spec.js b/src/action-bar-button/test/index.spec.js new file mode 100644 index 000000000..8024927c8 --- /dev/null +++ b/src/action-bar-button/test/index.spec.js @@ -0,0 +1,11 @@ +import { mount } from '@vue/test-utils'; +import ActionBarButton from '..'; + +test('should render default slot and match snapshot', () => { + const wrapper = mount(ActionBarButton, { + slots: { + default: 'Content', + }, + }); + expect(wrapper.html()).toMatchSnapshot(); +}); diff --git a/src/action-bar/test/index.legacy.js b/src/action-bar/test/index.legacy.js index 7964b004f..b484f1b44 100644 --- a/src/action-bar/test/index.legacy.js +++ b/src/action-bar/test/index.legacy.js @@ -1,30 +1,13 @@ import ActionBar from '..'; -import Button from '../../action-bar-button'; import Icon from '../../action-bar-icon'; import { mount } from '../../../test'; -test('Button click event', () => { - const wrapper = mount(Button); - wrapper.trigger('click'); - expect(wrapper.emitted('click').length).toEqual(1); -}); - test('Icon click event', () => { const wrapper = mount(Icon); wrapper.trigger('click'); expect(wrapper.emitted('click').length).toEqual(1); }); -test('Button render default slot', () => { - const wrapper = mount({ - render(h) { - return h(Button, null, ['Default Content']); - }, - }); - - expect(wrapper.html()).toMatchSnapshot(); -}); - test('Icon render default slot', () => { const wrapper = mount({ render(h) {