@@ -1998,38 +1998,13 @@ describe('Select.Basic', () => {
19981998 } ) ;
19991999
20002000 describe ( 'should allow typing when notFoundContent is null and no options match' , ( ) => {
2001- it ( 'single' , ( ) => {
2002- const onSearch = jest . fn ( ) ;
2003- const { container } = render (
2004- < Select showSearch notFoundContent = { null } onSearch = { onSearch } >
2005- < Option value = "jack" > Jack</ Option >
2006- < Option value = "lucy" > Lucy</ Option >
2007- </ Select > ,
2008- ) ;
2009-
2010- const input = container . querySelector ( 'input' ) ;
2011-
2012- // Type 'j' - should match 'Jack'
2013- fireEvent . change ( input , { target : { value : 'j' } } ) ;
2014- expect ( onSearch ) . toHaveBeenLastCalledWith ( 'j' ) ;
2015- expect ( input . value ) . toBe ( 'j' ) ;
2016- expect ( container . querySelectorAll ( '.rc-select-item-option' ) ) . toHaveLength ( 1 ) ;
2017-
2018- // Type 'x' - no match, but input should still work
2019- fireEvent . change ( input , { target : { value : 'x' } } ) ;
2020- expect ( onSearch ) . toHaveBeenLastCalledWith ( 'x' ) ;
2021- expect ( input . value ) . toBe ( 'x' ) ;
2022-
2023- // Type more characters - should continue working
2024- fireEvent . change ( input , { target : { value : 'xyz' } } ) ;
2025- expect ( onSearch ) . toHaveBeenLastCalledWith ( 'xyz' ) ;
2026- expect ( input . value ) . toBe ( 'xyz' ) ;
2027- } ) ;
2028-
2029- it ( 'multiple' , ( ) => {
2001+ it . each < { mode : 'multiple' | undefined ; label : string } > ( [
2002+ { mode : undefined , label : 'single' } ,
2003+ { mode : 'multiple' , label : 'multiple' } ,
2004+ ] ) ( '$label' , ( { mode } ) => {
20302005 const onSearch = jest . fn ( ) ;
20312006 const { container } = render (
2032- < Select mode = "multiple" showSearch notFoundContent = { null } onSearch = { onSearch } >
2007+ < Select mode = { mode } showSearch notFoundContent = { null } onSearch = { onSearch } >
20332008 < Option value = "jack" > Jack</ Option >
20342009 < Option value = "lucy" > Lucy</ Option >
20352010 </ Select > ,
0 commit comments