/**
* External dependencies
*/
import TestRenderer from 'react-test-renderer';
/**
* Internal dependencies
*/
import { Chip, RemovableChip } from '..';
describe( 'Chip', () => {
test( 'should render text', () => {
const component = TestRenderer.create( );
expect( component.toJSON() ).toMatchSnapshot();
} );
test( 'should render nodes as the text', () => {
const component = TestRenderer.create(
Test } />
);
expect( component.toJSON() ).toMatchSnapshot();
} );
test( 'should render defined radius', () => {
const component = TestRenderer.create(
);
expect( component.toJSON() ).toMatchSnapshot();
} );
test( 'should render screen reader text', () => {
const component = TestRenderer.create(
);
expect( component.toJSON() ).toMatchSnapshot();
} );
test( 'should render children nodes', () => {
const component = TestRenderer.create(
Lorem Ipsum
);
expect( component.toJSON() ).toMatchSnapshot();
} );
describe( 'with custom wrapper', () => {
test( 'should render a chip made up of a div instead of a li', () => {
const component = TestRenderer.create(
);
expect( component.toJSON() ).toMatchSnapshot();
} );
} );
} );
describe( 'RemovableChip', () => {
test( 'should render text and the remove button', () => {
const component = TestRenderer.create( );
expect( component.toJSON() ).toMatchSnapshot();
} );
test( 'should render with disabled remove button', () => {
const component = TestRenderer.create(
);
expect( component.toJSON() ).toMatchSnapshot();
} );
test( 'should render custom aria label', () => {
const component = TestRenderer.create(
Test } ariaLabel="Aria test" />
);
expect( component.toJSON() ).toMatchSnapshot();
} );
test( 'should render default aria label if text is a node', () => {
const component = TestRenderer.create(
Test } screenReaderText="Test 2" />
);
expect( component.toJSON() ).toMatchSnapshot();
} );
test( 'should render screen reader text aria label', () => {
const component = TestRenderer.create(
);
expect( component.toJSON() ).toMatchSnapshot();
} );
describe( 'with removeOnAnyClick', () => {
test( 'should be a button when removeOnAnyClick is set to true', () => {
const component = TestRenderer.create(
);
expect( component.toJSON() ).toMatchSnapshot();
} );
} );
} );