@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.
- package/CHANGELOG.md +27 -0
- package/dist/esm/components/MenuToggle/MenuToggle.d.ts +3 -0
- package/dist/esm/components/MenuToggle/MenuToggle.d.ts.map +1 -1
- package/dist/esm/components/MenuToggle/MenuToggle.js +3 -2
- package/dist/esm/components/MenuToggle/MenuToggle.js.map +1 -1
- package/dist/esm/components/MultipleFileUpload/MultipleFileUploadStatusItem.d.ts +4 -2
- package/dist/esm/components/MultipleFileUpload/MultipleFileUploadStatusItem.d.ts.map +1 -1
- package/dist/esm/components/MultipleFileUpload/MultipleFileUploadStatusItem.js +2 -2
- package/dist/esm/components/MultipleFileUpload/MultipleFileUploadStatusItem.js.map +1 -1
- package/dist/esm/components/Pagination/OptionsToggle.d.ts +10 -6
- package/dist/esm/components/Pagination/OptionsToggle.d.ts.map +1 -1
- package/dist/esm/components/Pagination/OptionsToggle.js +10 -4
- package/dist/esm/components/Pagination/OptionsToggle.js.map +1 -1
- package/dist/esm/components/Pagination/Pagination.d.ts +7 -3
- package/dist/esm/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/esm/components/Pagination/Pagination.js +5 -4
- package/dist/esm/components/Pagination/Pagination.js.map +1 -1
- package/dist/esm/components/Pagination/PaginationOptionsMenu.d.ts +12 -8
- package/dist/esm/components/Pagination/PaginationOptionsMenu.d.ts.map +1 -1
- package/dist/esm/components/Pagination/PaginationOptionsMenu.js +6 -5
- package/dist/esm/components/Pagination/PaginationOptionsMenu.js.map +1 -1
- package/dist/js/components/MenuToggle/MenuToggle.d.ts +3 -0
- package/dist/js/components/MenuToggle/MenuToggle.d.ts.map +1 -1
- package/dist/js/components/MenuToggle/MenuToggle.js +3 -2
- package/dist/js/components/MenuToggle/MenuToggle.js.map +1 -1
- package/dist/js/components/MultipleFileUpload/MultipleFileUploadStatusItem.d.ts +4 -2
- package/dist/js/components/MultipleFileUpload/MultipleFileUploadStatusItem.d.ts.map +1 -1
- package/dist/js/components/MultipleFileUpload/MultipleFileUploadStatusItem.js +2 -2
- package/dist/js/components/MultipleFileUpload/MultipleFileUploadStatusItem.js.map +1 -1
- package/dist/js/components/Pagination/OptionsToggle.d.ts +10 -6
- package/dist/js/components/Pagination/OptionsToggle.d.ts.map +1 -1
- package/dist/js/components/Pagination/OptionsToggle.js +10 -4
- package/dist/js/components/Pagination/OptionsToggle.js.map +1 -1
- package/dist/js/components/Pagination/Pagination.d.ts +7 -3
- package/dist/js/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/js/components/Pagination/Pagination.js +5 -4
- package/dist/js/components/Pagination/Pagination.js.map +1 -1
- package/dist/js/components/Pagination/PaginationOptionsMenu.d.ts +12 -8
- package/dist/js/components/Pagination/PaginationOptionsMenu.d.ts.map +1 -1
- package/dist/js/components/Pagination/PaginationOptionsMenu.js +6 -5
- package/dist/js/components/Pagination/PaginationOptionsMenu.js.map +1 -1
- package/dist/umd/react-core.css +16 -0
- package/dist/umd/react-core.js +27 -17
- package/dist/umd/react-core.min.css +16 -0
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +6 -6
- package/src/components/MenuToggle/MenuToggle.tsx +5 -0
- package/src/components/MenuToggle/examples/MenuToggle.md +16 -0
- package/src/components/MultipleFileUpload/MultipleFileUploadStatusItem.tsx +6 -2
- package/src/components/MultipleFileUpload/__tests__/MultipleFileUpload.test.tsx +8 -8
- package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadButton.test.tsx +7 -7
- package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadInfo.test.tsx +5 -5
- package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadMain.test.tsx +11 -11
- package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadStatus.test.tsx +11 -9
- package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadStatusItem.test.tsx +28 -13
- package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadTitle.test.tsx +11 -11
- package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadTitleIcon.test.tsx +5 -5
- package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadTitleText.test.tsx +5 -5
- package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadTitleTextSeparator.test.tsx +7 -5
- package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUpload.test.tsx.snap +42 -124
- package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadButton.test.tsx.snap +36 -86
- package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadInfo.test.tsx.snap +6 -8
- package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadMain.test.tsx.snap +85 -179
- package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadStatus.test.tsx.snap +188 -383
- package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadStatusItem.test.tsx.snap +596 -330
- package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadTitle.test.tsx.snap +32 -49
- package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadTitleIcon.test.tsx.snap +9 -11
- package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadTitleText.test.tsx.snap +6 -8
- package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadTitleTextSeparator.test.tsx.snap +6 -8
- package/src/components/Pagination/OptionsToggle.tsx +56 -46
- package/src/components/Pagination/Pagination.tsx +12 -5
- package/src/components/Pagination/PaginationOptionsMenu.tsx +20 -12
- package/src/components/Pagination/__tests__/Generated/__snapshots__/OptionsToggle.test.tsx.snap +1 -0
- package/src/components/Pagination/__tests__/Pagination.test.tsx +6 -4
- package/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap +223 -0
- package/src/components/Pagination/examples/Pagination.md +11 -1
- package/src/components/TimePicker/__tests__/TimePicker.test.tsx +1 -1
- package/src/components/Dropdown/__tests__/Generated/InternalDropdownItem.test.tsx +0 -42
- package/src/components/Dropdown/__tests__/Generated/__snapshots__/InternalDropdownItem.test.tsx.snap +0 -10
- package/src/components/Select/__tests__/Generated/SelectGroup.test.tsx +0 -25
- package/src/components/Select/__tests__/Generated/SelectMenu.test.tsx +0 -25
- package/src/components/Select/__tests__/Generated/__snapshots__/SelectGroup.test.tsx.snap +0 -18
- package/src/components/Select/__tests__/Generated/__snapshots__/SelectMenu.test.tsx.snap +0 -10
- package/src/components/Toolbar/__tests__/Generated/ToolbarToggleGroup.test.tsx +0 -27
- 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.
|
|
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.
|
|
38
|
-
"@patternfly/react-styles": "^4.
|
|
39
|
-
"@patternfly/react-tokens": "^4.
|
|
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.
|
|
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": "
|
|
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
|
|
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
|
|
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 {
|
|
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
|
|
8
|
-
expect(
|
|
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
|
|
13
|
-
expect(
|
|
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
|
|
18
|
-
expect(
|
|
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 {
|
|
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
|
|
8
|
-
expect(
|
|
7
|
+
const { asFragment } = render(<MultipleFileUploadButton>Foo</MultipleFileUploadButton>);
|
|
8
|
+
expect(asFragment()).toMatchSnapshot();
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
test('renders custom class names', () => {
|
|
12
|
-
const
|
|
13
|
-
expect(
|
|
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
|
|
18
|
-
expect(
|
|
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 {
|
|
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
|
|
8
|
-
expect(
|
|
7
|
+
const { asFragment } = render(<MultipleFileUploadInfo>Foo</MultipleFileUploadInfo>);
|
|
8
|
+
expect(asFragment()).toMatchSnapshot();
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
test('renders custom class names', () => {
|
|
12
|
-
const
|
|
13
|
-
expect(
|
|
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 {
|
|
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
|
|
8
|
-
expect(
|
|
7
|
+
const { asFragment } = render(<MultipleFileUploadMain />);
|
|
8
|
+
expect(asFragment()).toMatchSnapshot();
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
test('renders custom class names', () => {
|
|
12
|
-
const
|
|
13
|
-
expect(
|
|
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
|
|
17
|
+
const { asFragment } = render(
|
|
18
18
|
<MultipleFileUploadMain titleIcon="icon" titleText="title text" titleTextSeparator="title test separator" />
|
|
19
19
|
);
|
|
20
|
-
expect(
|
|
20
|
+
expect(asFragment()).toMatchSnapshot();
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
test('renders without the button when expected', () => {
|
|
24
|
-
const
|
|
25
|
-
expect(
|
|
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
|
|
30
|
-
expect(
|
|
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 {
|
|
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
|
|
9
|
-
expect(
|
|
8
|
+
const { asFragment } = render(<MultipleFileUploadStatus>Foo</MultipleFileUploadStatus>);
|
|
9
|
+
expect(asFragment()).toMatchSnapshot();
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
test('renders custom class names', () => {
|
|
13
|
-
const
|
|
14
|
-
expect(
|
|
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
|
|
19
|
-
expect(
|
|
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
|
|
24
|
-
|
|
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
|
-
|
|
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
|
|
9
|
-
expect(
|
|
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
|
|
14
|
-
expect(
|
|
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
|
|
20
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
39
|
-
|
|
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
|
|
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
|
-
|
|
66
|
+
|
|
67
|
+
expect(asFragment()).toMatchSnapshot();
|
|
53
68
|
});
|
|
54
69
|
});
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
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
|
|
8
|
-
expect(
|
|
7
|
+
const { asFragment } = render(<MultipleFileUploadTitle />);
|
|
8
|
+
expect(asFragment()).toMatchSnapshot();
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
test('renders custom class names', () => {
|
|
12
|
-
const
|
|
13
|
-
expect(
|
|
12
|
+
const { asFragment } = render(<MultipleFileUploadTitle className="test" />);
|
|
13
|
+
expect(asFragment()).toMatchSnapshot();
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
test('renders with title icon', () => {
|
|
17
|
-
const
|
|
18
|
-
expect(
|
|
17
|
+
const { asFragment } = render(<MultipleFileUploadTitle icon="icon" />);
|
|
18
|
+
expect(asFragment()).toMatchSnapshot();
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
test('renders with title text', () => {
|
|
22
|
-
const
|
|
23
|
-
expect(
|
|
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
|
|
28
|
-
expect(
|
|
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 {
|
|
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
|
|
8
|
-
expect(
|
|
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
|
|
13
|
-
expect(
|
|
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 {
|
|
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
|
|
8
|
-
expect(
|
|
7
|
+
const { asFragment } = render(<MultipleFileUploadTitleText>Foo</MultipleFileUploadTitleText>);
|
|
8
|
+
expect(asFragment()).toMatchSnapshot();
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
test('renders custom class names', () => {
|
|
12
|
-
const
|
|
13
|
-
expect(
|
|
12
|
+
const { asFragment } = render(<MultipleFileUploadTitleText className="test">Foo</MultipleFileUploadTitleText>);
|
|
13
|
+
expect(asFragment()).toMatchSnapshot();
|
|
14
14
|
});
|
|
15
15
|
});
|
package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadTitleTextSeparator.test.tsx
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
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
|
|
8
|
-
expect(
|
|
7
|
+
const { asFragment } = render(<MultipleFileUploadTitleTextSeparator>Foo</MultipleFileUploadTitleTextSeparator>);
|
|
8
|
+
expect(asFragment()).toMatchSnapshot();
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
test('renders custom class names', () => {
|
|
12
|
-
const
|
|
13
|
-
|
|
12
|
+
const { asFragment } = render(
|
|
13
|
+
<MultipleFileUploadTitleTextSeparator className="test">Foo</MultipleFileUploadTitleTextSeparator>
|
|
14
|
+
);
|
|
15
|
+
expect(asFragment()).toMatchSnapshot();
|
|
14
16
|
});
|
|
15
17
|
});
|