File tree Expand file tree Collapse file tree 7 files changed +22
-17
lines changed Expand file tree Collapse file tree 7 files changed +22
-17
lines changed Original file line number Diff line number Diff line change 1
1
import { mount } from '@vue/test-utils' ;
2
- import { asyncExpect } from '@/tests/utils' ;
2
+ import { asyncExpect , sleep } from '@/tests/utils' ;
3
3
import Checkbox from '../index' ;
4
4
import mountTest from '../../../tests/shared/mountTest' ;
5
5
6
6
describe ( 'CheckboxGroup' , ( ) => {
7
7
mountTest ( Checkbox . Group ) ;
8
- it ( 'should work basically' , ( ) => {
8
+ it ( 'should work basically' , async ( ) => {
9
9
const onChange = jest . fn ( ) ;
10
10
const wrapper = mount (
11
11
{
@@ -18,12 +18,16 @@ describe('CheckboxGroup', () => {
18
18
} ,
19
19
) ;
20
20
wrapper . findAll ( '.ant-checkbox-input' ) [ 0 ] . trigger ( 'change' ) ;
21
+ await sleep ( ) ;
21
22
expect ( onChange ) . toHaveBeenCalledWith ( [ 'Apple' ] ) ;
22
23
wrapper . findAll ( '.ant-checkbox-input' ) [ 1 ] . trigger ( 'change' ) ;
24
+ await sleep ( ) ;
23
25
expect ( onChange ) . toHaveBeenCalledWith ( [ 'Apple' , 'Pear' ] ) ;
24
26
wrapper . findAll ( '.ant-checkbox-input' ) [ 2 ] . trigger ( 'change' ) ;
27
+ await sleep ( ) ;
25
28
expect ( onChange ) . toHaveBeenCalledWith ( [ 'Apple' , 'Pear' , 'Orange' ] ) ;
26
29
wrapper . findAll ( '.ant-checkbox-input' ) [ 1 ] . trigger ( 'change' ) ;
30
+ await sleep ( ) ;
27
31
expect ( onChange ) . toHaveBeenCalledWith ( [ 'Apple' , 'Orange' ] ) ;
28
32
} ) ;
29
33
Original file line number Diff line number Diff line change 1
1
import { mount } from '@vue/test-utils' ;
2
- import { asyncExpect } from '@/tests/utils' ;
2
+ import { asyncExpect , sleep } from '@/tests/utils' ;
3
3
import Popconfirm from '..' ;
4
4
function $$ ( className ) {
5
5
return document . body . querySelectorAll ( className ) ;
@@ -73,26 +73,22 @@ describe('Popconfirm', () => {
73
73
} , 1000 ) ;
74
74
} ) ;
75
75
76
- it ( 'should not open in disabled' , async ( ) => {
76
+ fit ( 'should not open in disabled' , async ( ) => {
77
77
const popconfirm = mount (
78
78
{
79
79
render ( ) {
80
80
return (
81
- < Popconfirm ref = "popconfirm" title = "code" disabled >
81
+ < Popconfirm ref = "popconfirm" title = "code" disabled = { true } >
82
82
< span > click me</ span >
83
83
</ Popconfirm >
84
84
) ;
85
85
} ,
86
86
} ,
87
87
{ sync : false } ,
88
88
) ;
89
-
90
- await asyncExpect ( ( ) => {
91
- popconfirm . find ( 'span' ) . trigger ( 'click' ) ;
92
- } , 1000 ) ;
93
- await asyncExpect ( ( ) => {
94
- const popup = popconfirm . vm . $refs . popconfirm . getPopupDomNode ( ) ;
95
- expect ( popup ) . toBeFalsy ( ) ;
96
- } , 1000 ) ;
89
+ popconfirm . find ( 'span' ) . trigger ( 'click' ) ;
90
+ popconfirm . vm . $refs . popconfirm . $forceUpdate ( ) ;
91
+ const popup = popconfirm . vm . $refs . popconfirm . getPopupDomNode ( ) ;
92
+ expect ( popup ) . toBeFalsy ( ) ;
97
93
} ) ;
98
94
} ) ;
Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ const Select = defineComponent({
119
119
) ,
120
120
) ;
121
121
const triggerChange = ( ...args : any [ ] ) => {
122
- emit ( 'update:value' , ... args ) ;
122
+ emit ( 'update:value' , args [ 0 ] ) ;
123
123
emit ( 'change' , ...args ) ;
124
124
} ;
125
125
return {
Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ describe('Tooltip', () => {
16
16
mouseEnterDelay : 0 ,
17
17
mouseLeaveDelay : 0 ,
18
18
onVisibleChange,
19
+ // TODO test/util 的bug 没有使用 v-model 同样会改变
20
+ 'onUpdate:visible' : ( ) => {
21
+ props . visible = this . visible ;
22
+ this . $forceUpdate ( ) ;
23
+ } ,
19
24
} ;
20
25
if ( this . visible !== undefined ) {
21
26
props . visible = this . visible ;
Original file line number Diff line number Diff line change @@ -201,8 +201,8 @@ const Base = defineComponent<InternalBlockProps>({
201
201
function onContentChange ( value : string ) {
202
202
const { onChange } = editable . value ;
203
203
if ( value !== props . content ) {
204
- onChange ?.( value ) ;
205
204
emit ( 'update:content' , value ) ;
205
+ onChange ?.( value ) ;
206
206
}
207
207
}
208
208
Original file line number Diff line number Diff line change 5
5
</template >
6
6
<script >
7
7
import { defineComponent } from ' vue' ;
8
- import demo from ' ../v2-doc/src/docs/typography /demo/index.vue' ;
8
+ import demo from ' ../v2-doc/src/docs/tooltip /demo/index.vue' ;
9
9
// import Affix from '../components/affix';
10
10
export default defineComponent ({
11
11
components: {
Original file line number Diff line number Diff line change 94
94
"@vue/compiler-sfc" : " ^3.0.4" ,
95
95
"@vue/eslint-config-prettier" : " ^6.0.0" ,
96
96
"@vue/eslint-config-typescript" : " ^7.0.0" ,
97
- "@vue/test-utils" : " ^2.0.0-beta.2 " ,
97
+ "@vue/test-utils" : " ^2.0.0-0 " ,
98
98
"acorn" : " ^7.0.0" ,
99
99
"autoprefixer" : " ^9.6.0" ,
100
100
"axios" : " ^0.21.0" ,
You can’t perform that action at this time.
0 commit comments