Skip to content

Commit a7a0b19

Browse files
committed
Tests - Improve VueUiDonutEvolution component test
1 parent 7306701 commit a7a0b19

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/components/vue-ui-donut-evolution.cy.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('<VueUiDonutEvolution />', () => {
1313
dataset,
1414
config
1515
}
16-
}).then(() => {
16+
}).then(({ wrapper }) => {
1717

1818
testCommonFeatures({
1919
userOptions: true,
@@ -47,10 +47,12 @@ describe('<VueUiDonutEvolution />', () => {
4747
cy.get('[data-cy-zoom]').should('not.exist');
4848

4949
cy.log('segregates series when selecting legend items');
50-
cy.get('[data-cy-legend-item]').eq(0).click();
51-
cy.get(`[data-cy="arc_0"]`).should('have.length', 3);
52-
cy.get('[data-cy-legend-item]').eq(0).click();
53-
cy.get(`[data-cy="arc_0"]`).should('have.length', 4);
50+
cy.get('[data-cy="legend-item"]').eq(0).click().then(() => {
51+
cy.get(`[data-cy="arc_0"]`).should('have.length', 3);
52+
expect(wrapper.emitted('selectLegend')).to.exist;
53+
cy.get('[data-cy="legend-item"]').eq(0).click();
54+
cy.get(`[data-cy="arc_0"]`).should('have.length', 4);
55+
})
5456

5557
cy.log('shows donut hovered state');
5658
cy.get('[data-cy-trap]').eq(0).trigger('mouseenter');

src/components/vue-ui-donut-evolution.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ defineExpose({
11131113
@clickMarker="({legend}) => segregate(legend.uid)"
11141114
>
11151115
<template #item="{legend, index}">
1116-
<div data-cy-legend-item @click="segregate(legend.uid)" :style="`opacity:${segregated.includes(legend.uid) ? 0.5 : 1}`">
1116+
<div data-cy="legend-item" @click="segregate(legend.uid)" :style="`opacity:${segregated.includes(legend.uid) ? 0.5 : 1}`">
11171117
{{ legend.name }}: {{ applyDataLabel(
11181118
FINAL_CONFIG.style.chart.layout.dataLabels.formatter,
11191119
legend.value,

0 commit comments

Comments
 (0)