File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,9 @@ describe('Test for Footer', function () {
6464 } ) ;
6565
6666 expect ( Actions . updateSearchTerm ) . toHaveBeenCalledWith ( 'hello' ) ;
67+
68+ instance . componentWillReceiveProps ( { showSearch : false } ) ;
69+ expect ( Actions . updateSearchTerm ) . toHaveBeenCalledWith ( '' ) ;
6770 } ) ;
6871
6972 it ( 'Should only render clear button if search term is not empty' , function ( ) {
Original file line number Diff line number Diff line change @@ -14,6 +14,15 @@ var Search = React.createClass({
1414 } ;
1515 } ,
1616
17+ componentWillReceiveProps : function ( nextProps ) {
18+ if ( nextProps . showSearch === false ) {
19+ this . setState ( {
20+ searchTerm : ''
21+ } ) ;
22+ Actions . updateSearchTerm ( '' ) ;
23+ }
24+ } ,
25+
1726 updateSearchTerm : function ( event ) {
1827 this . setState ( {
1928 searchTerm : event . target . value
You can’t perform that action at this time.
0 commit comments