File tree 2 files changed +21
-14
lines changed
2 files changed +21
-14
lines changed Original file line number Diff line number Diff line change @@ -119,17 +119,21 @@ describe('NuDialog开关问题', () => {
119
119
} , 16 )
120
120
} )
121
121
} )
122
- // it('用户快速快关,有bug',async ()=>{
123
- // const wrapper = mount(NuDialog)
124
- // wrapper.setProps({open:true})
125
- // wrapper.setProps({open:false})
126
- // await new Promise((rs,rj)=>{
127
- // setTimeout(()=>{
128
- // console.log(wrapper.vm.show,wrapper.vm.render)
129
- // rs()
130
- // },300)
131
- // })
132
- // })
122
+ it ( '用户快速快关' , async ( ) => {
123
+ const wrapper = mount ( NuDialog )
124
+ wrapper . setProps ( { open :true } )
125
+ wrapper . setProps ( { open :false } )
126
+ wrapper . setProps ( { open :true } )
127
+ wrapper . setProps ( { open :true } )
128
+ wrapper . setProps ( { open :false } )
129
+ await new Promise ( ( rs , rj ) => {
130
+ setTimeout ( ( ) => {
131
+ expect ( wrapper . vm . show ) . toEqual ( false )
132
+ expect ( wrapper . vm . render ) . toEqual ( false )
133
+ rs ( )
134
+ } , 300 )
135
+ } )
136
+ } )
133
137
} )
134
138
135
139
describe ( 'beforeClose api' , ( ) => {
Original file line number Diff line number Diff line change 22
22
data () {
23
23
return {
24
24
show: false ,
25
- render: this .open
25
+ render: this .open ,
26
+ timecount: null
26
27
}
27
28
},
28
29
props: {
73
74
},
74
75
methods: {
75
76
handleOpen () {
77
+ clearTimeout (this .timecount )
76
78
this .render = true ;
77
79
document .body .appendChild (this .$el );
78
80
// 动画的时间
79
- setTimeout (() => {
81
+ this . timecount = setTimeout (() => {
80
82
this .show = true ;
81
83
}, 16 );
82
84
document .body .classList .add (' nu_dialog_open' );
83
85
},
84
86
dialogClose () {
87
+ clearTimeout (this .timecount )
85
88
this .show = false ;
86
89
// 动画的时间
87
- setTimeout (() => {
90
+ this . timecount = setTimeout (() => {
88
91
this .render = false ;
89
92
}, this .speed );
90
93
document .body .classList .remove (' nu_dialog_open' );
You can’t perform that action at this time.
0 commit comments