From 40401960cbeeeaeff748cf825538dab54ac63a6e Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Thu, 6 Aug 2020 17:37:09 -0700 Subject: [PATCH] Add integration test for line-chart annotation staggering --- .../integration/components/line-chart-test.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/ui/tests/integration/components/line-chart-test.js b/ui/tests/integration/components/line-chart-test.js index 50d524cce..9c01c85a1 100644 --- a/ui/tests/integration/components/line-chart-test.js +++ b/ui/tests/integration/components/line-chart-test.js @@ -100,4 +100,28 @@ module('Integration | Component | line chart', function(hooks) { await click('[data-test-annotation] button'); assert.ok(this.click.calledWith(annotations[0])); }); + + test('annotations will have staggered heights when too close to be positioned side-by-side', async function(assert) { + const annotations = [{ x: 2, type: 'info' }, { x: 2.4, type: 'error' }, { x: 9, type: 'info' }]; + this.setProperties({ + annotations, + data: [{ x: 1, y: 1 }, { x: 10, y: 10 }], + click: sinon.spy(), + }); + + await render(hbs` +
+ +
+ `); + + const annotationEls = findAll('[data-test-annotation]'); + assert.notOk(annotationEls[0].classList.contains('is-staggered')); + assert.ok(annotationEls[1].classList.contains('is-staggered')); + assert.notOk(annotationEls[2].classList.contains('is-staggered')); + }); });