diff --git a/components/avatar/__tests__/Avatar.test.js b/components/avatar/__tests__/Avatar.test.js new file mode 100644 index 000000000..22f84e51a --- /dev/null +++ b/components/avatar/__tests__/Avatar.test.js @@ -0,0 +1,14 @@ +import { mount } from '@vue/test-utils' +import Avatar from '..' + +describe('Avatar Render', () => { + it('Render long string correctly', () => { + const wrapper = mount(Avatar, { + slots: { + default: 'TestString', + }, + }) + const children = wrapper.findAll('.ant-avatar-string') + expect(children.length).toBe(1) + }) +}) diff --git a/components/badge/__tests__/index.test.js b/components/badge/__tests__/index.test.js new file mode 100644 index 000000000..8d0e860d1 --- /dev/null +++ b/components/badge/__tests__/index.test.js @@ -0,0 +1,21 @@ +import { mount } from '@vue/test-utils' +import Badge from '../index' + +describe('Badge', () => { + test('badge dot not scaling count > 9', () => { + const badge = mount({ + render () { + return + }, + }) + expect(badge.findAll('.ant-card-multiple-words').length).toBe(0) + }) + test('badge dot not showing count == 0', () => { + const badge = mount({ + render () { + return + }, + }) + expect(badge.findAll('.ant-badge-dot').length).toBe(0) + }) +}) diff --git a/components/icon/__tests__/__snapshots__/index.test.js.snap b/components/icon/__tests__/__snapshots__/index.test.js.snap new file mode 100644 index 000000000..9e4b4b34d --- /dev/null +++ b/components/icon/__tests__/__snapshots__/index.test.js.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Icon should render to a 1`] = ``; diff --git a/components/icon/__tests__/index.test.js b/components/icon/__tests__/index.test.js new file mode 100644 index 000000000..ded9afca7 --- /dev/null +++ b/components/icon/__tests__/index.test.js @@ -0,0 +1,13 @@ +import { mount } from '@vue/test-utils' +import Icon from '..' + +describe('Icon', () => { + it('should render to a ', () => { + const wrapper = mount({ + render (h) { + return + }, + }) + expect(wrapper.html()).toMatchSnapshot() + }) +}) diff --git a/components/modal/__tests__/Modal.test.js b/components/modal/__tests__/Modal.test.js new file mode 100644 index 000000000..eac2e7038 --- /dev/null +++ b/components/modal/__tests__/Modal.test.js @@ -0,0 +1,56 @@ +import { mount } from '@vue/test-utils' +import Modal from '..' + +const ModalTester = { + props: ['footer', 'visible'], + methods: { + getContainer () { + return this.$refs.container + }, + }, + + render () { + const modalProps = { + props: { + ...this.$props, + getContainer: this.getContainer, + }, + } + return ( +
+
+ + Here is content of Modal + +
+ ) + }, +} + +describe('Modal', () => { + it('render correctly', () => { + const wrapper = mount(ModalTester) + expect(wrapper.html()).toMatchSnapshot() + const wrapper1 = mount( + { + render () { + return + }, + } + ) + expect(wrapper1.html()).toMatchSnapshot() + }) + + it('render without footer', () => { + const wrapper = mount( + { + render () { + return + }, + } + ) + expect(wrapper.html()).toMatchSnapshot() + }) +}) diff --git a/components/modal/__tests__/__snapshots__/Modal.test.js.snap b/components/modal/__tests__/__snapshots__/Modal.test.js.snap new file mode 100644 index 000000000..891c81e17 --- /dev/null +++ b/components/modal/__tests__/__snapshots__/Modal.test.js.snap @@ -0,0 +1,54 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Modal render correctly 1`] = ` +
+
+ +
+`; + +exports[`Modal render correctly 2`] = ` +
+
+
+
+ +
+
+ +
+`; + +exports[`Modal render without footer 1`] = ` +
+
+
+
+ +
+
+ +
+`; diff --git a/tests/setup.js b/tests/setup.js index 42fbf73b0..def324f67 100644 --- a/tests/setup.js +++ b/tests/setup.js @@ -1,3 +1,5 @@ +import Vue from 'vue' +Vue.config.silent = true /* eslint-disable global-require */ if (typeof window !== 'undefined') {