Skip to content

Commit

Permalink
Components: Refactor NoticeList tests to RTL (#45072)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed Oct 19, 2022
1 parent c1ce510 commit 5fff06a
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions packages/components/src/notice/test/list.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
/**
* External dependencies
*/
import ShallowRenderer from 'react-test-renderer/shallow';

/**
* WordPress dependencies
*/
import TokenList from '@wordpress/token-list';
import { render } from '@testing-library/react';

/**
* Internal dependencies
Expand All @@ -15,14 +10,11 @@ import NoticeList from '../list';

describe( 'NoticeList', () => {
it( 'should merge className', () => {
const renderer = new ShallowRenderer();

renderer.render( <NoticeList notices={ [] } className="is-ok" /> );

const classes = new TokenList(
renderer.getRenderOutput().props.className
const { container } = render(
<NoticeList notices={ [] } className="is-ok" />
);
expect( classes.contains( 'is-ok' ) ).toBe( true );
expect( classes.contains( 'components-notice-list' ) ).toBe( true );

expect( container.firstChild ).toHaveClass( 'is-ok' );
expect( container.firstChild ).toHaveClass( 'components-notice-list' );
} );
} );

0 comments on commit 5fff06a

Please sign in to comment.