From: Grégoire Aubert Date: Wed, 12 Sep 2018 12:07:02 +0000 (+0200) Subject: SONAR-11150 Display all results when searching in projects page language facet X-Git-Tag: 6.7.6~14 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=51dbbdc923505399a031c9f569766d50d34d781e;p=sonarqube.git SONAR-11150 Display all results when searching in projects page language facet --- diff --git a/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.tsx index 385425c48f6..78e8479b665 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.tsx +++ b/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.tsx @@ -35,11 +35,9 @@ interface Props { organization?: { key: string }; property?: string; query: { [x: string]: any }; - value?: Array; + value?: string[]; } -const LIST_SIZE = 10; - export default class LanguagesFilter extends React.Component { static contextTypes = { languages: PropTypes.object.isRequired @@ -50,9 +48,7 @@ export default class LanguagesFilter extends React.Component { if (this.props.facet) { languageKeys = difference(languageKeys, Object.keys(this.props.facet)); } - return languageKeys - .slice(0, LIST_SIZE) - .map(key => ({ label: this.context.languages[key].name, value: key })); + return languageKeys.map(key => ({ label: this.context.languages[key].name, value: key })); }; getSortedOptions = (facet: Facet = {}) => diff --git a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/LanguagesFilter-test.tsx b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/LanguagesFilter-test.tsx index 27ea25d17dd..e80fd1a134f 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/LanguagesFilter-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/LanguagesFilter-test.tsx @@ -52,28 +52,3 @@ it('should render the languages facet with the selected languages', () => { expect(wrapper).toMatchSnapshot(); expect(wrapper.find('Filter').shallow()).toMatchSnapshot(); }); - -it('should render maximum 10 languages in the searchbox results', () => { - const manyLanguages = { - ...languages, - c: { key: 'c', name: 'c' }, - d: { key: 'd', name: 'd' }, - e: { key: 'e', name: 'e' }, - f: { key: 'f', name: 'f' }, - g: { key: 'g', name: 'g' }, - h: { key: 'h', name: 'h' }, - i: { key: 'i', name: 'i' }, - k: { key: 'k', name: 'k' }, - l: { key: 'l', name: 'l' } - }; - const wrapper = shallow( - , - { context: { languages: manyLanguages } } - ); - expect(wrapper).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/LanguagesFilter-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/LanguagesFilter-test.tsx.snap index 38b72391839..3c1d072d3c7 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/LanguagesFilter-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/LanguagesFilter-test.tsx.snap @@ -1,107 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`should render maximum 10 languages in the searchbox results 1`] = ` - - } - getFacetValueForOption={[Function]} - header={ - - } - isFavorite={true} - options={ - Array [ - "java", - "cs", - "g", - "js", - ] - } - property="languages" - query={ - Object { - "languages": Array [ - "java", - "g", - ], - } - } - renderOption={[Function]} - value={ - Array [ - "java", - "g", - ] - } -/> -`; - exports[`should render the languages facet with the selected languages 1`] = `