]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-11150 Display all results when searching in projects page language facet
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Wed, 12 Sep 2018 12:07:02 +0000 (14:07 +0200)
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>
Thu, 13 Sep 2018 09:59:19 +0000 (11:59 +0200)
server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.tsx
server/sonar-web/src/main/js/apps/projects/filters/__tests__/LanguagesFilter-test.tsx
server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/LanguagesFilter-test.tsx.snap

index 385425c48f6692bb22647086ffeb50e02d50e9fa..78e8479b6655f9bb4f846f648216c3711aaac9f2 100644 (file)
@@ -35,11 +35,9 @@ interface Props {
   organization?: { key: string };
   property?: string;
   query: { [x: string]: any };
-  value?: Array<string>;
+  value?: string[];
 }
 
-const LIST_SIZE = 10;
-
 export default class LanguagesFilter extends React.Component<Props> {
   static contextTypes = {
     languages: PropTypes.object.isRequired
@@ -50,9 +48,7 @@ export default class LanguagesFilter extends React.Component<Props> {
     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 = {}) =>
index 27ea25d17dd3e43d0f351918817e2411ebd03d0c..e80fd1a134fc6c662680718255c6a54649f2b106 100644 (file)
@@ -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(
-    <LanguagesFilter
-      query={{ languages: ['java', 'g'] }}
-      value={['java', 'g']}
-      facet={{ ...languagesFacet, g: 1 }}
-      isFavorite={true}
-    />,
-    { context: { languages: manyLanguages } }
-  );
-  expect(wrapper).toMatchSnapshot();
-});
index 38b723918390f844dc6354c2ad45af1a335b0655..3c1d072d3c741b9b74b632a2162af823a64c7775 100644 (file)
@@ -1,107 +1,5 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
-exports[`should render maximum 10 languages in the searchbox results 1`] = `
-<Filter
-  facet={
-    Object {
-      "cs": 4,
-      "g": 1,
-      "java": 39,
-      "js": 1,
-    }
-  }
-  footer={
-    <SearchableFilterFooter
-      isFavorite={true}
-      options={
-        Array [
-          Object {
-            "label": "Flex",
-            "value": "flex",
-          },
-          Object {
-            "label": "PHP",
-            "value": "php",
-          },
-          Object {
-            "label": "Python",
-            "value": "py",
-          },
-          Object {
-            "label": "c",
-            "value": "c",
-          },
-          Object {
-            "label": "d",
-            "value": "d",
-          },
-          Object {
-            "label": "e",
-            "value": "e",
-          },
-          Object {
-            "label": "f",
-            "value": "f",
-          },
-          Object {
-            "label": "h",
-            "value": "h",
-          },
-          Object {
-            "label": "i",
-            "value": "i",
-          },
-          Object {
-            "label": "k",
-            "value": "k",
-          },
-        ]
-      }
-      property="languages"
-      query={
-        Object {
-          "languages": Array [
-            "java",
-            "g",
-          ],
-        }
-      }
-    />
-  }
-  getFacetValueForOption={[Function]}
-  header={
-    <FilterHeader
-      name="projects.facets.languages"
-    />
-  }
-  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`] = `
 <Filter
   facet={