From: Stas Vilchik Date: Wed, 13 Jan 2016 08:32:16 +0000 (+0100) Subject: SONAR-7177 sort files before directories X-Git-Tag: 5.4-M5~29 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e4ed767dd4144722c9bca0a031c07f92b2a86229;p=sonarqube.git SONAR-7177 sort files before directories --- diff --git a/server/sonar-web/src/main/js/apps/code/reducers/index.js b/server/sonar-web/src/main/js/apps/code/reducers/index.js index 0e697778d32..988140f717b 100644 --- a/server/sonar-web/src/main/js/apps/code/reducers/index.js +++ b/server/sonar-web/src/main/js/apps/code/reducers/index.js @@ -55,7 +55,7 @@ function compare (a, b) { } function sortChildren (children) { - const QUALIFIERS_ORDER = ['DIR', 'FIL', 'UTS']; + const QUALIFIERS_ORDER = ['FIL', 'UTS', 'DIR']; const temp = [...children]; temp.sort((a, b) => { const qualifierA = QUALIFIERS_ORDER.indexOf(a.qualifier); diff --git a/server/sonar-web/tests/apps/code/store-test.js b/server/sonar-web/tests/apps/code/store-test.js index 04b1e179835..613eee6517e 100644 --- a/server/sonar-web/tests/apps/code/store-test.js +++ b/server/sonar-web/tests/apps/code/store-test.js @@ -78,12 +78,12 @@ describe('Code :: Store', () => { it('should sort components by qualifier and then by name', () => { const component = {}; const componentsBefore = [ - { key: 'A', name: 'A', qualifier: 'FIL' }, - { key: 'B', name: 'B', qualifier: 'DIR' } + { key: 'A', name: 'A', qualifier: 'DIR' }, + { key: 'B', name: 'B', qualifier: 'FIL' } ]; const componentsAfter = [ - { key: 'B', name: 'B', qualifier: 'DIR' }, - { key: 'A', name: 'A', qualifier: 'FIL' } + { key: 'B', name: 'B', qualifier: 'FIL' }, + { key: 'A', name: 'A', qualifier: 'DIR' } ]; expect(current(initialState, browseAction(component, componentsBefore)).components) .to.deep.equal(componentsAfter);