-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathFormSection.test.jsx
More file actions
34 lines (26 loc) · 1.01 KB
/
FormSection.test.jsx
File metadata and controls
34 lines (26 loc) · 1.01 KB
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
31
32
33
34
import React from 'react';
import { render } from '@testing-library/react';
import { expect, it } from 'vitest';
import { FormSection } from '@components/Form';
import createMatchMedia from '../../helpers/createMatchMedia';
import isAccessible from '../../utils/axe';
const MockChildrenComponent = () => <div />;
const MockFormSection = () => (
<FormSection title="Example Title">
<MockChildrenComponent />
</FormSection>
);
it('should be accessible', () => {
isAccessible(render(<MockFormSection />));
});
it('renders 20px padding by default', () => {
const component = render(<MockFormSection />);
const adjustableBox = getComputedStyle(component.container.firstChild);
expect(adjustableBox.padding).toBe('20px');
});
it("renders 10px padding after MUI breakpoint 'sm' is triggered", () => {
window.matchMedia = createMatchMedia(599);
const component = render(<MockFormSection />);
const adjustableBox = getComputedStyle(component.container.firstChild);
expect(adjustableBox.padding).toBe('10px');
});