File size: 769 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
/**
* @jest-environment jsdom
*/
import { render, screen } from '@testing-library/react';
import AutoDirection from '..';
describe( 'AutoDirection', () => {
describe( 'component rendering', () => {
test( 'adds a direction to RTL text', () => {
render(
<AutoDirection>
<div data-testid="direction-test">השנה היא 2017.</div>
</AutoDirection>
);
expect( screen.getByTestId( 'direction-test' ).getAttribute( 'direction' ) ).toEqual( 'rtl' );
} );
test( "doesn't add a direction to LTR text", () => {
render(
<AutoDirection>
<div data-testid="direction-test">The year is 2017.</div>
</AutoDirection>
);
expect( screen.getByTestId( 'direction-test' ).getAttribute( 'direction' ) ).toBeNull();
} );
} );
} );
|