From: Stas Vilchik Date: Fri, 24 Nov 2017 16:15:30 +0000 (+0100) Subject: fix assignee select in bulk change form X-Git-Tag: 7.0-RC1~278 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cf0f94223f4466e53c04bd74861f3432c67d33dd;p=sonarqube.git fix assignee select in bulk change form --- diff --git a/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.js b/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.js index be83b1df340..f5b15d1aac8 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.js +++ b/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.js @@ -295,7 +295,7 @@ export default class BulkChangeModal extends React.PureComponent { { - this.setState({ options: [], query: '' }); - }; - handleChange = (option /*: Option */) => { this.props.onSelect(option.value); }; - handleInputChange = (query /*: string */ = '') => { + handleInputChange = (query /*: string */) => { + // `onInputChange` is called with an empty string after a user selects a value + // in this case we shouldn't reset `options`, because it also resets select value :( if (query.length >= this.props.minimumQueryLength) { this.setState({ loading: true, query }); this.search(query); - } else { + } else if (query.length > 0) { this.setState({ options: [], query }); } }; @@ -121,7 +119,7 @@ export default class SearchSelect extends React.PureComponent { ? translateWithParameters('select2.tooShort', this.props.minimumQueryLength) : translate('select2.noMatches') } - onBlur={this.props.resetOnBlur ? this.handleBlur : undefined} + onBlurResetsInput={this.props.resetOnBlur} onChange={this.handleChange} onInputChange={this.handleInputChange} onOpen={this.props.minimumQueryLength === 0 ? this.handleInputChange : undefined} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SearchSelect-test.js.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SearchSelect-test.js.snap index 0aae3eb7466..00b34224f8c 100644 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SearchSelect-test.js.snap +++ b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SearchSelect-test.js.snap @@ -9,7 +9,7 @@ exports[`should render Select 1`] = ` filterOption={[Function]} isLoading={false} noResultsText="select2.tooShort.2" - onBlur={[Function]} + onBlurResetsInput={true} onChange={[Function]} onInputChange={[Function]} options={Array []}