-
-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add pagination tests #354
Conversation
const pageButtons = component.find('li.rainbow-pagination_button'); | ||
expect(pageButtons.get(2).props.className).toBe('rainbow-pagination_button rainbow-pagination_button--active'); | ||
}); | ||
it('should set aria-current to "page" to the active anchor element', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add test when is not active that set aria-current to undefined
const component = mount(<PageButtons pages={1} onChange={onChangeMockFn} activePage={1} />); | ||
const anchor = component.find('a'); | ||
anchor.simulate('click'); | ||
expect(onChangeMockFn).toHaveBeenCalledTimes(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check instead toHaveBeenCalledWith to test that it is called with the right arguments
const anchor = component.find('a'); | ||
anchor.simulate('click'); | ||
expect(onChangeMockFn).toHaveBeenCalledTimes(1); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add test for aria-label
const component = mount(<Pagination pages={5} activePage={5} />); | ||
const navButtons = component.find('NavigationButton'); | ||
expect(navButtons.get(1).props.disabled).toBe(true); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add test that check that aria-label is set to pagination.
also add a11y test
add test for onClick in NavigationButton (both).
No description provided.