Skip to content

Commit

Permalink
[EuiModal] Unit test for button placement
Browse files Browse the repository at this point in the history
  • Loading branch information
acstll committed Dec 4, 2024
1 parent cccecc6 commit c38ca1c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/eui/src/components/modal/modal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { requiredProps } from '../../test';
import { shouldRenderCustomStyles } from '../../test/internal';

import { EuiModal } from './modal';
import { EuiHeader } from '../header';

describe('EuiModal', () => {
shouldRenderCustomStyles(<EuiModal onClose={() => {}}>children</EuiModal>);
Expand Down Expand Up @@ -80,4 +81,18 @@ describe('EuiModal', () => {
expect(modalB.getAttribute('style')).toEqual('max-inline-size: 50%;');
});
});

describe('reading order', () => {
test('button is placed after header', () => {
const { getByTestSubject } = render(
<EuiModal onClose={() => null}>
<EuiHeader data-test-subj="header">Title</EuiHeader>
children
</EuiModal>
);

const header = getByTestSubject('header');
expect(header.nextElementSibling?.tagName).toBe('BUTTON');
});
});
});

0 comments on commit c38ca1c

Please sign in to comment.