403Webshell
Server IP : 104.21.14.103  /  Your IP : 18.220.163.144
Web Server : LiteSpeed
System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : giankuin ( 1871)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/base/components/chip/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/base/components/chip/test/index.js
/**
 * External dependencies
 */
import TestRenderer from 'react-test-renderer';

/**
 * Internal dependencies
 */
import { Chip, RemovableChip } from '..';

describe( 'Chip', () => {
	test( 'should render text', () => {
		const component = TestRenderer.create( <Chip text="Test" /> );

		expect( component.toJSON() ).toMatchSnapshot();
	} );

	test( 'should render nodes as the text', () => {
		const component = TestRenderer.create(
			<Chip text={ <h1>Test</h1> } />
		);

		expect( component.toJSON() ).toMatchSnapshot();
	} );

	test( 'should render defined radius', () => {
		const component = TestRenderer.create(
			<Chip text="Test" radius="large" />
		);

		expect( component.toJSON() ).toMatchSnapshot();
	} );

	test( 'should render screen reader text', () => {
		const component = TestRenderer.create(
			<Chip text="Test" screenReaderText="Test 2" />
		);

		expect( component.toJSON() ).toMatchSnapshot();
	} );

	test( 'should render children nodes', () => {
		const component = TestRenderer.create(
			<Chip text="Test">Lorem Ipsum</Chip>
		);

		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(
				<Chip text="Test" element="div" />
			);

			expect( component.toJSON() ).toMatchSnapshot();
		} );
	} );
} );

describe( 'RemovableChip', () => {
	test( 'should render text and the remove button', () => {
		const component = TestRenderer.create( <RemovableChip text="Test" /> );

		expect( component.toJSON() ).toMatchSnapshot();
	} );

	test( 'should render with disabled remove button', () => {
		const component = TestRenderer.create(
			<RemovableChip text="Test" disabled={ true } />
		);

		expect( component.toJSON() ).toMatchSnapshot();
	} );

	test( 'should render custom aria label', () => {
		const component = TestRenderer.create(
			<RemovableChip text={ <h1>Test</h1> } ariaLabel="Aria test" />
		);

		expect( component.toJSON() ).toMatchSnapshot();
	} );

	test( 'should render default aria label if text is a node', () => {
		const component = TestRenderer.create(
			<RemovableChip text={ <h1>Test</h1> } screenReaderText="Test 2" />
		);

		expect( component.toJSON() ).toMatchSnapshot();
	} );

	test( 'should render screen reader text aria label', () => {
		const component = TestRenderer.create(
			<RemovableChip text="Test" screenReaderText="Test 2" />
		);

		expect( component.toJSON() ).toMatchSnapshot();
	} );

	describe( 'with removeOnAnyClick', () => {
		test( 'should be a button when removeOnAnyClick is set to true', () => {
			const component = TestRenderer.create(
				<RemovableChip text="Test" removeOnAnyClick={ true } />
			);

			expect( component.toJSON() ).toMatchSnapshot();
		} );
	} );
} );

Youez - 2016 - github.com/yon3zu
LinuXploit