Skip to content
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

Merged
merged 2 commits into from
Oct 27, 2018
Merged

Conversation

AlejandroYanes
Copy link
Collaborator

No description provided.

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', () => {

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);

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);
});

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);
});

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).

@coveralls
Copy link

Pull Request Test Coverage Report for Build 58

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.7%) to 74.746%

Totals Coverage Status
Change from base Build 52: 0.7%
Covered Lines: 1098
Relevant Lines: 1400

💛 - Coveralls

@LeandroTorresSicilia LeandroTorresSicilia merged commit 7be3b2d into master Oct 27, 2018
@TahimiLeonBravo TahimiLeonBravo deleted the add-pagination-tests branch September 23, 2019 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants