Skip to content

Commit

Permalink
✅ Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dej611 committed Oct 20, 2021
1 parent 2df15b4 commit b77e717
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,13 @@ describe('PieVisualization component', () => {
`);
});

test('does not set click listener on non-interactive mode', () => {
test('does not set click listener and legend actions on non-interactive mode', () => {
const defaultArgs = getDefaultArgs();
const component = shallow(
<PieComponent args={{ ...args }} {...defaultArgs} interactive={false} />
);
expect(component.find(Settings).first().prop('onElementClick')).toBeUndefined();
expect(component.find(Settings).first().prop('legendAction')).toBeUndefined();
});

test('it renders the empty placeholder when metric contains only falsy data', () => {
Expand Down
10 changes: 10 additions & 0 deletions x-pack/plugins/lens/public/xy_visualization/expression.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1485,6 +1485,16 @@ describe('xy_expression', () => {
expect(wrapper.find(Settings).first().prop('onElementClick')).toBeUndefined();
});

test('legendAction is not triggering event on non-interactive mode', () => {
const { args, data } = sampleArgs();

const wrapper = mountWithIntl(
<XYChart {...defaultProps} data={data} args={args} interactive={false} />
);

expect(wrapper.find(Settings).first().prop('legendAction')).toBeUndefined();
});

test('it renders stacked bar', () => {
const { data, args } = sampleArgs();
const component = shallow(
Expand Down

0 comments on commit b77e717

Please sign in to comment.