aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-10-17 17:34:59 +0200
committerStas Vilchik <stas.vilchik@sonarsource.com>2017-10-19 09:06:13 +0200
commit5e1cfb7c9fc843d45acffce74fa60719c3083095 (patch)
tree51138beae993b1ae1fb7ed5d8e7e0ce0fdbcb02f /server/sonar-web
parentdd40c169e7f8c81373c5beb2993ed993e3ac420f (diff)
downloadsonarqube-5e1cfb7c9fc843d45acffce74fa60719c3083095.tar.gz
sonarqube-5e1cfb7c9fc843d45acffce74fa60719c3083095.zip
SONAR-8638 Useless tooltip information in an issue's coverage
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.js8
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCoverage-test.js2
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineCoverage-test.js.snap3
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/popups/templates/source-viewer-coverage-popup.hbs16
4 files changed, 10 insertions, 19 deletions
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.js b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.js
index a8821c57a24..09e4448071f 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.js
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.js
@@ -43,13 +43,15 @@ export default class LineCoverage extends React.PureComponent {
const className =
'source-meta source-line-coverage' +
(line.coverageStatus != null ? ` source-line-${line.coverageStatus}` : '');
+ const hasPopup =
+ line.coverageStatus === 'covered' || line.coverageStatus === 'partially-covered';
const cell = (
<td
className={className}
data-line-number={line.line}
- role={line.coverageStatus != null ? 'button' : undefined}
- tabIndex={line.coverageStatus != null ? 0 : undefined}
- onClick={line.coverageStatus != null ? this.handleClick : undefined}>
+ role={hasPopup ? 'button' : undefined}
+ tabIndex={hasPopup ? 0 : undefined}
+ onClick={hasPopup ? this.handleClick : undefined}>
<div className="source-line-bar" />
</td>
);
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCoverage-test.js b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCoverage-test.js
index b657ec6e493..4bcd519e620 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCoverage-test.js
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCoverage-test.js
@@ -36,8 +36,6 @@ it('render uncovered line', () => {
const onClick = jest.fn();
const wrapper = shallow(<LineCoverage line={line} onClick={onClick} />);
expect(wrapper).toMatchSnapshot();
- click(wrapper.find('[tabIndex]'));
- expect(onClick).toHaveBeenCalled();
});
it('render line with unknown coverage', () => {
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineCoverage-test.js.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineCoverage-test.js.snap
index 12601c4190a..abef0b03565 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineCoverage-test.js.snap
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineCoverage-test.js.snap
@@ -38,9 +38,6 @@ exports[`render uncovered line 1`] = `
<td
className="source-meta source-line-coverage source-line-uncovered"
data-line-number={3}
- onClick={[Function]}
- role="button"
- tabIndex={0}
>
<div
className="source-line-bar"
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/popups/templates/source-viewer-coverage-popup.hbs b/server/sonar-web/src/main/js/components/SourceViewer/popups/templates/source-viewer-coverage-popup.hbs
index 57c6301119e..6238e9ffd39 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/popups/templates/source-viewer-coverage-popup.hbs
+++ b/server/sonar-web/src/main/js/components/SourceViewer/popups/templates/source-viewer-coverage-popup.hbs
@@ -1,19 +1,11 @@
<div class="bubble-popup-container">
- <div class="bubble-popup-title">
- {{#if row.lineHits}}
+ {{#each testFiles}}
+ <div class="bubble-popup-title">
{{t 'source_viewer.covered'}}
{{#if row.conditions}}
({{default row.coveredConditions 0}} of {{row.conditions}} {{t 'source_viewer.conditions'}})
{{/if}}
- {{else}}
- {{t 'source_viewer.not_covered'}}
- {{#if row.conditions}}
- ({{row.conditions}} {{t 'source_viewer.conditions'}})
- {{/if}}
- {{/if}}
- </div>
-
- {{#each testFiles}}
+ </div>
<div class="bubble-popup-section">
<a class="component-viewer-popup-test-file link-action" data-key="{{file.key}}" title="{{file.longName}}">
<span>{{collapsePath file.longName}}</span>
@@ -33,6 +25,8 @@
{{/each}}
</ul>
</div>
+ {{else}}
+ {{t 'source_viewer.tooltip.no_information_about_tests'}}
{{/each}}
</div>