From 51dbbdc923505399a031c9f569766d50d34d781e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gr=C3=A9goire=20Aubert?= Date: Wed, 12 Sep 2018 14:07:02 +0200 Subject: [PATCH] SONAR-11150 Display all results when searching in projects page language facet --- .../apps/projects/filters/LanguagesFilter.tsx | 8 +- .../__tests__/LanguagesFilter-test.tsx | 25 ----- .../LanguagesFilter-test.tsx.snap | 102 ------------------ 3 files changed, 2 insertions(+), 133 deletions(-) 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`] = `