diff options
Diffstat (limited to 'spec/frontend/pipelines/components/dag/dag_graph_spec.js')
-rw-r--r-- | spec/frontend/pipelines/components/dag/dag_graph_spec.js | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/spec/frontend/pipelines/components/dag/dag_graph_spec.js b/spec/frontend/pipelines/components/dag/dag_graph_spec.js index 7786212cb69..ccfb2ae7cee 100644 --- a/spec/frontend/pipelines/components/dag/dag_graph_spec.js +++ b/spec/frontend/pipelines/components/dag/dag_graph_spec.js @@ -20,7 +20,7 @@ describe('The DAG graph', () => { } wrapper = shallowMount(DagGraph, { - attachToDocument: true, + attachTo: document.body, propsData, data() { return { @@ -88,17 +88,13 @@ describe('The DAG graph', () => { }); it('renders the title as text', () => { - expect( - getAllLabels() - .at(0) - .text(), - ).toBe(parsedData.nodes[0].name); + expect(getAllLabels().at(0).text()).toBe(parsedData.nodes[0].name); }); }); }); describe('interactions', () => { - const strokeOpacity = opacity => `stroke-opacity: ${opacity};`; + const strokeOpacity = (opacity) => `stroke-opacity: ${opacity};`; const baseOpacity = () => wrapper.vm.$options.viewOptions.baseOpacity; describe('links', () => { @@ -168,10 +164,10 @@ describe('The DAG graph', () => { describe('nodes', () => { const liveNode = () => getAllNodes().at(10); const anotherLiveNode = () => getAllNodes().at(5); - const nodesNotHighlighted = () => getAllNodes().filter(n => !n.classes(IS_HIGHLIGHTED)); - const linksNotHighlighted = () => getAllLinks().filter(n => !n.classes(IS_HIGHLIGHTED)); - const nodesHighlighted = () => getAllNodes().filter(n => n.classes(IS_HIGHLIGHTED)); - const linksHighlighted = () => getAllLinks().filter(n => n.classes(IS_HIGHLIGHTED)); + const nodesNotHighlighted = () => getAllNodes().filter((n) => !n.classes(IS_HIGHLIGHTED)); + const linksNotHighlighted = () => getAllLinks().filter((n) => !n.classes(IS_HIGHLIGHTED)); + const nodesHighlighted = () => getAllNodes().filter((n) => n.classes(IS_HIGHLIGHTED)); + const linksHighlighted = () => getAllLinks().filter((n) => n.classes(IS_HIGHLIGHTED)); describe('on click', () => { it('highlights the clicked node and predecessors', () => { @@ -180,19 +176,19 @@ describe('The DAG graph', () => { expect(nodesNotHighlighted().length < getAllNodes().length).toBe(true); expect(linksNotHighlighted().length < getAllLinks().length).toBe(true); - linksHighlighted().wrappers.forEach(link => { + linksHighlighted().wrappers.forEach((link) => { expect(link.attributes('style')).toBe(strokeOpacity(highlightIn)); }); - nodesHighlighted().wrappers.forEach(node => { + nodesHighlighted().wrappers.forEach((node) => { expect(node.attributes('stroke')).not.toBe('#f2f2f2'); }); - linksNotHighlighted().wrappers.forEach(link => { + linksNotHighlighted().wrappers.forEach((link) => { expect(link.attributes('style')).toBe(strokeOpacity(highlightOut)); }); - nodesNotHighlighted().wrappers.forEach(node => { + nodesNotHighlighted().wrappers.forEach((node) => { expect(node.attributes('stroke')).toBe('#f2f2f2'); }); }); |