import { describe, expect, it } from 'vitest'; import { render } from '@testing-library/react'; import FullscreenMode from '..'; describe( 'FullscreenMode', () => { it( 'fullscreen mode to be added to document body when active', () => { const { baseElement } = render( ); expect( baseElement ).toHaveClass( 'is-fullscreen-mode' ); } ); it( 'fullscreen mode not to be added to document body when active', () => { const { baseElement } = render( ); expect( baseElement ).not.toHaveClass( 'is-fullscreen-mode' ); } ); it( 'sticky-menu to be removed from the body class if present', () => { document.body.classList.add( 'sticky-menu' ); const { baseElement } = render( ); expect( baseElement ).not.toHaveClass( 'sticky-menu' ); } ); it( 'sticky-menu to be restored when component unmounted and originally present', () => { document.body.classList.add( 'sticky-menu' ); const { baseElement, unmount } = render( ); unmount(); expect( baseElement ).toHaveClass( 'sticky-menu' ); } ); it( 'fullscreen mode to be removed from document body when component unmounted', () => { const { baseElement, unmount } = render( ); // Present after mounting with `isActive` expect( baseElement ).toHaveClass( 'is-fullscreen-mode' ); unmount(); // Removed after unmounting. expect( baseElement ).not.toHaveClass( 'is-fullscreen-mode' ); } ); } );