]> source.dussan.org Git - sonarqube.git/commitdiff
Fix reset button on navbar searchbox not working with less then 2 chars
authorPascal Mugnier <pascal.mugnier@sonarsource.com>
Tue, 8 May 2018 09:45:36 +0000 (11:45 +0200)
committerSonarTech <sonartech@sonarsource.com>
Thu, 24 May 2018 18:20:47 +0000 (20:20 +0200)
server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityDateInput-test.js.snap
server/sonar-web/src/main/js/components/controls/SearchBox.tsx

index 74e05f0bbf694dd405526dd8006cfa49be965966..d10a64ba95cf09c97be700ad19d4f9615fb3ab92 100644 (file)
@@ -1,8 +1,21 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`should render correctly the date inputs 1`] = `
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`should render correctly the date inputs 1`] = `
 <div>
-  <DateRangeInput onChange={[Function]} value={ Object { "from": 2016-10-27T12:21:15.000Z, "to": 2016-12-27T12:21:15.000Z,
-    } } />
-  <Button className="spacer-left" disabled={false} onClick={[Function]}>
+  <DateRangeInput
+    onChange={[Function]}
+    value={
+      Object {
+        "from": 2016-10-27T12:21:15.000Z,
+        "to": 2016-12-27T12:21:15.000Z,
+      }
+    }
+  />
+  <Button
+    className="spacer-left"
+    disabled={false}
+    onClick={[Function]}
+  >
     project_activity.reset_dates
   </Button>
 </div>
index 84329946fedc16eb54eeefaf459baf2cb096c949..09b7c0a8074c20d59b7f6c5170f490fbdb068da5 100644 (file)
@@ -105,7 +105,7 @@ export default class SearchBox extends React.PureComponent<Props, State> {
 
   handleResetClick = () => {
     this.changeValue('', false);
-    if (this.props.value === undefined) {
+    if (this.props.value === undefined || this.props.value === '') {
       this.setState({ value: '' });
     }
     if (this.input) {