2020-09-13 22:50:02 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { render } from '@testing-library/react';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import { Connect } from '../index.js';
|
|
|
|
|
|
|
|
describe( 'Rendering', () => {
|
|
|
|
it( 'should render an abort button when the abort handler is provided', async () => {
|
2021-03-04 12:15:03 +00:00
|
|
|
const { container } = render(
|
|
|
|
<Connect createNotice={ () => {} } onAbort={ () => {} } />
|
|
|
|
);
|
2020-09-13 22:50:02 +00:00
|
|
|
|
|
|
|
const buttons = container.querySelectorAll( 'button' );
|
|
|
|
|
|
|
|
expect( buttons.length ).toBe( 2 );
|
|
|
|
expect( buttons[ 1 ].textContent ).toBe( 'Abort' );
|
|
|
|
} );
|
|
|
|
} );
|