Skip to content

Commit 577fc53

Browse files
committed
Tests - Improve VueUiTreemap component test
1 parent 0199e70 commit 577fc53

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/components/vue-ui-treemap.cy.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,38 @@ describe('<VueUiTreemap />', () => {
3838
cy.get('[data-cy="datapoint-rect"]').should('exist').and('be.visible').and('have.length', 16);
3939
});
4040
});
41+
42+
it('emits', () => {
43+
cy.mount(VueUiTreemap, {
44+
props: {
45+
dataset,
46+
config
47+
}
48+
}).then(({ wrapper }) => {
49+
cy.log('@selectLegend');
50+
cy.get('[data-cy="legend-item-0"]').click().then(() => {
51+
expect(wrapper.emitted('selectLegend')).to.exist
52+
});
53+
54+
cy.log('@selectDatapoint');
55+
cy.get('[data-cy="datapoint-rect"]').first().click({ force: true }).then(() => {
56+
expect(wrapper.emitted('selectDatapoint')).to.exist
57+
expect(wrapper.emitted('selectDatapoint')[0][0]).to.have.keys(
58+
'children',
59+
'color',
60+
'id',
61+
'name',
62+
'normalizedValue',
63+
'parentId',
64+
'parentName',
65+
'proportion',
66+
'value',
67+
'x0',
68+
'x1',
69+
'y0',
70+
'y1'
71+
);
72+
});
73+
});
74+
});
4175
});

0 commit comments

Comments
 (0)