/** * @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(
השנה היא 2017.
); expect( screen.getByTestId( 'direction-test' ).getAttribute( 'direction' ) ).toEqual( 'rtl' ); } ); test( "doesn't add a direction to LTR text", () => { render(
The year is 2017.
); expect( screen.getByTestId( 'direction-test' ).getAttribute( 'direction' ) ).toBeNull(); } ); } ); } );