diff --git a/components/modal/__tests__/Modal.test.js b/components/modal/__tests__/Modal.test.js index 67dae5b67..b0c180f22 100644 --- a/components/modal/__tests__/Modal.test.js +++ b/components/modal/__tests__/Modal.test.js @@ -1,4 +1,5 @@ import { mount } from '@vue/test-utils' +import Vue from 'vue' import Modal from '..' const ModalTester = { @@ -8,10 +9,6 @@ const ModalTester = { return this.$refs.container }, }, - updated () { - console.log('updated') - }, - render () { const modalProps = { props: { @@ -33,18 +30,24 @@ const ModalTester = { } describe('Modal', () => { - it('render correctly', () => { - const wrapper = mount(ModalTester) - wrapper.setProps({ visible: true }) - expect(wrapper.html()).toMatchSnapshot() - const wrapper1 = mount( + it('render correctly', (done) => { + const wrapper = mount( { render () { return }, } ) - expect(wrapper1.html()).toMatchSnapshot() + expect(wrapper.html()).toMatchSnapshot() + // https://github.com/vuejs/vue-test-utils/issues/624 + const wrapper1 = mount(ModalTester, { + sync: false, + }) + wrapper1.setProps({ visible: true }) + Vue.nextTick(() => { + expect(wrapper1.html()).toMatchSnapshot() + done() + }) }) it('render without footer', () => { diff --git a/components/modal/__tests__/__snapshots__/Modal.test.js.snap b/components/modal/__tests__/__snapshots__/Modal.test.js.snap index 891c81e17..b6d4b6eae 100644 --- a/components/modal/__tests__/__snapshots__/Modal.test.js.snap +++ b/components/modal/__tests__/__snapshots__/Modal.test.js.snap @@ -2,7 +2,26 @@ exports[`Modal render correctly 1`] = `
-
+
+
+
+ +
+
`; diff --git a/tests/setup.js b/tests/setup.js index def324f67..c6a2fab32 100644 --- a/tests/setup.js +++ b/tests/setup.js @@ -1,5 +1,5 @@ -import Vue from 'vue' -Vue.config.silent = true +// import Vue from 'vue' +// Vue.config.silent = true /* eslint-disable global-require */ if (typeof window !== 'undefined') {