May 2019
Intermediate to advanced
496 pages
10h 38m
English
The RouterButton component we saw earlier renders a Link, which is given an object that should be serialized into a query string. When the user clicks this link, React Router will navigate to a new location.
One of the buttons on the page is the Next button, which moves to the next page of results. Let's look at how the Next button is tested:
const renderSearchButtons = props => render( <SearchButtons pathname="/path" lastRowIds={['123']} searchTerm="term" customers={tenCustomers} {...props} /> );describe('next button', () => { it('renders', () => { renderSearchButtons(); const button = elementMatching(id('next-page')); expect(button).toBeDefined(); expect(button.type).toEqual(RouterButton); ...Read now
Unlock full access