/**
* @jest-environment jsdom
*/
import { render, screen } from '@testing-library/react';
import { Button, Icon } from '@wordpress/components';
import { cog } from '@wordpress/icons';
import { SectionHeader } from '..';
describe( 'SectionHeader', () => {
test( 'should render with title', () => {
render( );
expect( screen.getByRole( 'heading', { name: 'Test Title' } ) ).toBeVisible();
} );
test( 'should render with description', () => {
render( );
expect( screen.getByText( 'Test Description' ) ).toBeVisible();
} );
test( 'should render with action buttons', () => {
render(
>
}
/>
);
expect( screen.getByRole( 'button', { name: 'Cancel' } ) ).toBeVisible();
expect( screen.getByRole( 'button', { name: 'Save' } ) ).toBeVisible();
} );
test( 'should render with decoration', () => {
render(
}
/>
);
expect( screen.getByTestId( 'decoration' ) ).toBeVisible();
} );
test( 'should render with default level 2 heading', () => {
render( );
expect( screen.getByRole( 'heading', { name: 'Test Title' } ).tagName ).toBe( 'H2' );
} );
test( 'should render with different heading level when explicitly set', () => {
render( );
expect( screen.getByRole( 'heading', { name: 'Test Title' } ).tagName ).toBe( 'H3' );
} );
test( 'should render with prefix content', () => {
render(
Prefix Content }
/>
);
expect( screen.getByTestId( 'prefix' ) ).toBeVisible();
expect( screen.getByText( 'Prefix Content' ) ).toBeVisible();
} );
} );