[improvement] Dialog: enable lazy-render (#2495)

This commit is contained in:
neverland 2019-01-11 21:22:41 +08:00 committed by GitHub
parent c65e21e586
commit 5e623c1e34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 1 deletions

View File

@ -218,6 +218,8 @@ test('delete address', async () => {
const deleteButton = wrapper.findAll('.van-button').at(1);
deleteButton.trigger('click');
await later();
document.querySelector('.van-dialog__cancel').click();
deleteButton.trigger('click');
document.querySelector('.van-dialog__confirm').click();

View File

@ -95,6 +95,8 @@ describe('ContactEdit', () => {
const deleteButton = wrapper.findAll('.van-button').at(1);
deleteButton.trigger('click');
await later();
document.querySelector('.van-dialog__confirm').click();
await later();

View File

@ -1,6 +1,7 @@
<template>
<transition name="van-dialog-bounce">
<div
v-if="shouldRender"
v-show="value"
:class="[b(), className]"
>

View File

@ -38,6 +38,7 @@
<van-dialog
v-model="show"
show-cancel-button
:lazy-render="false"
:before-close="beforeClose"
>
<van-field

View File

@ -9,10 +9,11 @@ test('Dialog function call', async () => {
Dialog.close();
Dialog.alert('1');
await later();
const callback = jest.fn();
const dialog = document.querySelector('.van-dialog');
await later();
expect(dialog.style.display).toEqual('');
Dialog.close();
@ -33,6 +34,7 @@ test('Dialog function call', async () => {
test('before close', () => {
const wrapper = mount(DialogVue, {
propsData: {
value: true,
beforeClose: (action, done) => done(false)
}
});