@patternfly/react-core 4.202.36 → 4.203.1

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 (85) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/esm/components/MenuToggle/MenuToggle.d.ts +3 -0
  3. package/dist/esm/components/MenuToggle/MenuToggle.d.ts.map +1 -1
  4. package/dist/esm/components/MenuToggle/MenuToggle.js +3 -2
  5. package/dist/esm/components/MenuToggle/MenuToggle.js.map +1 -1
  6. package/dist/esm/components/MultipleFileUpload/MultipleFileUploadStatusItem.d.ts +4 -2
  7. package/dist/esm/components/MultipleFileUpload/MultipleFileUploadStatusItem.d.ts.map +1 -1
  8. package/dist/esm/components/MultipleFileUpload/MultipleFileUploadStatusItem.js +2 -2
  9. package/dist/esm/components/MultipleFileUpload/MultipleFileUploadStatusItem.js.map +1 -1
  10. package/dist/esm/components/Pagination/OptionsToggle.d.ts +10 -6
  11. package/dist/esm/components/Pagination/OptionsToggle.d.ts.map +1 -1
  12. package/dist/esm/components/Pagination/OptionsToggle.js +10 -4
  13. package/dist/esm/components/Pagination/OptionsToggle.js.map +1 -1
  14. package/dist/esm/components/Pagination/Pagination.d.ts +7 -3
  15. package/dist/esm/components/Pagination/Pagination.d.ts.map +1 -1
  16. package/dist/esm/components/Pagination/Pagination.js +5 -4
  17. package/dist/esm/components/Pagination/Pagination.js.map +1 -1
  18. package/dist/esm/components/Pagination/PaginationOptionsMenu.d.ts +12 -8
  19. package/dist/esm/components/Pagination/PaginationOptionsMenu.d.ts.map +1 -1
  20. package/dist/esm/components/Pagination/PaginationOptionsMenu.js +6 -5
  21. package/dist/esm/components/Pagination/PaginationOptionsMenu.js.map +1 -1
  22. package/dist/js/components/MenuToggle/MenuToggle.d.ts +3 -0
  23. package/dist/js/components/MenuToggle/MenuToggle.d.ts.map +1 -1
  24. package/dist/js/components/MenuToggle/MenuToggle.js +3 -2
  25. package/dist/js/components/MenuToggle/MenuToggle.js.map +1 -1
  26. package/dist/js/components/MultipleFileUpload/MultipleFileUploadStatusItem.d.ts +4 -2
  27. package/dist/js/components/MultipleFileUpload/MultipleFileUploadStatusItem.d.ts.map +1 -1
  28. package/dist/js/components/MultipleFileUpload/MultipleFileUploadStatusItem.js +2 -2
  29. package/dist/js/components/MultipleFileUpload/MultipleFileUploadStatusItem.js.map +1 -1
  30. package/dist/js/components/Pagination/OptionsToggle.d.ts +10 -6
  31. package/dist/js/components/Pagination/OptionsToggle.d.ts.map +1 -1
  32. package/dist/js/components/Pagination/OptionsToggle.js +10 -4
  33. package/dist/js/components/Pagination/OptionsToggle.js.map +1 -1
  34. package/dist/js/components/Pagination/Pagination.d.ts +7 -3
  35. package/dist/js/components/Pagination/Pagination.d.ts.map +1 -1
  36. package/dist/js/components/Pagination/Pagination.js +5 -4
  37. package/dist/js/components/Pagination/Pagination.js.map +1 -1
  38. package/dist/js/components/Pagination/PaginationOptionsMenu.d.ts +12 -8
  39. package/dist/js/components/Pagination/PaginationOptionsMenu.d.ts.map +1 -1
  40. package/dist/js/components/Pagination/PaginationOptionsMenu.js +6 -5
  41. package/dist/js/components/Pagination/PaginationOptionsMenu.js.map +1 -1
  42. package/dist/umd/react-core.css +16 -0
  43. package/dist/umd/react-core.js +27 -17
  44. package/dist/umd/react-core.min.css +16 -0
  45. package/dist/umd/react-core.min.js +1 -1
  46. package/package.json +6 -6
  47. package/src/components/MenuToggle/MenuToggle.tsx +5 -0
  48. package/src/components/MenuToggle/examples/MenuToggle.md +16 -0
  49. package/src/components/MultipleFileUpload/MultipleFileUploadStatusItem.tsx +6 -2
  50. package/src/components/MultipleFileUpload/__tests__/MultipleFileUpload.test.tsx +8 -8
  51. package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadButton.test.tsx +7 -7
  52. package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadInfo.test.tsx +5 -5
  53. package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadMain.test.tsx +11 -11
  54. package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadStatus.test.tsx +11 -9
  55. package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadStatusItem.test.tsx +28 -13
  56. package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadTitle.test.tsx +11 -11
  57. package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadTitleIcon.test.tsx +5 -5
  58. package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadTitleText.test.tsx +5 -5
  59. package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadTitleTextSeparator.test.tsx +7 -5
  60. package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUpload.test.tsx.snap +42 -124
  61. package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadButton.test.tsx.snap +36 -86
  62. package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadInfo.test.tsx.snap +6 -8
  63. package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadMain.test.tsx.snap +85 -179
  64. package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadStatus.test.tsx.snap +188 -383
  65. package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadStatusItem.test.tsx.snap +596 -330
  66. package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadTitle.test.tsx.snap +32 -49
  67. package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadTitleIcon.test.tsx.snap +9 -11
  68. package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadTitleText.test.tsx.snap +6 -8
  69. package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadTitleTextSeparator.test.tsx.snap +6 -8
  70. package/src/components/Pagination/OptionsToggle.tsx +56 -46
  71. package/src/components/Pagination/Pagination.tsx +12 -5
  72. package/src/components/Pagination/PaginationOptionsMenu.tsx +20 -12
  73. package/src/components/Pagination/__tests__/Generated/__snapshots__/OptionsToggle.test.tsx.snap +1 -0
  74. package/src/components/Pagination/__tests__/Pagination.test.tsx +6 -4
  75. package/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap +223 -0
  76. package/src/components/Pagination/examples/Pagination.md +11 -1
  77. package/src/components/TimePicker/__tests__/TimePicker.test.tsx +1 -1
  78. package/src/components/Dropdown/__tests__/Generated/InternalDropdownItem.test.tsx +0 -42
  79. package/src/components/Dropdown/__tests__/Generated/__snapshots__/InternalDropdownItem.test.tsx.snap +0 -10
  80. package/src/components/Select/__tests__/Generated/SelectGroup.test.tsx +0 -25
  81. package/src/components/Select/__tests__/Generated/SelectMenu.test.tsx +0 -25
  82. package/src/components/Select/__tests__/Generated/__snapshots__/SelectGroup.test.tsx.snap +0 -18
  83. package/src/components/Select/__tests__/Generated/__snapshots__/SelectMenu.test.tsx.snap +0 -10
  84. package/src/components/Toolbar/__tests__/Generated/ToolbarToggleGroup.test.tsx +0 -27
  85. package/src/components/Toolbar/__tests__/Generated/__snapshots__/ToolbarToggleGroup.test.tsx.snap +0 -29
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.202.36",
3
+ "version": "4.203.1",
4
4
  "description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
5
5
  "main": "dist/js/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -34,16 +34,16 @@
34
34
  "generate": "node scripts/copyStyles.js"
35
35
  },
36
36
  "dependencies": {
37
- "@patternfly/react-icons": "^4.53.36",
38
- "@patternfly/react-styles": "^4.52.36",
39
- "@patternfly/react-tokens": "^4.54.36",
37
+ "@patternfly/react-icons": "^4.54.1",
38
+ "@patternfly/react-styles": "^4.53.1",
39
+ "@patternfly/react-tokens": "^4.55.1",
40
40
  "focus-trap": "6.2.2",
41
41
  "react-dropzone": "9.0.0",
42
42
  "tippy.js": "5.1.2",
43
43
  "tslib": "^2.0.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@patternfly/patternfly": "4.186.1",
46
+ "@patternfly/patternfly": "4.187.0",
47
47
  "@rollup/plugin-commonjs": "^21.0.0",
48
48
  "@rollup/plugin-node-resolve": "^13.0.0",
49
49
  "@rollup/plugin-replace": "^3.0.0",
@@ -60,5 +60,5 @@
60
60
  "react": "^16.8.0 || ^17.0.0",
61
61
  "react-dom": "^16.8.0 || ^17.0.0"
62
62
  },
63
- "gitHead": "f420c8cb16012a862440e821fb17102093bc57cd"
63
+ "gitHead": "2f16e9b81a8ab2c54d9ef945e50c1e4aa7510c49"
64
64
  }
@@ -16,6 +16,8 @@ export interface MenuToggleProps
16
16
  isDisabled?: boolean;
17
17
  /** Flag indicating the toggle is full height */
18
18
  isFullHeight?: boolean;
19
+ /** Flag indicating the toggle takes up the full width of its parent */
20
+ isFullWidth?: boolean;
19
21
  /** Variant styles of the menu toggle */
20
22
  variant?: 'default' | 'plain' | 'primary' | 'plainText' | 'secondary';
21
23
  /** Optional icon rendered inside the toggle, before the children content */
@@ -32,6 +34,7 @@ export class MenuToggleBase extends React.Component<MenuToggleProps> {
32
34
  className: '',
33
35
  isExpanded: false,
34
36
  isDisabled: false,
37
+ isFullWidth: false,
35
38
  isFullHeight: false,
36
39
  variant: 'default'
37
40
  };
@@ -45,6 +48,7 @@ export class MenuToggleBase extends React.Component<MenuToggleProps> {
45
48
  isExpanded,
46
49
  isDisabled,
47
50
  isFullHeight,
51
+ isFullWidth,
48
52
  variant,
49
53
  innerRef,
50
54
  ...props
@@ -75,6 +79,7 @@ export class MenuToggleBase extends React.Component<MenuToggleProps> {
75
79
  (isPlain || isPlainText) && styles.modifiers.plain,
76
80
  isPlainText && styles.modifiers.text,
77
81
  isFullHeight && styles.modifiers.fullHeight,
82
+ isFullWidth && styles.modifiers.fullWidth,
78
83
  className
79
84
  )}
80
85
  type="button"
@@ -177,3 +177,19 @@ import { MenuToggle } from '@patternfly/react-core';
177
177
  </MenuToggle>
178
178
  </div>
179
179
  ```
180
+
181
+ ### Full width
182
+
183
+ ```ts
184
+ import React from 'react';
185
+ import { MenuToggle } from '@patternfly/react-core';
186
+
187
+ const fullWidth: React.FunctionComponent = () => {
188
+ return (
189
+ <MenuToggle isFullWidth aria-label="Full width menu toggle" >
190
+ Full width
191
+ </MenuToggle>
192
+ );
193
+ }
194
+
195
+ ```
@@ -41,10 +41,12 @@ export interface MultipleFileUploadStatusItemProps extends React.HTMLProps<HTMLL
41
41
 
42
42
  // Props passed through to the progress component
43
43
 
44
- /** Adds accessible text to the ProgressBar. Required when title not used and there is not any label associated with the progress bar */
44
+ /** Adds accessible text to the progress bar. Required when title not used and there is not any label associated with the progress bar */
45
45
  progressAriaLabel?: string;
46
- /** Associates the ProgressBar with it's label for accessibility purposes. Required when title not used */
46
+ /** Associates the progress bar with it's label for accessibility purposes. Required when title not used */
47
47
  progressAriaLabelledBy?: string;
48
+ /** Unique identifier for progress. Generated if not specified. */
49
+ progressId?: string;
48
50
  }
49
51
 
50
52
  export const MultipleFileUploadStatusItem: React.FunctionComponent<MultipleFileUploadStatusItemProps> = ({
@@ -63,6 +65,7 @@ export const MultipleFileUploadStatusItem: React.FunctionComponent<MultipleFileU
63
65
  progressVariant,
64
66
  progressAriaLabel,
65
67
  progressAriaLabelledBy,
68
+ progressId,
66
69
  buttonAriaLabel = 'Remove from list',
67
70
  ...props
68
71
  }: MultipleFileUploadStatusItemProps) => {
@@ -137,6 +140,7 @@ export const MultipleFileUploadStatusItem: React.FunctionComponent<MultipleFileU
137
140
  variant={progressVariant || loadResult}
138
141
  aria-label={progressAriaLabel}
139
142
  aria-labelledby={progressAriaLabelledBy}
143
+ id={progressId}
140
144
  />
141
145
  </div>
142
146
  <div className={styles.multipleFileUploadStatusItemClose}>
@@ -1,20 +1,20 @@
1
1
  import React from 'react';
2
- import { mount } from 'enzyme';
2
+ import { render } from '@testing-library/react';
3
3
  import { MultipleFileUpload } from '../MultipleFileUpload';
4
4
 
5
5
  describe('MultipleFileUpload', () => {
6
6
  test('renders with expected class names when not horizontal', () => {
7
- const view = mount(<MultipleFileUpload>Foo</MultipleFileUpload>);
8
- expect(view).toMatchSnapshot();
7
+ const { asFragment } = render(<MultipleFileUpload>Foo</MultipleFileUpload>);
8
+ expect(asFragment()).toMatchSnapshot();
9
9
  });
10
10
 
11
11
  test('renders with expected class names when horizontal', () => {
12
- const view = mount(<MultipleFileUpload isHorizontal>Foo</MultipleFileUpload>);
13
- expect(view).toMatchSnapshot();
12
+ const { asFragment } = render(<MultipleFileUpload isHorizontal>Foo</MultipleFileUpload>);
13
+ expect(asFragment()).toMatchSnapshot();
14
14
  });
15
15
 
16
16
  test('renders custom class names', () => {
17
- const view = mount(<MultipleFileUpload className='test'>Foo</MultipleFileUpload>);
18
- expect(view).toMatchSnapshot();
17
+ const { asFragment } = render(<MultipleFileUpload className="test">Foo</MultipleFileUpload>);
18
+ expect(asFragment()).toMatchSnapshot();
19
19
  });
20
- })
20
+ });
@@ -1,20 +1,20 @@
1
1
  import React from 'react';
2
- import { mount } from 'enzyme';
2
+ import { render } from '@testing-library/react';
3
3
  import { MultipleFileUploadButton } from '../MultipleFileUploadButton';
4
4
 
5
5
  describe('MultipleFileUploadButton', () => {
6
6
  test('renders with expected class names', () => {
7
- const view = mount(<MultipleFileUploadButton>Foo</MultipleFileUploadButton>);
8
- expect(view).toMatchSnapshot();
7
+ const { asFragment } = render(<MultipleFileUploadButton>Foo</MultipleFileUploadButton>);
8
+ expect(asFragment()).toMatchSnapshot();
9
9
  });
10
10
 
11
11
  test('renders custom class names', () => {
12
- const view = mount(<MultipleFileUploadButton className="test">Foo</MultipleFileUploadButton>);
13
- expect(view).toMatchSnapshot();
12
+ const { asFragment } = render(<MultipleFileUploadButton className="test">Foo</MultipleFileUploadButton>);
13
+ expect(asFragment()).toMatchSnapshot();
14
14
  });
15
15
 
16
16
  test('renders with aria-label applied to the button', () => {
17
- const view = mount(<MultipleFileUploadButton aria-label="test">Foo</MultipleFileUploadButton>);
18
- expect(view).toMatchSnapshot();
17
+ const { asFragment } = render(<MultipleFileUploadButton aria-label="test">Foo</MultipleFileUploadButton>);
18
+ expect(asFragment()).toMatchSnapshot();
19
19
  });
20
20
  });
@@ -1,15 +1,15 @@
1
1
  import React from 'react';
2
- import { mount } from 'enzyme';
2
+ import { render } from '@testing-library/react';
3
3
  import { MultipleFileUploadInfo } from '../MultipleFileUploadInfo';
4
4
 
5
5
  describe('MultipleFileUploadInfo', () => {
6
6
  test('renders with expected class names', () => {
7
- const view = mount(<MultipleFileUploadInfo>Foo</MultipleFileUploadInfo>);
8
- expect(view).toMatchSnapshot();
7
+ const { asFragment } = render(<MultipleFileUploadInfo>Foo</MultipleFileUploadInfo>);
8
+ expect(asFragment()).toMatchSnapshot();
9
9
  });
10
10
 
11
11
  test('renders custom class names', () => {
12
- const view = mount(<MultipleFileUploadInfo className="test">Foo</MultipleFileUploadInfo>);
13
- expect(view).toMatchSnapshot();
12
+ const { asFragment } = render(<MultipleFileUploadInfo className="test">Foo</MultipleFileUploadInfo>);
13
+ expect(asFragment()).toMatchSnapshot();
14
14
  });
15
15
  });
@@ -1,32 +1,32 @@
1
1
  import React from 'react';
2
- import { mount } from 'enzyme';
2
+ import { render } from '@testing-library/react';
3
3
  import { MultipleFileUploadMain } from '../MultipleFileUploadMain';
4
4
 
5
5
  describe('MultipleFileUploadMain', () => {
6
6
  test('renders with expected class names', () => {
7
- const view = mount(<MultipleFileUploadMain />);
8
- expect(view).toMatchSnapshot();
7
+ const { asFragment } = render(<MultipleFileUploadMain />);
8
+ expect(asFragment()).toMatchSnapshot();
9
9
  });
10
10
 
11
11
  test('renders custom class names', () => {
12
- const view = mount(<MultipleFileUploadMain className="test" />);
13
- expect(view).toMatchSnapshot();
12
+ const { asFragment } = render(<MultipleFileUploadMain className="test" />);
13
+ expect(asFragment()).toMatchSnapshot();
14
14
  });
15
15
 
16
16
  test('passes props to the title as expected', () => {
17
- const view = mount(
17
+ const { asFragment } = render(
18
18
  <MultipleFileUploadMain titleIcon="icon" titleText="title text" titleTextSeparator="title test separator" />
19
19
  );
20
- expect(view).toMatchSnapshot();
20
+ expect(asFragment()).toMatchSnapshot();
21
21
  });
22
22
 
23
23
  test('renders without the button when expected', () => {
24
- const view = mount(<MultipleFileUploadMain isUploadButtonHidden />);
25
- expect(view).toMatchSnapshot();
24
+ const { asFragment } = render(<MultipleFileUploadMain isUploadButtonHidden />);
25
+ expect(asFragment()).toMatchSnapshot();
26
26
  });
27
27
 
28
28
  test('passes props to the info component as expected', () => {
29
- const view = mount(<MultipleFileUploadMain infoText="info text" />);
30
- expect(view).toMatchSnapshot();
29
+ const { asFragment } = render(<MultipleFileUploadMain infoText="info text" />);
30
+ expect(asFragment()).toMatchSnapshot();
31
31
  });
32
32
  });
@@ -1,26 +1,28 @@
1
1
  import React from 'react';
2
- import { mount } from 'enzyme';
2
+ import { render, screen } from '@testing-library/react';
3
3
  import { MultipleFileUploadStatus } from '../MultipleFileUploadStatus';
4
4
  import InProgressIcon from '@patternfly/react-icons/dist/esm/icons/in-progress-icon';
5
5
 
6
6
  describe('MultipleFileUploadStatus', () => {
7
7
  test('renders with expected class names', () => {
8
- const view = mount(<MultipleFileUploadStatus>Foo</MultipleFileUploadStatus>);
9
- expect(view).toMatchSnapshot();
8
+ const { asFragment } = render(<MultipleFileUploadStatus>Foo</MultipleFileUploadStatus>);
9
+ expect(asFragment()).toMatchSnapshot();
10
10
  });
11
11
 
12
12
  test('renders custom class names', () => {
13
- const view = mount(<MultipleFileUploadStatus className="test">Foo</MultipleFileUploadStatus>);
14
- expect(view).toMatchSnapshot();
13
+ const { asFragment } = render(<MultipleFileUploadStatus className="test">Foo</MultipleFileUploadStatus>);
14
+ expect(asFragment()).toMatchSnapshot();
15
15
  });
16
16
 
17
17
  test('renders status toggle text', () => {
18
- const view = mount(<MultipleFileUploadStatus statusToggleText='test'>Foo</MultipleFileUploadStatus>);
19
- expect(view).toMatchSnapshot();
18
+ const { asFragment } = render(<MultipleFileUploadStatus statusToggleText="test">Foo</MultipleFileUploadStatus>);
19
+ expect(asFragment()).toMatchSnapshot();
20
20
  });
21
21
 
22
22
  test('renders status toggle icon', () => {
23
- const view = mount(<MultipleFileUploadStatus statusToggleIcon={<InProgressIcon />}>Foo</MultipleFileUploadStatus>);
24
- expect(view).toMatchSnapshot();
23
+ const { asFragment } = render(
24
+ <MultipleFileUploadStatus statusToggleIcon={<InProgressIcon />}>Foo</MultipleFileUploadStatus>
25
+ );
26
+ expect(asFragment()).toMatchSnapshot();
25
27
  });
26
28
  });
@@ -1,54 +1,69 @@
1
1
  import React from 'react';
2
- import { shallow } from 'enzyme';
2
+
3
+ import { render, screen } from '@testing-library/react';
4
+
3
5
  import { MultipleFileUploadStatusItem } from '../MultipleFileUploadStatusItem';
4
6
  import FileImageIcon from '@patternfly/react-icons/dist/esm/icons/file-image-icon';
5
7
 
6
8
  describe('MultipleFileUploadStatusItem', () => {
7
9
  test('renders with expected class names', () => {
8
- const view = shallow(<MultipleFileUploadStatusItem />);
9
- expect(view).toMatchSnapshot();
10
+ const { asFragment } = render(<MultipleFileUploadStatusItem progressId="test-progress-id" />);
11
+ expect(asFragment()).toMatchSnapshot();
10
12
  });
11
13
 
12
14
  test('renders custom class names', () => {
13
- const view = shallow(<MultipleFileUploadStatusItem className="test" />);
14
- expect(view).toMatchSnapshot();
15
+ const { asFragment } = render(<MultipleFileUploadStatusItem className="test" progressId="test-progress-id" />);
16
+ expect(asFragment()).toMatchSnapshot();
15
17
  });
16
18
 
17
19
  test('renders expected values from a passed file object', () => {
18
20
  const testFile = new File(['foo'], 'testFile.txt');
19
- const view = shallow(<MultipleFileUploadStatusItem file={testFile} />);
20
- expect(view).toMatchSnapshot();
21
+ const { asFragment } = render(<MultipleFileUploadStatusItem file={testFile} progressId="test-progress-id" />);
22
+
23
+ expect(asFragment()).toMatchSnapshot();
21
24
  });
22
25
 
23
26
  test('renders custom file name/size/icon when passed', () => {
24
27
  const testFile = new File(['foo'], 'testFile.txt');
25
- const view = shallow(
28
+ const { asFragment } = render(
26
29
  <MultipleFileUploadStatusItem
27
30
  file={testFile}
28
31
  fileIcon={<FileImageIcon />}
29
32
  fileName="testCustomFileName.txt"
30
33
  fileSize={42}
34
+ progressId="test-progress-id"
31
35
  />
32
36
  );
33
- expect(view).toMatchSnapshot();
37
+
38
+ expect(asFragment()).toMatchSnapshot();
34
39
  });
35
40
 
36
41
  test('renders custom progress value/variant when passed', () => {
37
42
  const testFile = new File(['foo'], 'testFile.txt');
38
- const view = shallow(<MultipleFileUploadStatusItem file={testFile} progressValue={42} progressVariant="warning" />);
39
- expect(view).toMatchSnapshot();
43
+ const { asFragment } = render(
44
+ <MultipleFileUploadStatusItem
45
+ file={testFile}
46
+ progressValue={42}
47
+ progressVariant="warning"
48
+ progressId="test-progress-id"
49
+ />
50
+ );
51
+
52
+ expect(asFragment()).toMatchSnapshot();
40
53
  });
41
54
 
42
55
  test('renders custom aria labels', () => {
43
56
  const testFile = new File(['foo'], 'testFile.txt');
44
- const view = shallow(
57
+ const { asFragment } = render(
45
58
  <MultipleFileUploadStatusItem
46
59
  file={testFile}
47
60
  buttonAriaLabel="buttonAriaLabel"
48
61
  progressAriaLabel="progressAriaLabel"
49
62
  progressAriaLabelledBy="progressAriaLabelledBy"
63
+ progressId="test-progress-id"
50
64
  />
51
65
  );
52
- expect(view).toMatchSnapshot();
66
+
67
+ expect(asFragment()).toMatchSnapshot();
53
68
  });
54
69
  });
@@ -1,30 +1,30 @@
1
1
  import React from 'react';
2
- import { mount } from 'enzyme';
2
+ import { render, screen } from '@testing-library/react';
3
3
  import { MultipleFileUploadTitle } from '../MultipleFileUploadTitle';
4
4
 
5
5
  describe('MultipleFileUploadTitle', () => {
6
6
  test('renders with expected class names', () => {
7
- const view = mount(<MultipleFileUploadTitle />);
8
- expect(view).toMatchSnapshot();
7
+ const { asFragment } = render(<MultipleFileUploadTitle />);
8
+ expect(asFragment()).toMatchSnapshot();
9
9
  });
10
10
 
11
11
  test('renders custom class names', () => {
12
- const view = mount(<MultipleFileUploadTitle className="test" />);
13
- expect(view).toMatchSnapshot();
12
+ const { asFragment } = render(<MultipleFileUploadTitle className="test" />);
13
+ expect(asFragment()).toMatchSnapshot();
14
14
  });
15
15
 
16
16
  test('renders with title icon', () => {
17
- const view = mount(<MultipleFileUploadTitle icon="icon" />);
18
- expect(view).toMatchSnapshot();
17
+ const { asFragment } = render(<MultipleFileUploadTitle icon="icon" />);
18
+ expect(asFragment()).toMatchSnapshot();
19
19
  });
20
20
 
21
21
  test('renders with title text', () => {
22
- const view = mount(<MultipleFileUploadTitle text="text" />);
23
- expect(view).toMatchSnapshot();
22
+ const { asFragment } = render(<MultipleFileUploadTitle text="text" />);
23
+ expect(asFragment()).toMatchSnapshot();
24
24
  });
25
25
 
26
26
  test('renders with title text separator', () => {
27
- const view = mount(<MultipleFileUploadTitle text="text" textSeparator="text separator" />);
28
- expect(view).toMatchSnapshot();
27
+ const { asFragment } = render(<MultipleFileUploadTitle text="text" textSeparator="text separator" />);
28
+ expect(asFragment()).toMatchSnapshot();
29
29
  });
30
30
  });
@@ -1,15 +1,15 @@
1
1
  import React from 'react';
2
- import { mount } from 'enzyme';
2
+ import { render, screen } from '@testing-library/react';
3
3
  import { MultipleFileUploadTitleIcon } from '../MultipleFileUploadTitleIcon';
4
4
 
5
5
  describe('MultipleFileUploadTitleIcon', () => {
6
6
  test('renders with expected class names', () => {
7
- const view = mount(<MultipleFileUploadTitleIcon>Foo</MultipleFileUploadTitleIcon>);
8
- expect(view).toMatchSnapshot();
7
+ const { asFragment } = render(<MultipleFileUploadTitleIcon data-testid="test-id" />);
8
+ expect(asFragment()).toMatchSnapshot();
9
9
  });
10
10
 
11
11
  test('renders custom class names', () => {
12
- const view = mount(<MultipleFileUploadTitleIcon className="test" />);
13
- expect(view).toMatchSnapshot();
12
+ const { asFragment } = render(<MultipleFileUploadTitleIcon className="test" data-testid="test-id" />);
13
+ expect(asFragment()).toMatchSnapshot();
14
14
  });
15
15
  });
@@ -1,15 +1,15 @@
1
1
  import React from 'react';
2
- import { mount } from 'enzyme';
2
+ import { render, screen } from '@testing-library/react';
3
3
  import { MultipleFileUploadTitleText } from '../MultipleFileUploadTitleText';
4
4
 
5
5
  describe('MultipleFileUploadTitleText', () => {
6
6
  test('renders with expected class names', () => {
7
- const view = mount(<MultipleFileUploadTitleText>Foo</MultipleFileUploadTitleText>);
8
- expect(view).toMatchSnapshot();
7
+ const { asFragment } = render(<MultipleFileUploadTitleText>Foo</MultipleFileUploadTitleText>);
8
+ expect(asFragment()).toMatchSnapshot();
9
9
  });
10
10
 
11
11
  test('renders custom class names', () => {
12
- const view = mount(<MultipleFileUploadTitleText className="test">Foo</MultipleFileUploadTitleText>);
13
- expect(view).toMatchSnapshot();
12
+ const { asFragment } = render(<MultipleFileUploadTitleText className="test">Foo</MultipleFileUploadTitleText>);
13
+ expect(asFragment()).toMatchSnapshot();
14
14
  });
15
15
  });
@@ -1,15 +1,17 @@
1
1
  import React from 'react';
2
- import { mount } from 'enzyme';
2
+ import { render, screen } from '@testing-library/react';
3
3
  import { MultipleFileUploadTitleTextSeparator } from '../MultipleFileUploadTitleTextSeparator';
4
4
 
5
5
  describe('MultipleFileUploadTitleTextSeparator', () => {
6
6
  test('renders with expected class names', () => {
7
- const view = mount(<MultipleFileUploadTitleTextSeparator>Foo</MultipleFileUploadTitleTextSeparator>);
8
- expect(view).toMatchSnapshot();
7
+ const { asFragment } = render(<MultipleFileUploadTitleTextSeparator>Foo</MultipleFileUploadTitleTextSeparator>);
8
+ expect(asFragment()).toMatchSnapshot();
9
9
  });
10
10
 
11
11
  test('renders custom class names', () => {
12
- const view = mount(<MultipleFileUploadTitleTextSeparator className="test">Foo</MultipleFileUploadTitleTextSeparator>);
13
- expect(view).toMatchSnapshot();
12
+ const { asFragment } = render(
13
+ <MultipleFileUploadTitleTextSeparator className="test">Foo</MultipleFileUploadTitleTextSeparator>
14
+ );
15
+ expect(asFragment()).toMatchSnapshot();
14
16
  });
15
17
  });