@patternfly/react-core 4.199.2 → 4.199.5

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/umd/react-core.css +2 -2
  3. package/dist/umd/react-core.min.css +221 -221
  4. package/package.json +6 -6
  5. package/src/components/AboutModal/__tests__/AboutModal.test.tsx +41 -60
  6. package/src/components/Accordion/__tests__/Accordion.test.tsx +23 -17
  7. package/src/components/Alert/__tests__/Alert.test.tsx +195 -184
  8. package/src/components/Alert/__tests__/Generated/AlertActionCloseButton.test.tsx +19 -17
  9. package/src/components/Alert/__tests__/Generated/__snapshots__/AlertActionCloseButton.test.tsx.snap +26 -4
  10. package/src/components/Alert/__tests__/__snapshots__/Alert.test.tsx.snap +50 -700
  11. package/src/components/AlertGroup/__tests__/AlertGroup.test.tsx +68 -73
  12. package/src/components/AlertGroup/__tests__/__snapshots__/AlertGroup.test.tsx.snap +1 -893
  13. package/src/components/ApplicationLauncher/__tests__/Generated/ApplicationLauncherSeparator.test.tsx +13 -10
  14. package/src/components/ApplicationLauncher/__tests__/Generated/__snapshots__/ApplicationLauncherSeparator.test.tsx.snap +12 -1
  15. package/src/components/Button/__tests__/Button.test.tsx +116 -107
  16. package/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap +21 -21
  17. package/src/components/Card/__tests__/Card.test.tsx +119 -100
  18. package/src/components/Card/__tests__/CardBody.test.tsx +35 -28
  19. package/src/components/Card/__tests__/CardFooter.test.tsx +28 -24
  20. package/src/components/Card/__tests__/CardHeadMain.test.tsx +19 -14
  21. package/src/components/Card/__tests__/CardHeader.test.tsx +6 -22
  22. package/src/components/Card/__tests__/CardHeaderMain.test.tsx +19 -14
  23. package/src/components/Card/__tests__/CardTitle.test.tsx +25 -0
  24. package/src/components/Card/__tests__/__snapshots__/Card.test.tsx.snap +12 -28
  25. package/src/components/Card/__tests__/__snapshots__/CardBody.test.tsx.snap +2 -4
  26. package/src/components/Card/__tests__/__snapshots__/CardFooter.test.tsx.snap +1 -3
  27. package/src/components/Card/__tests__/__snapshots__/CardHeadMain.test.tsx.snap +1 -11
  28. package/src/components/Card/__tests__/__snapshots__/CardHeader.test.tsx.snap +1 -11
  29. package/src/components/Card/__tests__/__snapshots__/CardHeaderMain.test.tsx.snap +1 -11
  30. package/src/components/Card/__tests__/__snapshots__/CardTitle.test.tsx.snap +3 -0
  31. package/src/components/Checkbox/__tests__/Checkbox.test.tsx +66 -70
  32. package/src/components/Checkbox/__tests__/__snapshots__/Checkbox.test.tsx.snap +9 -204
  33. package/src/components/ClipboardCopy/examples/ClipboardCopy.md +11 -123
  34. package/src/components/ClipboardCopy/examples/ClipboardCopyBasic.tsx +8 -0
  35. package/src/components/ClipboardCopy/examples/ClipboardCopyExpanded.tsx +9 -0
  36. package/src/components/ClipboardCopy/examples/ClipboardCopyExpandedWithArray.tsx +14 -0
  37. package/src/components/ClipboardCopy/examples/ClipboardCopyInlineCompact.tsx +7 -0
  38. package/src/components/ClipboardCopy/examples/ClipboardCopyInlineCompactCode.tsx +8 -0
  39. package/src/components/ClipboardCopy/examples/ClipboardCopyInlineCompactInSentence.tsx +36 -0
  40. package/src/components/ClipboardCopy/examples/ClipboardCopyInlineCompactWithAdditionalAction.tsx +20 -0
  41. package/src/components/ClipboardCopy/examples/ClipboardCopyJSONObject.tsx +18 -0
  42. package/src/components/ClipboardCopy/examples/ClipboardCopyReadOnly.tsx +8 -0
  43. package/src/components/ClipboardCopy/examples/ClipboardCopyReadOnlyExpanded.tsx +9 -0
  44. package/src/components/ClipboardCopy/examples/ClipboardCopyReadOnlyExpandedByDefault.tsx +9 -0
@@ -1,13 +1,16 @@
1
- /**
2
- * This test was generated
3
- */
4
- import * as React from 'react';
5
- import { shallow } from 'enzyme';
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+
6
4
  import { ApplicationLauncherSeparator } from '../../ApplicationLauncherSeparator';
7
- // any missing imports can usually be resolved by adding them here
8
- import {} from '../..';
5
+ import { DropdownArrowContext } from '../../../Dropdown/dropdownConstants';
9
6
 
10
- it('ApplicationLauncherSeparator should match snapshot (auto-generated)', () => {
11
- const view = shallow(<ApplicationLauncherSeparator />);
12
- expect(view).toMatchSnapshot();
7
+ describe('ApplicationLauncherSeparator', () => {
8
+ it('should match snapshot', () => {
9
+ const view = render(
10
+ <DropdownArrowContext.Provider value={{ sendRef: jest.fn(), keyHandler: undefined }}>
11
+ <ApplicationLauncherSeparator />
12
+ </DropdownArrowContext.Provider>
13
+ );
14
+ expect(view.container).toMatchSnapshot();
15
+ });
13
16
  });
@@ -1,3 +1,14 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`ApplicationLauncherSeparator should match snapshot (auto-generated) 1`] = `<DropdownSeparator />`;
3
+ exports[`ApplicationLauncherSeparator should match snapshot 1`] = `
4
+ <div>
5
+ <li
6
+ role="separator"
7
+ >
8
+ <div
9
+ class="pf-c-divider"
10
+ role="separator"
11
+ />
12
+ </li>
13
+ </div>
14
+ `;
@@ -1,132 +1,141 @@
1
- import { Button, ButtonVariant } from '../Button';
2
1
  import React from 'react';
3
- import { render } from '@testing-library/react';
4
- import { mount } from 'enzyme';
2
+
3
+ import { render, screen } from '@testing-library/react';
4
+ import '@testing-library/jest-dom';
5
+
5
6
  import CartArrowDownIcon from '@patternfly/react-icons/dist/esm/icons/cart-arrow-down-icon';
7
+ import { Button, ButtonVariant } from '../Button';
8
+
9
+ describe('Button', () => {
10
+ Object.values(ButtonVariant).forEach(variant => {
11
+ test(`${variant} button`, () => {
12
+ const view = render(
13
+ <Button variant={variant} aria-label={variant}>
14
+ {variant} Button
15
+ </Button>
16
+ );
17
+ expect(view.container).toMatchSnapshot();
18
+ });
19
+ });
20
+
21
+ test('it adds an aria-label to plain buttons', () => {
22
+ const label = 'aria-label test';
23
+ render(<Button aria-label={label} />);
6
24
 
7
- Object.values(ButtonVariant).forEach(variant => {
8
- test(`${variant} button`, () => {
25
+ expect(screen.getByLabelText(label)).toBeTruthy();
26
+ });
27
+
28
+ test('link with icon', () => {
9
29
  const view = render(
10
- <Button variant={variant} aria-label={variant}>
11
- {variant} Button
30
+ <Button variant={ButtonVariant.link} icon={<CartArrowDownIcon />}>
31
+ Block Button
12
32
  </Button>
13
33
  );
14
34
  expect(view.container).toMatchSnapshot();
15
35
  });
16
- });
17
36
 
18
- test('it adds an aria-label to plain buttons', () => {
19
- const label = 'aria-label test';
20
- const view = mount(<Button aria-label={label} />);
21
- expect(view.find('button').props()['aria-label']).toBe(label);
22
- });
37
+ test('isBlock', () => {
38
+ const view = render(<Button isBlock>Block Button</Button>);
39
+ expect(view.container).toMatchSnapshot();
40
+ });
23
41
 
24
- test('link with icon', () => {
25
- const view = render(
26
- <Button variant={ButtonVariant.link} icon={<CartArrowDownIcon />}>
27
- Block Button
28
- </Button>
29
- );
30
- expect(view.container).toMatchSnapshot();
31
- });
42
+ test('isDisabled', () => {
43
+ const view = render(<Button isDisabled>Disabled Button</Button>);
44
+ expect(view.container).toMatchSnapshot();
45
+ });
32
46
 
33
- test('isBlock', () => {
34
- const view = render(<Button isBlock>Block Button</Button>);
35
- expect(view.container).toMatchSnapshot();
36
- });
47
+ test('isDanger secondary', () => {
48
+ const view = render(
49
+ <Button variant="secondary" isDanger>
50
+ Disabled Button
51
+ </Button>
52
+ );
53
+ expect(view.container).toMatchSnapshot();
54
+ });
37
55
 
38
- test('isDisabled', () => {
39
- const view = render(<Button isDisabled>Disabled Button</Button>);
40
- expect(view.container).toMatchSnapshot();
41
- });
56
+ test('isDanger link', () => {
57
+ const view = render(
58
+ <Button variant="link" isDanger>
59
+ Disabled Button
60
+ </Button>
61
+ );
62
+ expect(view.container).toMatchSnapshot();
63
+ });
42
64
 
43
- test('isDanger secondary', () => {
44
- const view = render(
45
- <Button variant="secondary" isDanger>
46
- Disabled Button
47
- </Button>
48
- );
49
- expect(view.container).toMatchSnapshot();
50
- });
65
+ test('isAriaDisabled button', () => {
66
+ const view = render(<Button isAriaDisabled>Disabled yet focusable button</Button>);
67
+ expect(view.container).toMatchSnapshot();
68
+ });
51
69
 
52
- test('isDanger link', () => {
53
- const view = render(
54
- <Button variant="link" isDanger>
55
- Disabled Button
56
- </Button>
57
- );
58
- expect(view.container).toMatchSnapshot();
59
- });
70
+ test('isAriaDisabled link button', () => {
71
+ const view = render(
72
+ <Button isAriaDisabled component="a">
73
+ Disabled yet focusable button
74
+ </Button>
75
+ );
76
+ expect(view.container).toMatchSnapshot();
77
+ });
60
78
 
61
- test('isAriaDisabled button', () => {
62
- const view = render(<Button isAriaDisabled>Disabled yet focusable button</Button>);
63
- expect(view.container).toMatchSnapshot();
64
- });
79
+ test('isInline', () => {
80
+ const view = render(
81
+ <Button variant={ButtonVariant.link} isInline>
82
+ Hovered Button
83
+ </Button>
84
+ );
85
+ expect(view.container).toMatchSnapshot();
86
+ });
65
87
 
66
- test('isAriaDisabled link button', () => {
67
- const view = render(
68
- <Button isAriaDisabled component="a">
69
- Disabled yet focusable button
70
- </Button>
71
- );
72
- expect(view.container).toMatchSnapshot();
73
- });
88
+ test('isSmall', () => {
89
+ const view = render(<Button isSmall>Small Button</Button>);
90
+ expect(view.container).toMatchSnapshot();
91
+ });
74
92
 
75
- test('isInline', () => {
76
- const view = render(
77
- <Button variant={ButtonVariant.link} isInline>
78
- Hovered Button
79
- </Button>
80
- );
81
- expect(view.container).toMatchSnapshot();
82
- });
93
+ test('isLarge', () => {
94
+ const view = render(<Button isLarge>Large Button</Button>);
95
+ expect(view.container).toMatchSnapshot();
96
+ });
83
97
 
84
- test('isSmall', () => {
85
- const view = render(<Button isSmall>Small Button</Button>);
86
- expect(view.container).toMatchSnapshot();
87
- });
98
+ test('isLoading', () => {
99
+ const view = render(
100
+ <Button isLoading spinnerAriaValueText="Loading">
101
+ Loading Button
102
+ </Button>
103
+ );
104
+ expect(view.container).toMatchSnapshot();
105
+ });
88
106
 
89
- test('isLarge', () => {
90
- const view = render(<Button isLarge>Large Button</Button>);
91
- expect(view.container).toMatchSnapshot();
92
- });
107
+ test('allows passing in a string as the component', () => {
108
+ const component = 'a';
109
+ render(<Button component={component}>anchor button</Button>);
93
110
 
94
- test('isLoading', () => {
95
- const view = render(
96
- <Button isLoading spinnerAriaValueText="Loading">
97
- Loading Button
98
- </Button>
99
- );
100
- expect(view.container).toMatchSnapshot();
101
- });
111
+ expect(screen.getByText('anchor button')).toBeInTheDocument();
112
+ });
102
113
 
103
- test('allows passing in a string as the component', () => {
104
- const component = 'a';
105
- const view = mount(<Button component={component} />);
106
- expect(view.find(component).type()).toBe(component);
107
- });
114
+ test('allows passing in a React Component as the component', () => {
115
+ const Component = () => <div>im a div</div>;
116
+ render(<Button component={Component} />);
108
117
 
109
- test('allows passing in a React Component as the component', () => {
110
- const Component = () => <div>im a div</div>;
111
- const view = mount(<Button component={Component} />);
112
- expect(view.find(Component).type()).toBe(Component);
113
- });
118
+ expect(screen.getByText('im a div')).toBeInTheDocument();
119
+ });
114
120
 
115
- test('aria-disabled is set to true and tabIndex to -1 if component is not a button and is disabled', () => {
116
- const view = render(
117
- <Button component="a" isDisabled>
118
- Disabled Anchor Button
119
- </Button>
120
- );
121
- expect(view.container).toMatchSnapshot();
122
- });
121
+ test('aria-disabled is set to true and tabIndex to -1 if component is not a button and is disabled', () => {
122
+ const view = render(
123
+ <Button component="a" isDisabled>
124
+ Disabled Anchor Button
125
+ </Button>
126
+ );
127
+ expect(view.container).toMatchSnapshot();
128
+ });
123
129
 
124
- test('setting tab index through props', () => {
125
- const view = mount(<Button tabIndex={0}>TabIndex 0 Button</Button>);
126
- expect(view.find('button').props().tabIndex).toBe(0);
127
- });
130
+ test('setting tab index through props', () => {
131
+ render(<Button tabIndex={0}>TabIndex 0 Button</Button>);
132
+ expect(screen.getByRole('button').getAttribute('tabindex')).toEqual('0');
133
+ });
128
134
 
129
- test('isLoading icon only', () => {
130
- const view = render(<Button variant="plain" isLoading aria-label="Upload" spinnerAriaValueText="Loading" icon={<div>ICON</div>} />)
131
- expect(view.container).toMatchSnapshot();
132
- })
135
+ test('isLoading icon only', () => {
136
+ const view = render(
137
+ <Button variant="plain" isLoading aria-label="Upload" spinnerAriaValueText="Loading" icon={<div>ICON</div>} />
138
+ );
139
+ expect(view.container).toMatchSnapshot();
140
+ });
141
+ });
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`aria-disabled is set to true and tabIndex to -1 if component is not a button and is disabled 1`] = `
3
+ exports[`Button aria-disabled is set to true and tabIndex to -1 if component is not a button and is disabled 1`] = `
4
4
  <div>
5
5
  <a
6
6
  aria-disabled="true"
@@ -15,7 +15,7 @@ exports[`aria-disabled is set to true and tabIndex to -1 if component is not a b
15
15
  </div>
16
16
  `;
17
17
 
18
- exports[`control button 1`] = `
18
+ exports[`Button control button 1`] = `
19
19
  <div>
20
20
  <button
21
21
  aria-disabled="false"
@@ -32,7 +32,7 @@ exports[`control button 1`] = `
32
32
  </div>
33
33
  `;
34
34
 
35
- exports[`danger button 1`] = `
35
+ exports[`Button danger button 1`] = `
36
36
  <div>
37
37
  <button
38
38
  aria-disabled="false"
@@ -49,7 +49,7 @@ exports[`danger button 1`] = `
49
49
  </div>
50
50
  `;
51
51
 
52
- exports[`isAriaDisabled button 1`] = `
52
+ exports[`Button isAriaDisabled button 1`] = `
53
53
  <div>
54
54
  <button
55
55
  aria-disabled="true"
@@ -64,7 +64,7 @@ exports[`isAriaDisabled button 1`] = `
64
64
  </div>
65
65
  `;
66
66
 
67
- exports[`isAriaDisabled link button 1`] = `
67
+ exports[`Button isAriaDisabled link button 1`] = `
68
68
  <div>
69
69
  <a
70
70
  aria-disabled="true"
@@ -78,7 +78,7 @@ exports[`isAriaDisabled link button 1`] = `
78
78
  </div>
79
79
  `;
80
80
 
81
- exports[`isBlock 1`] = `
81
+ exports[`Button isBlock 1`] = `
82
82
  <div>
83
83
  <button
84
84
  aria-disabled="false"
@@ -93,7 +93,7 @@ exports[`isBlock 1`] = `
93
93
  </div>
94
94
  `;
95
95
 
96
- exports[`isDanger link 1`] = `
96
+ exports[`Button isDanger link 1`] = `
97
97
  <div>
98
98
  <button
99
99
  aria-disabled="false"
@@ -108,7 +108,7 @@ exports[`isDanger link 1`] = `
108
108
  </div>
109
109
  `;
110
110
 
111
- exports[`isDanger secondary 1`] = `
111
+ exports[`Button isDanger secondary 1`] = `
112
112
  <div>
113
113
  <button
114
114
  aria-disabled="false"
@@ -123,7 +123,7 @@ exports[`isDanger secondary 1`] = `
123
123
  </div>
124
124
  `;
125
125
 
126
- exports[`isDisabled 1`] = `
126
+ exports[`Button isDisabled 1`] = `
127
127
  <div>
128
128
  <button
129
129
  aria-disabled="true"
@@ -139,7 +139,7 @@ exports[`isDisabled 1`] = `
139
139
  </div>
140
140
  `;
141
141
 
142
- exports[`isInline 1`] = `
142
+ exports[`Button isInline 1`] = `
143
143
  <div>
144
144
  <button
145
145
  aria-disabled="false"
@@ -154,7 +154,7 @@ exports[`isInline 1`] = `
154
154
  </div>
155
155
  `;
156
156
 
157
- exports[`isLarge 1`] = `
157
+ exports[`Button isLarge 1`] = `
158
158
  <div>
159
159
  <button
160
160
  aria-disabled="false"
@@ -169,7 +169,7 @@ exports[`isLarge 1`] = `
169
169
  </div>
170
170
  `;
171
171
 
172
- exports[`isLoading 1`] = `
172
+ exports[`Button isLoading 1`] = `
173
173
  <div>
174
174
  <button
175
175
  aria-disabled="false"
@@ -204,7 +204,7 @@ exports[`isLoading 1`] = `
204
204
  </div>
205
205
  `;
206
206
 
207
- exports[`isLoading icon only 1`] = `
207
+ exports[`Button isLoading icon only 1`] = `
208
208
  <div>
209
209
  <button
210
210
  aria-disabled="false"
@@ -242,7 +242,7 @@ exports[`isLoading icon only 1`] = `
242
242
  </div>
243
243
  `;
244
244
 
245
- exports[`isSmall 1`] = `
245
+ exports[`Button isSmall 1`] = `
246
246
  <div>
247
247
  <button
248
248
  aria-disabled="false"
@@ -257,7 +257,7 @@ exports[`isSmall 1`] = `
257
257
  </div>
258
258
  `;
259
259
 
260
- exports[`link button 1`] = `
260
+ exports[`Button link button 1`] = `
261
261
  <div>
262
262
  <button
263
263
  aria-disabled="false"
@@ -274,7 +274,7 @@ exports[`link button 1`] = `
274
274
  </div>
275
275
  `;
276
276
 
277
- exports[`link with icon 1`] = `
277
+ exports[`Button link with icon 1`] = `
278
278
  <div>
279
279
  <button
280
280
  aria-disabled="false"
@@ -306,7 +306,7 @@ exports[`link with icon 1`] = `
306
306
  </div>
307
307
  `;
308
308
 
309
- exports[`plain button 1`] = `
309
+ exports[`Button plain button 1`] = `
310
310
  <div>
311
311
  <button
312
312
  aria-disabled="false"
@@ -323,7 +323,7 @@ exports[`plain button 1`] = `
323
323
  </div>
324
324
  `;
325
325
 
326
- exports[`primary button 1`] = `
326
+ exports[`Button primary button 1`] = `
327
327
  <div>
328
328
  <button
329
329
  aria-disabled="false"
@@ -340,7 +340,7 @@ exports[`primary button 1`] = `
340
340
  </div>
341
341
  `;
342
342
 
343
- exports[`secondary button 1`] = `
343
+ exports[`Button secondary button 1`] = `
344
344
  <div>
345
345
  <button
346
346
  aria-disabled="false"
@@ -357,7 +357,7 @@ exports[`secondary button 1`] = `
357
357
  </div>
358
358
  `;
359
359
 
360
- exports[`tertiary button 1`] = `
360
+ exports[`Button tertiary button 1`] = `
361
361
  <div>
362
362
  <button
363
363
  aria-disabled="false"
@@ -374,7 +374,7 @@ exports[`tertiary button 1`] = `
374
374
  </div>
375
375
  `;
376
376
 
377
- exports[`warning button 1`] = `
377
+ exports[`Button warning button 1`] = `
378
378
  <div>
379
379
  <button
380
380
  aria-disabled="false"