mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[improvement] Dialog: enable lazy-render (#2495)
This commit is contained in:
parent
c65e21e586
commit
5e623c1e34
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<transition name="van-dialog-bounce">
|
||||
<div
|
||||
v-if="shouldRender"
|
||||
v-show="value"
|
||||
:class="[b(), className]"
|
||||
>
|
||||
|
@ -38,6 +38,7 @@
|
||||
<van-dialog
|
||||
v-model="show"
|
||||
show-cancel-button
|
||||
:lazy-render="false"
|
||||
:before-close="beforeClose"
|
||||
>
|
||||
<van-field
|
||||
|
@ -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)
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user