File tree 1 file changed +46
-0
lines changed
1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import Cascader from '../src' ;
3
+ import type { ReactWrapper } from './enzyme' ;
4
+ import { mount } from './enzyme' ;
5
+
6
+ describe ( 'Cascader.Search' , ( ) => {
7
+ function doSearch ( wrapper : ReactWrapper , search : string ) {
8
+ wrapper . find ( 'input' ) . simulate ( 'change' , {
9
+ target : {
10
+ value : search ,
11
+ } ,
12
+ } ) ;
13
+ }
14
+ const options = [
15
+ {
16
+ region : 'Asia' ,
17
+ children : [ ] ,
18
+ isParent : true ,
19
+ label : 'Asia' ,
20
+ value : 'Asia' ,
21
+ } ,
22
+ ] ;
23
+ for ( let i = 0 ; i < 100 ; i ++ ) {
24
+ options [ 0 ] . children . push ( {
25
+ id : i ,
26
+ label : 'label' + i ,
27
+ value : 'value' + i ,
28
+ } ) ;
29
+ }
30
+
31
+ it ( 'limit' , ( ) => {
32
+ const wrapper = mount (
33
+ < Cascader
34
+ options = { options }
35
+ open
36
+ showSearch = { {
37
+ limit : false ,
38
+ } }
39
+ /> ,
40
+ ) ;
41
+
42
+ doSearch ( wrapper , 'as' ) ;
43
+ const itemList = wrapper . find ( 'div.rc-cascader-menu-item-content' ) ;
44
+ expect ( itemList ) . toHaveLength ( itemList . length ) ;
45
+ } ) ;
46
+ } ) ;
You can’t perform that action at this time.
0 commit comments