diff options
author | Mathieu Suen <mathieu.suen@sonarsource.com> | 2022-03-31 17:04:46 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-04-05 20:03:16 +0000 |
commit | 052a4458e6225349fedb8a6ebd03347cd12a4753 (patch) | |
tree | 419df2a128e836cbad13db59f333bc9ab1fc74e4 /server/sonar-web | |
parent | 975758278cf78e56f8f536a05f211ca4eb1c017a (diff) | |
download | sonarqube-052a4458e6225349fedb8a6ebd03347cd12a4753.tar.gz sonarqube-052a4458e6225349fedb8a6ebd03347cd12a4753.zip |
SONAR-16157 Avoid duplicate primary location
Diffstat (limited to 'server/sonar-web')
-rw-r--r-- | server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.tsx | 2 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCode-test.tsx | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.tsx index 17fe386ae95..a6dc9efcd28 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.tsx @@ -246,7 +246,7 @@ export default class LineCode extends React.PureComponent<Props, State> { selectedIssue={selectedIssue} /> )} - {selectedIssue && !showIssues && ( + {selectedIssue && !showIssues && issueLocations.length > 0 && ( <LineIssuesList branchLike={this.props.branchLike} issuePopup={this.props.issuePopup} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCode-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCode-test.tsx index 92ee72265e2..616878e5037 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCode-test.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCode-test.tsx @@ -22,6 +22,7 @@ import * as React from 'react'; import { mockBranch } from '../../../../helpers/mocks/branch-like'; import { mockIssue, mockSourceLine } from '../../../../helpers/testMocks'; import LineCode from '../LineCode'; +import LineIssuesList from '../LineIssuesList'; it('render code', () => { expect(shallowRender()).toMatchSnapshot(); @@ -37,6 +38,12 @@ it('render code', () => { ).toMatchSnapshot('with secondary location'); }); +it('should not render issue list when no issue location', () => { + const wrapper = shallowRender({ issueLocations: [], showIssues: false }); + + expect(wrapper.find(LineIssuesList).length).toBe(0); +}); + function shallowRender(props: Partial<LineCode['props']> = {}) { return shallow( <LineCode |