@patternfly/react-core 4.199.2 → 4.199.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/umd/react-core.min.css +219 -219
- package/package.json +5 -5
- package/src/components/AboutModal/__tests__/AboutModal.test.tsx +41 -60
- package/src/components/Accordion/__tests__/Accordion.test.tsx +23 -17
- package/src/components/Alert/__tests__/Alert.test.tsx +195 -184
- package/src/components/Alert/__tests__/Generated/AlertActionCloseButton.test.tsx +19 -17
- package/src/components/Alert/__tests__/Generated/__snapshots__/AlertActionCloseButton.test.tsx.snap +26 -4
- package/src/components/Alert/__tests__/__snapshots__/Alert.test.tsx.snap +50 -700
- package/src/components/AlertGroup/__tests__/AlertGroup.test.tsx +68 -73
- package/src/components/AlertGroup/__tests__/__snapshots__/AlertGroup.test.tsx.snap +1 -893
- package/src/components/ApplicationLauncher/__tests__/Generated/ApplicationLauncherSeparator.test.tsx +13 -10
- package/src/components/ApplicationLauncher/__tests__/Generated/__snapshots__/ApplicationLauncherSeparator.test.tsx.snap +12 -1
- package/src/components/Button/__tests__/Button.test.tsx +116 -107
- package/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap +21 -21
- package/src/components/Card/__tests__/Card.test.tsx +119 -100
- package/src/components/Card/__tests__/CardBody.test.tsx +35 -28
- package/src/components/Card/__tests__/CardFooter.test.tsx +28 -24
- package/src/components/Card/__tests__/CardHeadMain.test.tsx +19 -14
- package/src/components/Card/__tests__/CardHeader.test.tsx +6 -22
- package/src/components/Card/__tests__/CardHeaderMain.test.tsx +19 -14
- package/src/components/Card/__tests__/CardTitle.test.tsx +25 -0
- package/src/components/Card/__tests__/__snapshots__/Card.test.tsx.snap +12 -28
- package/src/components/Card/__tests__/__snapshots__/CardBody.test.tsx.snap +2 -4
- package/src/components/Card/__tests__/__snapshots__/CardFooter.test.tsx.snap +1 -3
- package/src/components/Card/__tests__/__snapshots__/CardHeadMain.test.tsx.snap +1 -11
- package/src/components/Card/__tests__/__snapshots__/CardHeader.test.tsx.snap +1 -11
- package/src/components/Card/__tests__/__snapshots__/CardHeaderMain.test.tsx.snap +1 -11
- package/src/components/Card/__tests__/__snapshots__/CardTitle.test.tsx.snap +3 -0
- package/src/components/Checkbox/__tests__/Checkbox.test.tsx +66 -70
- package/src/components/Checkbox/__tests__/__snapshots__/Checkbox.test.tsx.snap +9 -204
|
@@ -1,87 +1,82 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
|
+
|
|
4
7
|
import { Alert } from '../../Alert';
|
|
5
8
|
import { AlertGroup } from '../../AlertGroup';
|
|
6
9
|
import { AlertActionCloseButton } from '../../../components/Alert/AlertActionCloseButton';
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
describe('AlertGroup', () => {
|
|
12
|
+
test('Alert Group renders without children', () => {
|
|
13
|
+
const view = render(<AlertGroup />);
|
|
14
|
+
expect(view.container).toMatchSnapshot();
|
|
15
|
+
});
|
|
10
16
|
|
|
11
|
-
test('Alert Group works with
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
test('Alert Group works with n children', () => {
|
|
18
|
+
const view = render(
|
|
19
|
+
<AlertGroup>
|
|
20
|
+
<Alert variant="success" title="alert title" />
|
|
21
|
+
<Alert variant="warning" title="another alert title" />
|
|
22
|
+
</AlertGroup>
|
|
23
|
+
);
|
|
24
|
+
expect(view).toBeTruthy();
|
|
25
|
+
});
|
|
15
26
|
|
|
16
|
-
test('Alert
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
27
|
+
test('Alert group overflow shows up', () => {
|
|
28
|
+
const overflowMessage = 'View 2 more alerts';
|
|
29
|
+
const onOverflowClick = jest.fn();
|
|
20
30
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
</AlertGroup>
|
|
27
|
-
);
|
|
28
|
-
expect(view).toBeTruthy();
|
|
29
|
-
});
|
|
31
|
+
render(
|
|
32
|
+
<AlertGroup overflowMessage={overflowMessage} onOverflowClick={onOverflowClick}>
|
|
33
|
+
<Alert variant="danger" title="alert title" />
|
|
34
|
+
</AlertGroup>
|
|
35
|
+
);
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
const overflowMessage = "View 2 more alerts";
|
|
33
|
-
const onOverflowClick = jest.fn();
|
|
34
|
-
const wrapper = mount(
|
|
35
|
-
<AlertGroup overflowMessage={overflowMessage} onOverflowClick={onOverflowClick}>
|
|
36
|
-
<Alert variant="danger" title="alert title" />
|
|
37
|
-
</AlertGroup>
|
|
38
|
-
)
|
|
39
|
-
expect(wrapper.find('.pf-c-alert-group > li')).toHaveLength(2);
|
|
40
|
-
expect(wrapper.find('.pf-c-alert-group__overflow-button').text()).toContain(overflowMessage);
|
|
41
|
-
expect(wrapper).toMatchSnapshot();
|
|
42
|
-
wrapper.find('.pf-c-alert-group__overflow-button').simulate('click');
|
|
43
|
-
expect(onOverflowClick).toBeCalled();
|
|
44
|
-
});
|
|
37
|
+
expect(screen.getAllByRole('listitem')).toHaveLength(2);
|
|
45
38
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<AlertGroup>
|
|
49
|
-
<Alert variant="danger" title="alert title" />
|
|
50
|
-
</AlertGroup>
|
|
51
|
-
);
|
|
52
|
-
expect(wrapper.find('.pf-c-alert-group.pf-m-toast')).toHaveLength(0);
|
|
53
|
-
expect(wrapper).toMatchSnapshot();
|
|
54
|
-
});
|
|
39
|
+
const overflowButton = screen.getByRole('button', { name: 'View 2 more alerts' });
|
|
40
|
+
expect(overflowButton).toBeInTheDocument();
|
|
55
41
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
<Alert variant="warning" title="alert title" />
|
|
60
|
-
</AlertGroup>
|
|
61
|
-
);
|
|
62
|
-
expect(wrapper.find('.pf-c-alert-group.pf-m-toast')).toHaveLength(1);
|
|
63
|
-
expect(wrapper).toMatchSnapshot();
|
|
64
|
-
});
|
|
42
|
+
userEvent.click(overflowButton);
|
|
43
|
+
expect(onOverflowClick).toBeCalled();
|
|
44
|
+
});
|
|
65
45
|
|
|
66
|
-
test('Alert Group
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
46
|
+
test('Standard Alert Group is not a toast alert group', () => {
|
|
47
|
+
render(
|
|
48
|
+
<AlertGroup>
|
|
49
|
+
<Alert variant="danger" title="alert title" />
|
|
50
|
+
</AlertGroup>
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
expect(screen.getByText('alert title').parentElement).not.toHaveClass('pf-m-toast');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('Toast Alert Group contains expected modifier class', () => {
|
|
57
|
+
render(
|
|
58
|
+
<AlertGroup isToast aria-label="group label">
|
|
59
|
+
<Alert variant="warning" title="alert title" />
|
|
60
|
+
</AlertGroup>
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
expect(screen.getByLabelText('group label')).toHaveClass('pf-m-toast');
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test('alertgroup closes when alerts are closed', () => {
|
|
67
|
+
const onClose = jest.fn();
|
|
68
|
+
|
|
69
|
+
render(
|
|
70
|
+
<AlertGroup isToast appendTo={document.body}>
|
|
71
|
+
<Alert
|
|
72
|
+
isLiveRegion
|
|
73
|
+
title={'Test Alert'}
|
|
74
|
+
actionClose={<AlertActionCloseButton aria-label="Close" onClose={onClose} />}
|
|
75
|
+
/>
|
|
76
|
+
</AlertGroup>
|
|
77
|
+
);
|
|
72
78
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
<AlertGroup isToast appendTo={document.body}>
|
|
77
|
-
<Alert
|
|
78
|
-
isLiveRegion
|
|
79
|
-
title={'Test Alert'}
|
|
80
|
-
actionClose={<AlertActionCloseButton aria-label="Close" onClose={onClose} />}
|
|
81
|
-
/>
|
|
82
|
-
</AlertGroup>
|
|
83
|
-
);
|
|
84
|
-
expect(wrapper).toMatchSnapshot();
|
|
85
|
-
wrapper.find('button[aria-label="Close"]').simulate('click');
|
|
86
|
-
expect(onClose).toBeCalled();
|
|
79
|
+
userEvent.click(screen.getByLabelText('Close'));
|
|
80
|
+
expect(onClose).toBeCalled();
|
|
81
|
+
});
|
|
87
82
|
});
|