diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-11-13 17:40:16 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-11-13 17:40:16 +0100 |
commit | 814378a88f0b75f943d043e48d2a61488d83f134 (patch) | |
tree | 422b5f56ae17c9d402479496e8235a98cfd4999a /server/sonar-web/tests | |
parent | 0430222bca81a898ad5e2888755a3fb0f1b4d9d9 (diff) | |
download | sonarqube-814378a88f0b75f943d043e48d2a61488d83f134.tar.gz sonarqube-814378a88f0b75f943d043e48d2a61488d83f134.zip |
SONAR-6331 make it possible to display a timeline on RATING and LEVEL measures
Diffstat (limited to 'server/sonar-web/tests')
-rw-r--r-- | server/sonar-web/tests/apps/overview/components/timeline-chart-test.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/server/sonar-web/tests/apps/overview/components/timeline-chart-test.js b/server/sonar-web/tests/apps/overview/components/timeline-chart-test.js index 82d7d66a593..3aae4e12c64 100644 --- a/server/sonar-web/tests/apps/overview/components/timeline-chart-test.js +++ b/server/sonar-web/tests/apps/overview/components/timeline-chart-test.js @@ -23,6 +23,44 @@ const FORMAT = (tick) => tick; describe('TimelineChart', function () { + it('should work with LEVEL', function () { + const DATA = [ + { x: new Date(2015, 0, 1), y: 'OK' }, + { x: new Date(2015, 0, 2), y: 'WARN' }, + { x: new Date(2015, 0, 3), y: 'ERROR' }, + { x: new Date(2015, 0, 4), y: 'WARN' } + ]; + + let timeline = <Timeline width={100} height={100} data={DATA} metricType="LEVEL" events={[]} + formatYTick={FORMAT}/>; + let output = TestUtils.renderIntoDocument(timeline); + let ticks = TestUtils.scryRenderedDOMComponentsWithClass(output, 'line-chart-tick-x'); + expect(ticks).to.have.length(3); + expect(ticks[0].textContent).to.equal('ERROR'); + expect(ticks[1].textContent).to.equal('WARN'); + expect(ticks[2].textContent).to.equal('OK'); + }); + + it('should work with RATING', function () { + const DATA = [ + { x: new Date(2015, 0, 1), y: 1 }, + { x: new Date(2015, 0, 2), y: 3 }, + { x: new Date(2015, 0, 3), y: 1 }, + { x: new Date(2015, 0, 4), y: 4 } + ]; + + let timeline = <Timeline width={100} height={100} data={DATA} metricType="RATING" events={[]} + formatYTick={FORMAT}/>; + let output = TestUtils.renderIntoDocument(timeline); + let ticks = TestUtils.scryRenderedDOMComponentsWithClass(output, 'line-chart-tick-x'); + expect(ticks).to.have.length(5); + expect(ticks[0].textContent).to.equal('5'); + expect(ticks[1].textContent).to.equal('4'); + expect(ticks[2].textContent).to.equal('3'); + expect(ticks[3].textContent).to.equal('2'); + expect(ticks[4].textContent).to.equal('1'); + }); + it('should display the zero Y tick if all values are zero', function () { let timeline = <Timeline width={100} height={100} data={ZERO_DATA} events={[]} formatYTick={FORMAT}/>; let output = TestUtils.renderIntoDocument(timeline); |