From de49fb3998ab273a1f9ce03423509524e5a2ac02 Mon Sep 17 00:00:00 2001 From: Pan Date: Tue, 17 Jul 2018 10:30:35 +0800 Subject: [PATCH] update --- tests/unit/components/SvgIcon.spec.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/unit/components/SvgIcon.spec.js diff --git a/tests/unit/components/SvgIcon.spec.js b/tests/unit/components/SvgIcon.spec.js new file mode 100644 index 0000000..a674d67 --- /dev/null +++ b/tests/unit/components/SvgIcon.spec.js @@ -0,0 +1,25 @@ +import { shallowMount } from '@vue/test-utils' +import SvgIcon from '@/components/SvgIcon/index.vue' + +describe('SvgIcon.vue', () => { + it('iconClass', () => { + const wrapper = shallowMount(SvgIcon, { + propsData: { + iconClass: 'test' + } + }) + expect(wrapper.find('use').attributes().href).toBe('#icon-test') + }) + + it('className', () => { + const wrapper = shallowMount(SvgIcon, { + propsData: { + iconClass: 'test' + } + }) + expect(wrapper.classes().length).toBe(1) + + wrapper.setProps({ className: 'test' }) + expect(wrapper.classes().includes('test')).toBe(true) + }) +})