@@ -193,7 +193,7 @@ describe('Cascader.Search', () => {
193193 errorSpy . mockRestore ( ) ;
194194 } ) ;
195195
196- it ( 'onChange should be triggered when click option with multiple' , ( ) => {
196+ it ( 'onChange should be triggered when click option with changeOnSelect + multiple' , ( ) => {
197197 const onChange = jest . fn ( ) ;
198198 const wrapper = mount (
199199 < Cascader checkable options = { options } changeOnSelect onChange = { onChange } showSearch /> ,
@@ -212,6 +212,23 @@ describe('Cascader.Search', () => {
212212 ) ;
213213 } ) ;
214214
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+
215232 it ( 'should not crash when exist options with same value on different levels' , ( ) => {
216233 const wrapper = mount ( < Cascader options = { optionsForActiveMenuItems } /> ) ;
217234
0 commit comments