Skip to content

Commit

Permalink
update List spec - code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
carloluis committed Nov 21, 2017
1 parent 115dffb commit 1af5a42
Showing 1 changed file with 32 additions and 8 deletions.
40 changes: 32 additions & 8 deletions src/suggestor/__tests__/List.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,35 +99,59 @@ describe('List component', () => {
it('should call onItemClick prop when <ListItem> is clicked', () => {
const wrapper = shallow(<List {...PROPS} filtered={filtered} open />);

wrapper.find('ListItem').first().simulate('itemClick');
wrapper
.find('ListItem')
.first()
.simulate('itemClick');

expect(PROPS.onItemClick).toHaveBeenCalledTimes(1);
});

it('should call onItemClick prop when each <ListItem> is clicked', () => {
const wrapper = shallow(<List {...PROPS} filtered={filtered} open />);

wrapper.find('ListItem').first().simulate('itemClick');
wrapper.find('ListItem').at(1).simulate('itemClick');
wrapper.find('ListItem').last(2).simulate('itemClick');
wrapper
.find('ListItem')
.first()
.simulate('itemClick');
wrapper
.find('ListItem')
.at(1)
.simulate('itemClick');
wrapper
.find('ListItem')
.last(2)
.simulate('itemClick');

expect(PROPS.onItemClick).toHaveBeenCalledTimes(3);
});

it('should call onItemMouseEnter prop when mouse enter into <ListItem> area', () => {
const wrapper = shallow(<List {...PROPS} filtered={filtered} open />);

wrapper.find('ListItem').first().simulate('itemMouseEnter');
wrapper
.find('ListItem')
.first()
.simulate('itemMouseEnter');

expect(PROPS.onItemMouseEnter).toHaveBeenCalledTimes(1);
});

it('should call onItemMouseEnter prop when mouse enter into each <ListItem> area', () => {
const wrapper = shallow(<List {...PROPS} filtered={filtered} open />);

wrapper.find('ListItem').first().simulate('itemMouseEnter');
wrapper.find('ListItem').at(1).simulate('itemMouseEnter');
wrapper.find('ListItem').last().simulate('itemMouseEnter');
wrapper
.find('ListItem')
.first()
.simulate('itemMouseEnter');
wrapper
.find('ListItem')
.at(1)
.simulate('itemMouseEnter');
wrapper
.find('ListItem')
.last()
.simulate('itemMouseEnter');

expect(PROPS.onItemMouseEnter).toHaveBeenCalledTimes(3);
});
Expand Down

0 comments on commit 1af5a42

Please sign in to comment.