QuickLinks: Prevent jsdom "Error: Not implemented: navigation" test output (https://github.com/woocommerce/woocommerce-admin/pull/4547)
This commit is contained in:
parent
227a499343
commit
bea82c93cd
|
@ -56,7 +56,12 @@ describe( 'QuickLinks', () => {
|
|||
const recordEvent = jest.fn();
|
||||
|
||||
render(
|
||||
<QuickLinks getSetting={ () => {} } recordEvent={ recordEvent } />
|
||||
<QuickLinks
|
||||
getSetting={ () => {} }
|
||||
recordEvent={ recordEvent }
|
||||
// Prevent jsdom "Error: Not implemented: navigation" in test output
|
||||
onItemClick={ () => false }
|
||||
/>
|
||||
);
|
||||
|
||||
userEvent.click(
|
||||
|
@ -76,7 +81,12 @@ describe( 'QuickLinks', () => {
|
|||
const recordEvent = jest.fn();
|
||||
|
||||
render(
|
||||
<QuickLinks getSetting={ () => {} } recordEvent={ recordEvent } />
|
||||
<QuickLinks
|
||||
getSetting={ () => {} }
|
||||
recordEvent={ recordEvent }
|
||||
// Prevent jsdom "Error: Not implemented: navigation" in test output
|
||||
onItemClick={ () => false }
|
||||
/>
|
||||
);
|
||||
|
||||
userEvent.click(
|
||||
|
@ -96,7 +106,12 @@ describe( 'QuickLinks', () => {
|
|||
const recordEvent = jest.fn();
|
||||
|
||||
render(
|
||||
<QuickLinks getSetting={ () => {} } recordEvent={ recordEvent } />
|
||||
<QuickLinks
|
||||
getSetting={ () => {} }
|
||||
recordEvent={ recordEvent }
|
||||
// Prevent jsdom "Error: Not implemented: navigation" in test output
|
||||
onItemClick={ () => false }
|
||||
/>
|
||||
);
|
||||
|
||||
userEvent.click(
|
||||
|
@ -118,7 +133,12 @@ describe( 'QuickLinks', () => {
|
|||
const recordEvent = jest.fn();
|
||||
|
||||
render(
|
||||
<QuickLinks getSetting={ () => {} } recordEvent={ recordEvent } />
|
||||
<QuickLinks
|
||||
getSetting={ () => {} }
|
||||
recordEvent={ recordEvent }
|
||||
// Prevent jsdom "Error: Not implemented: navigation" in test output
|
||||
onItemClick={ () => false }
|
||||
/>
|
||||
);
|
||||
|
||||
userEvent.click(
|
||||
|
@ -141,10 +161,6 @@ describe( 'QuickLinks', () => {
|
|||
<QuickLinks getSetting={ getSetting } recordEvent={ () => {} } />
|
||||
);
|
||||
|
||||
userEvent.click(
|
||||
screen.getByRole( 'menuitem', { name: 'View my store' } )
|
||||
);
|
||||
|
||||
expect( getSetting ).toHaveBeenCalledWith( 'siteUrl' );
|
||||
} );
|
||||
} );
|
||||
|
|
|
@ -105,7 +105,11 @@ describe( 'Link', () => {
|
|||
} );
|
||||
|
||||
it( 'should support `onClick`', () => {
|
||||
const clickHandler = jest.fn();
|
||||
// Prevent jsdom "Error: Not implemented: navigation" in test output
|
||||
const clickHandler = jest.fn( ( event ) => {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
} );
|
||||
|
||||
const { container } = render(
|
||||
<Link
|
||||
|
|
Loading…
Reference in New Issue