From e4ed767dd4144722c9bca0a031c07f92b2a86229 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Wed, 13 Jan 2016 09:32:16 +0100 Subject: [PATCH] SONAR-7177 sort files before directories --- server/sonar-web/src/main/js/apps/code/reducers/index.js | 2 +- server/sonar-web/tests/apps/code/store-test.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) 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); -- 2.39.5