Skip to content

Commit 0199e70

Browse files
committed
Tests - Improve VueUiXyCanvas component test
1 parent dfb1208 commit 0199e70

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/components/vue-ui-xy-canvas.cy.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,18 @@ describe('<VueUiXyCanvas />', () => {
3535
});
3636
});
3737
});
38+
39+
it('emits', () => {
40+
cy.mount(VueUiXyCanvas, {
41+
props: {
42+
dataset,
43+
config
44+
}
45+
}).then(({ wrapper }) => {
46+
cy.log('@selectLegend');
47+
cy.get('[data-cy="legend-item"]').first().click({ force: true }).then(() => {
48+
expect(wrapper.emitted('selectLegend')).to.exist;
49+
});
50+
});
51+
});
3852
});

src/components/vue-ui-xy-canvas.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1701,7 +1701,7 @@ defineExpose({
17011701
<Legend v-if="FINAL_CONFIG.style.chart.legend.show && isDataset" :legendSet="legendSet" :config="legendConfig" :key="`legend_${legendStep}`"
17021702
@clickMarker="({ i }) => segregate(i)">
17031703
<template #item="{ legend, index }">
1704-
<div @click="legend.segregate()" :style="`opacity:${segregated.includes(index) ? 0.5 : 1}`">
1704+
<div data-cy="legend-item" @click="legend.segregate()" :style="`opacity:${segregated.includes(index) ? 0.5 : 1}`">
17051705
{{ legend.name }}
17061706
</div>
17071707
</template>

0 commit comments

Comments
 (0)