aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-12-29 14:05:46 +0100
committerStas Vilchik <vilchiks@gmail.com>2015-12-29 14:05:46 +0100
commit804e2b83c28aee0b4337e7a7d7c8b4d6f55b6daa (patch)
tree6d8bea797139bb8c731a66b98fabe0b661192aea
parent458d8b33149bed4e3b1c0e579555734ee1d27b02 (diff)
downloadsonarqube-804e2b83c28aee0b4337e7a7d7c8b4d6f55b6daa.tar.gz
sonarqube-804e2b83c28aee0b4337e7a7d7c8b4d6f55b6daa.zip
SONAR-4004 hide source viewer on search
-rw-r--r--server/sonar-web/src/main/js/apps/code/reducers/index.js1
-rw-r--r--server/sonar-web/tests/apps/code/store-test.js6
2 files changed, 7 insertions, 0 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 7ecd8fe27e9..ca777f03d22 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
@@ -70,6 +70,7 @@ export function current (state = initialState, action) {
return {
...state,
searchResults: action.components,
+ sourceViewer: null,
errorMessage: null
};
case UPDATE_QUERY:
diff --git a/server/sonar-web/tests/apps/code/store-test.js b/server/sonar-web/tests/apps/code/store-test.js
index dbff7efd961..f0a809996f7 100644
--- a/server/sonar-web/tests/apps/code/store-test.js
+++ b/server/sonar-web/tests/apps/code/store-test.js
@@ -115,6 +115,12 @@ describe('Code :: Store', () => {
expect(current(initialState, browseAction(unknown, exampleComponents)).sourceViewer)
.to.be.null;
});
+
+ it('should be reset', () => {
+ const stateBefore = Object.assign({}, initialState, { sourceViewer: exampleComponent });
+ expect(current(stateBefore, searchAction(exampleComponents)).sourceViewer)
+ .to.be.null;
+ });
});
describe('coverageMetric', () => {
it('should be set to "coverage"', () => {