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 11import { mount } from '@vue/test-utils' ;
2- import { asyncExpect } from '@/tests/utils' ;
2+ import { asyncExpect , sleep } from '@/tests/utils' ;
33import Checkbox from '../index' ;
44import mountTest from '../../../tests/shared/mountTest' ;
55
66describe ( 'CheckboxGroup' , ( ) => {
77 mountTest ( Checkbox . Group ) ;
8- it ( 'should work basically' , ( ) => {
8+ it ( 'should work basically' , async ( ) => {
99 const onChange = jest . fn ( ) ;
1010 const wrapper = mount (
1111 {
@@ -18,12 +18,16 @@ describe('CheckboxGroup', () => {
1818 } ,
1919 ) ;
2020 wrapper . findAll ( '.ant-checkbox-input' ) [ 0 ] . trigger ( 'change' ) ;
21+ await sleep ( ) ;
2122 expect ( onChange ) . toHaveBeenCalledWith ( [ 'Apple' ] ) ;
2223 wrapper . findAll ( '.ant-checkbox-input' ) [ 1 ] . trigger ( 'change' ) ;
24+ await sleep ( ) ;
2325 expect ( onChange ) . toHaveBeenCalledWith ( [ 'Apple' , 'Pear' ] ) ;
2426 wrapper . findAll ( '.ant-checkbox-input' ) [ 2 ] . trigger ( 'change' ) ;
27+ await sleep ( ) ;
2528 expect ( onChange ) . toHaveBeenCalledWith ( [ 'Apple' , 'Pear' , 'Orange' ] ) ;
2629 wrapper . findAll ( '.ant-checkbox-input' ) [ 1 ] . trigger ( 'change' ) ;
30+ await sleep ( ) ;
2731 expect ( onChange ) . toHaveBeenCalledWith ( [ 'Apple' , 'Orange' ] ) ;
2832 } ) ;
2933
Original file line number Diff line number Diff line change 11import { mount } from '@vue/test-utils' ;
2- import { asyncExpect } from '@/tests/utils' ;
2+ import { asyncExpect , sleep } from '@/tests/utils' ;
33import Popconfirm from '..' ;
44function $$ ( className ) {
55 return document . body . querySelectorAll ( className ) ;
@@ -73,26 +73,22 @@ describe('Popconfirm', () => {
7373 } , 1000 ) ;
7474 } ) ;
7575
76- it ( 'should not open in disabled' , async ( ) => {
76+ fit ( 'should not open in disabled' , async ( ) => {
7777 const popconfirm = mount (
7878 {
7979 render ( ) {
8080 return (
81- < Popconfirm ref = "popconfirm" title = "code" disabled >
81+ < Popconfirm ref = "popconfirm" title = "code" disabled = { true } >
8282 < span > click me</ span >
8383 </ Popconfirm >
8484 ) ;
8585 } ,
8686 } ,
8787 { sync : false } ,
8888 ) ;
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 ( ) ;
9793 } ) ;
9894} ) ;
Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ const Select = defineComponent({
119119 ) ,
120120 ) ;
121121 const triggerChange = ( ...args : any [ ] ) => {
122- emit ( 'update:value' , ... args ) ;
122+ emit ( 'update:value' , args [ 0 ] ) ;
123123 emit ( 'change' , ...args ) ;
124124 } ;
125125 return {
Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ describe('Tooltip', () => {
1616 mouseEnterDelay : 0 ,
1717 mouseLeaveDelay : 0 ,
1818 onVisibleChange,
19+ // TODO test/util 的bug 没有使用 v-model 同样会改变
20+ 'onUpdate:visible' : ( ) => {
21+ props . visible = this . visible ;
22+ this . $forceUpdate ( ) ;
23+ } ,
1924 } ;
2025 if ( this . visible !== undefined ) {
2126 props . visible = this . visible ;
Original file line number Diff line number Diff line change @@ -201,8 +201,8 @@ const Base = defineComponent<InternalBlockProps>({
201201 function onContentChange ( value : string ) {
202202 const { onChange } = editable . value ;
203203 if ( value !== props . content ) {
204- onChange ?.( value ) ;
205204 emit ( 'update:content' , value ) ;
205+ onChange ?.( value ) ;
206206 }
207207 }
208208
Original file line number Diff line number Diff line change 55</template >
66<script >
77import { 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' ;
99// import Affix from '../components/affix';
1010export default defineComponent ({
1111 components: {
Original file line number Diff line number Diff line change 9494 "@vue/compiler-sfc" : " ^3.0.4" ,
9595 "@vue/eslint-config-prettier" : " ^6.0.0" ,
9696 "@vue/eslint-config-typescript" : " ^7.0.0" ,
97- "@vue/test-utils" : " ^2.0.0-beta.2 " ,
97+ "@vue/test-utils" : " ^2.0.0-0 " ,
9898 "acorn" : " ^7.0.0" ,
9999 "autoprefixer" : " ^9.6.0" ,
100100 "axios" : " ^0.21.0" ,
You can’t perform that action at this time.
0 commit comments