@@ -193,7 +193,7 @@ describe('Cascader.Search', () => {
193
193
errorSpy . mockRestore ( ) ;
194
194
} ) ;
195
195
196
- it ( 'onChange should be triggered when click option with multiple' , ( ) => {
196
+ it ( 'onChange should be triggered when click option with changeOnSelect + multiple' , ( ) => {
197
197
const onChange = jest . fn ( ) ;
198
198
const wrapper = mount (
199
199
< Cascader checkable options = { options } changeOnSelect onChange = { onChange } showSearch /> ,
@@ -212,6 +212,23 @@ describe('Cascader.Search', () => {
212
212
) ;
213
213
} ) ;
214
214
215
+ it ( 'onChange should be triggered when click option with multiple' , ( ) => {
216
+ const onChange = jest . fn ( ) ;
217
+ const wrapper = mount ( < Cascader checkable options = { options } onChange = { onChange } showSearch /> ) ;
218
+ doSearch ( wrapper , 'toy' ) ;
219
+ wrapper . find ( '.rc-cascader-menu-item' ) . first ( ) . simulate ( 'click' ) ;
220
+ wrapper . find ( '.rc-cascader-menu-item' ) . first ( ) . simulate ( 'mousedown' ) ;
221
+ expect ( onChange ) . toHaveBeenCalledWith ( [ [ 'bamboo' , 'little' , 'fish' ] ] , expect . anything ( ) ) ;
222
+
223
+ doSearch ( wrapper , 'light' ) ;
224
+ wrapper . find ( '.rc-cascader-menu-item' ) . first ( ) . simulate ( 'click' ) ;
225
+ wrapper . find ( '.rc-cascader-menu-item' ) . first ( ) . simulate ( 'mousedown' ) ;
226
+ expect ( onChange ) . toHaveBeenCalledWith (
227
+ [ [ 'bamboo' , 'little' , 'fish' ] , [ 'light' ] ] ,
228
+ expect . anything ( ) ,
229
+ ) ;
230
+ } ) ;
231
+
215
232
it ( 'should not crash when exist options with same value on different levels' , ( ) => {
216
233
const wrapper = mount ( < Cascader options = { optionsForActiveMenuItems } /> ) ;
217
234
0 commit comments