Skip to content

Commit

Permalink
Unit test covered bug fix: Table onChange event is fired every time w…
Browse files Browse the repository at this point in the history
…hen close filterDropdown
  • Loading branch information
adybionka committed Jul 5, 2018
1 parent 76fa567 commit d549b9d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions components/table/__tests__/Table.filter.test.js
Expand Up @@ -183,6 +183,16 @@ describe('Table.filter', () => {
expect(handleChange).toBeCalledWith({}, { name: ['boy'] }, {});
});

it('should not fire change event on close filterDropdown without changing anything', () => {
const handleChange = jest.fn();
const wrapper = mount(createTable({ onChange: handleChange }));
const dropdownWrapper = mount(wrapper.find('Trigger').instance().getComponent());

dropdownWrapper.find('.clear').simulate('click');

expect(handleChange).not.toHaveBeenCalled();
});

it('three levels menu', () => {
const filters = [
{ text: 'Upper', value: 'Upper' },
Expand Down

0 comments on commit d549b9d

Please sign in to comment.