Skip to content

Commit 0cf0098

Browse files
committed
Tests - Improve VueUiHistoryPlot component test
1 parent 3b4de2c commit 0cf0098

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/components/vue-ui-history-plot.cy.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,33 @@ describe('<VueUiHistoryPlot />', () => {
5454
cy.get('[data-cy="datapoint-index-label"]').should('exist').and('be.visible').and('have.length', dataset.map(d => d.values.length).reduce((a, b) => a + b, 0));
5555
});
5656
});
57+
58+
it('emits', () => {
59+
cy.mount(VueUiHistoryPlot, {
60+
props: {
61+
config,
62+
dataset
63+
}
64+
}).then(({ wrapper }) => {
65+
cy.log('@selectLegend');
66+
cy.get('[data-cy="legend-item-0"]').click({ force: true }).then(() => {
67+
expect(wrapper.emitted('selectLegend')).to.exist;
68+
})
69+
70+
cy.log('@selectDatapoint');
71+
cy.get('[data-cy="tooltip-trap"]').first().click({ force: true }).then(() => {
72+
expect(wrapper.emitted('selectDatapoint')).to.exist;
73+
expect(wrapper.emitted('selectDatapoint')[0][0]).to.have.keys(
74+
'color',
75+
'id',
76+
'label',
77+
'seriesName',
78+
'valueX',
79+
'valueY',
80+
'x',
81+
'y'
82+
);
83+
});
84+
});
85+
});
5786
});

0 commit comments

Comments
 (0)