Server IP : 104.21.14.103 / Your IP : 18.223.106.79 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/thread-self/root/home/giankuin/sieuthiweb.com.vn/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/base/components/label/test/ |
Upload File : |
/** * External dependencies */ import TestRenderer from 'react-test-renderer'; /** * Internal dependencies */ import Label from '../'; describe( 'Label', () => { describe( 'without wrapperElement', () => { test( 'should render both label and screen reader label', () => { const component = TestRenderer.create( <Label label="Lorem" screenReaderLabel="Ipsum" /> ); expect( component.toJSON() ).toMatchSnapshot(); } ); test( 'should render only the label', () => { const component = TestRenderer.create( <Label label="Lorem" /> ); expect( component.toJSON() ).toMatchSnapshot(); } ); test( 'should render only the screen reader label', () => { const component = TestRenderer.create( <Label screenReaderLabel="Ipsum" /> ); expect( component.toJSON() ).toMatchSnapshot(); } ); } ); describe( 'with wrapperElement', () => { test( 'should render both label and screen reader label', () => { const component = TestRenderer.create( <Label label="Lorem" screenReaderLabel="Ipsum" wrapperElement="label" wrapperProps={ { className: 'foo-bar', 'data-foo': 'bar', } } /> ); expect( component.toJSON() ).toMatchSnapshot(); } ); test( 'should render only the label', () => { const component = TestRenderer.create( <Label label="Lorem" wrapperElement="label" wrapperProps={ { className: 'foo-bar', 'data-foo': 'bar', } } /> ); expect( component.toJSON() ).toMatchSnapshot(); } ); test( 'should render only the screen reader label', () => { const component = TestRenderer.create( <Label screenReaderLabel="Ipsum" wrapperElement="label" wrapperProps={ { className: 'foo-bar', 'data-foo': 'bar', } } /> ); expect( component.toJSON() ).toMatchSnapshot(); } ); } ); } );