File tree Expand file tree Collapse file tree 4 files changed +60
-55
lines changed Expand file tree Collapse file tree 4 files changed +60
-55
lines changed Original file line number Diff line number Diff line change @@ -31,19 +31,20 @@ function SearchBox(props) {
3131 className = "button searchbox__submit"
3232 />
3333 </ form >
34- < div >
35- { /* Using mousedown instead of click to ensure it has higher priority than
34+ { showSuggestions && suggestions . length > 1 && (
35+ < div >
36+ { /* Using mousedown instead of click to ensure it has higher priority than
3637 blur handler*/ }
37- { showSuggestions &&
38- suggestions . map ( suggestion => (
38+ { suggestions . map ( suggestion => (
3939 < div
4040 onMouseDown = { ( ) => onSelectSuggestion ( suggestion ) }
4141 key = { suggestion . suggestion }
4242 >
4343 { suggestion . suggestion }
4444 </ div >
4545 ) ) }
46- </ div >
46+ </ div >
47+ ) }
4748 </ React . Fragment >
4849 ) ;
4950}
Original file line number Diff line number Diff line change 11// Jest Snapshot v1, https://goo.gl/fbAQLP
22
33exports [` renders correctly when \` isFocused\` is false 1` ] = `
4- <form
5- className = " searchbox"
6- onSubmit = { [Function ]}
7- >
8- <input
9- className = " searchbox__text-input "
10- onChange = { [Function ]}
11- placeholder = " Search your documents…"
12- type = " text"
13- value = " test"
14- />
15- <input
16- className = " button searchbox__submit"
17- type = " submit"
18- value = " Search"
19- />
20- </form >
4+ <Fragment >
5+ <form
6+ className = " searchbox"
7+ onSubmit = { [Function ]}
8+ >
9+ <input
10+ className = " searchbox__text-input "
11+ onChange = { [Function ]}
12+ placeholder = " Search your documents…"
13+ type = " text"
14+ value = " test"
15+ />
16+ <input
17+ className = " button searchbox__submit"
18+ type = " submit"
19+ value = " Search"
20+ />
21+ </form >
22+ </Fragment >
2123` ;
2224
2325exports [` renders correctly when \` isFocused\` is true 1` ] = `
24- <form
25- className = " searchbox"
26- onSubmit = { [Function ]}
27- >
28- <input
29- className = " searchbox__text-input focus"
30- onChange = { [Function ]}
31- placeholder = " Search your documents…"
32- type = " text"
33- value = " test"
34- />
35- <input
36- className = " button searchbox__submit"
37- type = " submit"
38- value = " Search"
39- />
40- </form >
26+ <Fragment >
27+ <form
28+ className = " searchbox"
29+ onSubmit = { [Function ]}
30+ >
31+ <input
32+ className = " searchbox__text-input focus"
33+ onChange = { [Function ]}
34+ placeholder = " Search your documents…"
35+ type = " text"
36+ value = " test"
37+ />
38+ <input
39+ className = " button searchbox__submit"
40+ type = " submit"
41+ value = " Search"
42+ />
43+ </form >
44+ </Fragment >
4145` ;
Original file line number Diff line number Diff line change @@ -89,22 +89,20 @@ export class SearchBoxContainer extends Component {
8989 const { inputProps, querySuggestionResults } = this . props ;
9090
9191 return (
92- < React . Fragment >
93- < SearchBox
94- isFocused = { isFocused }
95- onChange = { this . handleChange }
96- onSelectSuggestion = { this . handleSelectSuggestion }
97- onSubmit = { this . handleSubmit }
98- showSuggestions = { showSuggestions }
99- suggestions = { querySuggestionResults }
100- value = { value }
101- inputProps = { {
102- onFocus : this . handleFocus ,
103- onBlur : this . handleBlur ,
104- ...inputProps
105- } }
106- />
107- </ React . Fragment >
92+ < SearchBox
93+ isFocused = { isFocused }
94+ onChange = { this . handleChange }
95+ onSelectSuggestion = { this . handleSelectSuggestion }
96+ onSubmit = { this . handleSubmit }
97+ showSuggestions = { showSuggestions }
98+ suggestions = { querySuggestionResults }
99+ value = { value }
100+ inputProps = { {
101+ onFocus : this . handleFocus ,
102+ onBlur : this . handleBlur ,
103+ ...inputProps
104+ } }
105+ />
108106 ) ;
109107 }
110108}
Original file line number Diff line number Diff line change @@ -10,7 +10,9 @@ exports[`renders correctly 1`] = `
1010 }
1111 isFocused = { false }
1212 onChange = { [Function ]}
13+ onSelectSuggestion = { [Function ]}
1314 onSubmit = { [Function ]}
15+ showSuggestions = { false }
1416 value = " test"
1517/>
1618` ;
You can’t perform that action at this time.
0 commit comments