File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -644,7 +644,7 @@ const Select = createClass({
644644 var valueArray = this . getValueArray ( this . props . value ) ;
645645 if ( ! valueArray . length ) return ;
646646 if ( valueArray [ valueArray . length - 1 ] . clearableValue === false ) return ;
647- this . setValue ( valueArray . slice ( 0 , valueArray . length - 1 ) ) ;
647+ this . setValue ( this . props . multi ? valueArray . slice ( 0 , valueArray . length - 1 ) : null ) ;
648648 } ,
649649
650650 removeValue ( value ) {
Original file line number Diff line number Diff line change @@ -1850,6 +1850,19 @@ describe('Select', () => {
18501850 ] ) ;
18511851 } ) ;
18521852
1853+ it ( 'removes the last item with backspace' , ( ) => {
1854+
1855+ wrapper . setPropsForChild ( {
1856+ multi : false ,
1857+ value : 'one'
1858+ } ) ;
1859+ onChange . reset ( ) ; // Ignore previous onChange calls
1860+
1861+ pressBackspace ( ) ;
1862+
1863+ expect ( onChange , 'was called with' , null ) ;
1864+ } ) ;
1865+
18531866 it ( 'doesn\'t show the X if clearableValue=false' , ( ) => {
18541867
18551868 setValueProp ( [ 'two' ] ) ;
You can’t perform that action at this time.
0 commit comments