aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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"', () => {