@patternfly/react-core 5.2.0-prerelease.18 → 5.2.0-prerelease.19
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 +4 -0
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/AboutModal/package.json +1 -1
- package/dist/dynamic/components/Accordion/package.json +1 -1
- package/dist/dynamic/components/ActionList/package.json +1 -1
- package/dist/dynamic/components/Alert/package.json +1 -1
- package/dist/dynamic/components/Avatar/package.json +1 -1
- package/dist/dynamic/components/BackToTop/package.json +1 -1
- package/dist/dynamic/components/Backdrop/package.json +1 -1
- package/dist/dynamic/components/BackgroundImage/package.json +1 -1
- package/dist/dynamic/components/Badge/package.json +1 -1
- package/dist/dynamic/components/Banner/package.json +1 -1
- package/dist/dynamic/components/Brand/package.json +1 -1
- package/dist/dynamic/components/Breadcrumb/package.json +1 -1
- package/dist/dynamic/components/Button/package.json +1 -1
- package/dist/dynamic/components/CalendarMonth/package.json +1 -1
- package/dist/dynamic/components/Card/package.json +1 -1
- package/dist/dynamic/components/Checkbox/package.json +1 -1
- package/dist/dynamic/components/Chip/package.json +1 -1
- package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
- package/dist/dynamic/components/CodeBlock/package.json +1 -1
- package/dist/dynamic/components/DataList/package.json +1 -1
- package/dist/dynamic/components/DatePicker/package.json +1 -1
- package/dist/dynamic/components/DescriptionList/package.json +1 -1
- package/dist/dynamic/components/Divider/package.json +1 -1
- package/dist/dynamic/components/DragDrop/package.json +1 -1
- package/dist/dynamic/components/Drawer/package.json +1 -1
- package/dist/dynamic/components/Dropdown/package.json +1 -1
- package/dist/dynamic/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/components/EmptyState/package.json +1 -1
- package/dist/dynamic/components/ExpandableSection/package.json +1 -1
- package/dist/dynamic/components/FileUpload/package.json +1 -1
- package/dist/dynamic/components/Form/package.json +1 -1
- package/dist/dynamic/components/FormSelect/package.json +1 -1
- package/dist/dynamic/components/HelperText/package.json +1 -1
- package/dist/dynamic/components/Hint/package.json +1 -1
- package/dist/dynamic/components/Icon/package.json +1 -1
- package/dist/dynamic/components/InputGroup/package.json +1 -1
- package/dist/dynamic/components/JumpLinks/package.json +1 -1
- package/dist/dynamic/components/Label/package.json +1 -1
- package/dist/dynamic/components/List/package.json +1 -1
- package/dist/dynamic/components/LoginPage/package.json +1 -1
- package/dist/dynamic/components/Masthead/package.json +1 -1
- package/dist/dynamic/components/Menu/package.json +1 -1
- package/dist/dynamic/components/MenuToggle/package.json +1 -1
- package/dist/dynamic/components/Modal/package.json +1 -1
- package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
- package/dist/dynamic/components/Nav/package.json +1 -1
- package/dist/dynamic/components/NotificationBadge/package.json +1 -1
- package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
- package/dist/dynamic/components/NumberInput/package.json +1 -1
- package/dist/dynamic/components/OverflowMenu/package.json +1 -1
- package/dist/dynamic/components/Page/package.json +1 -1
- package/dist/dynamic/components/Pagination/package.json +1 -1
- package/dist/dynamic/components/Panel/package.json +1 -1
- package/dist/dynamic/components/Popover/package.json +1 -1
- package/dist/dynamic/components/Progress/package.json +1 -1
- package/dist/dynamic/components/ProgressStepper/package.json +1 -1
- package/dist/dynamic/components/Radio/package.json +1 -1
- package/dist/dynamic/components/SearchInput/package.json +1 -1
- package/dist/dynamic/components/Select/package.json +1 -1
- package/dist/dynamic/components/Sidebar/package.json +1 -1
- package/dist/dynamic/components/SimpleList/package.json +1 -1
- package/dist/dynamic/components/Skeleton/package.json +1 -1
- package/dist/dynamic/components/SkipToContent/package.json +1 -1
- package/dist/dynamic/components/Slider/package.json +1 -1
- package/dist/dynamic/components/Spinner/package.json +1 -1
- package/dist/dynamic/components/Switch/package.json +1 -1
- package/dist/dynamic/components/Tabs/package.json +1 -1
- package/dist/dynamic/components/Text/package.json +1 -1
- package/dist/dynamic/components/TextArea/package.json +1 -1
- package/dist/dynamic/components/TextInput/package.json +1 -1
- package/dist/dynamic/components/TextInputGroup/package.json +1 -1
- package/dist/dynamic/components/Tile/package.json +1 -1
- package/dist/dynamic/components/TimePicker/package.json +1 -1
- package/dist/dynamic/components/Timestamp/package.json +1 -1
- package/dist/dynamic/components/Title/package.json +1 -1
- package/dist/dynamic/components/ToggleGroup/package.json +1 -1
- package/dist/dynamic/components/Toolbar/package.json +1 -1
- package/dist/dynamic/components/Tooltip/package.json +1 -1
- package/dist/dynamic/components/TreeView/package.json +1 -1
- package/dist/dynamic/components/Truncate/package.json +1 -1
- package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
- package/dist/dynamic/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/ApplicationLauncher/package.json +1 -1
- package/dist/dynamic/deprecated/components/ContextSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Dropdown/package.json +1 -1
- package/dist/dynamic/deprecated/components/OptionsMenu/package.json +1 -1
- package/dist/dynamic/deprecated/components/PageHeader/package.json +1 -1
- package/dist/dynamic/deprecated/components/Select/package.json +1 -1
- package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/package.json +1 -1
- package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
- package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
- package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
- package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
- package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
- package/dist/dynamic/helpers/constants/package.json +1 -1
- package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
- package/dist/dynamic/helpers/favorites/package.json +1 -1
- package/dist/dynamic/helpers/fileUtils/package.json +1 -1
- package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
- package/dist/dynamic/helpers/package.json +1 -1
- package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
- package/dist/dynamic/helpers/typeUtils/package.json +1 -1
- package/dist/dynamic/helpers/useInterval/package.json +1 -1
- package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
- package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
- package/dist/dynamic/helpers/util/package.json +1 -1
- package/dist/dynamic/layouts/Bullseye/package.json +1 -1
- package/dist/dynamic/layouts/Flex/package.json +1 -1
- package/dist/dynamic/layouts/Gallery/package.json +1 -1
- package/dist/dynamic/layouts/Grid/package.json +1 -1
- package/dist/dynamic/layouts/Level/package.json +1 -1
- package/dist/dynamic/layouts/Split/package.json +1 -1
- package/dist/dynamic/layouts/Stack/package.json +1 -1
- package/dist/dynamic/next/components/package.json +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopyButton.d.ts.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopyButton.js +2 -2
- package/dist/esm/components/ClipboardCopy/ClipboardCopyButton.js.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopyToggle.js +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopyToggle.js.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopyButton.d.ts.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopyButton.js +2 -2
- package/dist/js/components/ClipboardCopy/ClipboardCopyButton.js.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopyToggle.js +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopyToggle.js.map +1 -1
- package/dist/umd/react-core.min.js +1 -1
- package/helpers/package.json +1 -1
- package/layouts/package.json +1 -1
- package/next/package.json +1 -1
- package/package.json +2 -2
- package/src/components/ClipboardCopy/ClipboardCopy.tsx +1 -1
- package/src/components/ClipboardCopy/ClipboardCopyButton.tsx +2 -0
- package/src/components/ClipboardCopy/ClipboardCopyToggle.tsx +1 -1
- package/src/components/ClipboardCopy/__tests__/ClipboardCopy.test.tsx +344 -0
- package/src/components/ClipboardCopy/__tests__/ClipboardCopyAction.test.tsx +37 -0
- package/src/components/ClipboardCopy/__tests__/ClipboardCopyButton.test.tsx +136 -19
- package/src/components/ClipboardCopy/__tests__/ClipboardCopyExpanded.test.tsx +71 -14
- package/src/components/ClipboardCopy/__tests__/ClipboardCopyToggle.test.tsx +78 -34
- package/src/components/ClipboardCopy/__tests__/__snapshots__/ClipboardCopy.test.tsx.snap +57 -0
- package/src/components/ClipboardCopy/__tests__/__snapshots__/ClipboardCopyAction.test.tsx.snap +11 -0
- package/src/components/ClipboardCopy/__tests__/__snapshots__/ClipboardCopyButton.test.tsx.snap +50 -24
- package/src/components/ClipboardCopy/__tests__/__snapshots__/ClipboardCopyExpanded.test.tsx.snap +3 -23
- package/src/components/ClipboardCopy/__tests__/__snapshots__/ClipboardCopyToggle.test.tsx.snap +5 -6
- package/src/components/ClipboardCopy/__tests__/Generated/ClipboardCopy.test.tsx +0 -40
- package/src/components/ClipboardCopy/__tests__/Generated/__snapshots__/ClipboardCopy.test.tsx.snap +0 -55
|
@@ -1,23 +1,80 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { screen, render } from '@testing-library/react';
|
|
3
3
|
import { ClipboardCopyExpanded } from '../ClipboardCopyExpanded';
|
|
4
|
+
import styles from '@patternfly/react-styles/css/components/ClipboardCopy/clipboard-copy';
|
|
5
|
+
import userEvent from '@testing-library/user-event';
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
id: 'id-1'
|
|
8
|
-
};
|
|
7
|
+
test(`Renders with classname ${styles.clipboardCopyExpandableContent} by default`, () => {
|
|
8
|
+
render(<ClipboardCopyExpanded>Expanded content</ClipboardCopyExpanded>);
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
expect(screen.getByText('Expanded content')).toHaveClass(styles.clipboardCopyExpandableContent, { exact: true });
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test(`Renders with custom class when className is passed`, () => {
|
|
14
|
+
render(<ClipboardCopyExpanded className="test-class">Expanded content</ClipboardCopyExpanded>);
|
|
15
|
+
|
|
16
|
+
expect(screen.getByText('Expanded content')).toHaveClass('test-class');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('Does not render with <pre> tag by default', () => {
|
|
20
|
+
render(<ClipboardCopyExpanded>Expanded content</ClipboardCopyExpanded>);
|
|
21
|
+
|
|
22
|
+
expect(screen.getByText('Expanded content').tagName).not.toBe('PRE');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('Renders with <pre> tag when isCode is true', () => {
|
|
26
|
+
render(<ClipboardCopyExpanded isCode>Expanded content</ClipboardCopyExpanded>);
|
|
27
|
+
|
|
28
|
+
expect(screen.getByText('Expanded content').tagName).toBe('PRE');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('Renders with contenteditable attribute of true by default', () => {
|
|
32
|
+
render(<ClipboardCopyExpanded>Expanded content</ClipboardCopyExpanded>);
|
|
33
|
+
|
|
34
|
+
expect(screen.getByText('Expanded content')).toHaveAttribute('contenteditable', 'true');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('Renders with contenteditable attribute of false when isReadOnly is passed', () => {
|
|
38
|
+
render(<ClipboardCopyExpanded isReadOnly>Expanded content</ClipboardCopyExpanded>);
|
|
39
|
+
|
|
40
|
+
expect(screen.getByText('Expanded content')).toHaveAttribute('contenteditable', 'false');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('Calls onChange when expanded content is typed in', async () => {
|
|
44
|
+
const user = userEvent.setup();
|
|
45
|
+
const onChangeMock = jest.fn();
|
|
46
|
+
|
|
47
|
+
render(<ClipboardCopyExpanded onChange={onChangeMock}>Expanded content</ClipboardCopyExpanded>);
|
|
48
|
+
|
|
49
|
+
await user.type(screen.getByText('Expanded content'), 's');
|
|
50
|
+
|
|
51
|
+
expect(onChangeMock).toHaveBeenCalledTimes(1);
|
|
13
52
|
});
|
|
14
53
|
|
|
15
|
-
test('expanded
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
54
|
+
test('Does not call onChange when expanded content is not typed in', async () => {
|
|
55
|
+
const user = userEvent.setup();
|
|
56
|
+
const onChangeMock = jest.fn();
|
|
57
|
+
|
|
58
|
+
render(
|
|
59
|
+
<>
|
|
60
|
+
<ClipboardCopyExpanded onChange={onChangeMock}>Expanded content</ClipboardCopyExpanded>
|
|
61
|
+
<input />
|
|
62
|
+
</>
|
|
21
63
|
);
|
|
64
|
+
|
|
65
|
+
await user.type(screen.getByRole('textbox'), 'A');
|
|
66
|
+
|
|
67
|
+
expect(onChangeMock).not.toHaveBeenCalled();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('Spreads additional props to container', () => {
|
|
71
|
+
render(<ClipboardCopyExpanded data-prop="test">Expanded content</ClipboardCopyExpanded>);
|
|
72
|
+
|
|
73
|
+
expect(screen.getByText('Expanded content')).toHaveAttribute('data-prop', 'test');
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('Matches snapshot', () => {
|
|
77
|
+
const { asFragment } = render(<ClipboardCopyExpanded>Expanded content</ClipboardCopyExpanded>);
|
|
78
|
+
|
|
22
79
|
expect(asFragment()).toMatchSnapshot();
|
|
23
80
|
});
|
|
@@ -1,48 +1,92 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
2
|
+
import { screen, render } from '@testing-library/react';
|
|
3
|
+
import { ClipboardCopyToggle } from '../ClipboardCopyToggle';
|
|
4
|
+
import styles from '@patternfly/react-styles/css/components/ClipboardCopy/clipboard-copy';
|
|
4
5
|
import userEvent from '@testing-library/user-event';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
isExpanded: false,
|
|
13
|
-
className: 'myclassName',
|
|
14
|
-
onClick: jest.fn()
|
|
7
|
+
const onClickMock = jest.fn();
|
|
8
|
+
const requiredProps = {
|
|
9
|
+
id: 'main-id',
|
|
10
|
+
textId: 'text-id',
|
|
11
|
+
contentId: 'content-id',
|
|
12
|
+
onClick: onClickMock
|
|
15
13
|
};
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
// Must be kept as first test to avoid Button's ouiaId updating in snapshots
|
|
16
|
+
test('Matches snapshot', () => {
|
|
17
|
+
const { asFragment } = render(<ClipboardCopyToggle {...requiredProps} />);
|
|
18
|
+
|
|
19
|
+
expect(asFragment()).toMatchSnapshot();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('Renders without children', () => {
|
|
23
|
+
render(
|
|
24
|
+
<div data-testid="container">
|
|
25
|
+
<ClipboardCopyToggle {...requiredProps} />
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
expect(screen.getByTestId('container').firstChild).toBeVisible();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('Renders with id prop', () => {
|
|
33
|
+
render(<ClipboardCopyToggle {...requiredProps} />);
|
|
34
|
+
|
|
35
|
+
expect(screen.getByRole('button')).toHaveAttribute('id', requiredProps.id);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('Renders with aria-labelledby concatenated from id and textId props', () => {
|
|
39
|
+
render(
|
|
40
|
+
<>
|
|
41
|
+
<ClipboardCopyToggle aria-label="Toggle content" {...requiredProps} />
|
|
42
|
+
<span id={requiredProps.textId}>Test content</span>
|
|
43
|
+
</>
|
|
44
|
+
);
|
|
21
45
|
|
|
22
|
-
|
|
23
|
-
|
|
46
|
+
expect(screen.getByRole('button')).toHaveAccessibleName('Toggle content Test content');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('Renders with aria-controls with passed in contentId prop', () => {
|
|
50
|
+
render(<ClipboardCopyToggle {...requiredProps} />);
|
|
51
|
+
|
|
52
|
+
expect(screen.getByRole('button')).toHaveAttribute('aria-controls', requiredProps.contentId);
|
|
53
|
+
});
|
|
24
54
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const user = userEvent.setup();
|
|
55
|
+
test('Renders with aria-expanded of false by default', () => {
|
|
56
|
+
render(<ClipboardCopyToggle {...requiredProps} />);
|
|
28
57
|
|
|
29
|
-
|
|
58
|
+
expect(screen.getByRole('button')).toHaveAttribute('aria-expanded', 'false');
|
|
59
|
+
});
|
|
30
60
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
61
|
+
test('Renders with aria-expanded based on isExpanded prop', () => {
|
|
62
|
+
render(<ClipboardCopyToggle isExpanded={true} {...requiredProps} />);
|
|
34
63
|
|
|
35
|
-
|
|
36
|
-
|
|
64
|
+
expect(screen.getByRole('button')).toHaveAttribute('aria-expanded', 'true');
|
|
65
|
+
});
|
|
37
66
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
67
|
+
test('Calls onClick when clipboard toggle is clicked', async () => {
|
|
68
|
+
const user = userEvent.setup();
|
|
69
|
+
render(<ClipboardCopyToggle {...requiredProps} />);
|
|
70
|
+
|
|
71
|
+
await user.click(screen.getByRole('button'));
|
|
72
|
+
expect(onClickMock).toHaveBeenCalledTimes(1);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('Does not call onClick when clipboard toggle is not clicked', async () => {
|
|
76
|
+
const user = userEvent.setup();
|
|
77
|
+
render(
|
|
78
|
+
<>
|
|
79
|
+
<ClipboardCopyToggle {...requiredProps} />
|
|
80
|
+
<button>Test clicker</button>
|
|
81
|
+
</>
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
await user.click(screen.getByRole('button', { name: 'Test clicker' }));
|
|
85
|
+
expect(onClickMock).not.toHaveBeenCalled();
|
|
86
|
+
});
|
|
41
87
|
|
|
42
|
-
|
|
43
|
-
|
|
88
|
+
test('Spreads additional props to container', () => {
|
|
89
|
+
render(<ClipboardCopyToggle data-prop="test" {...requiredProps} />);
|
|
44
90
|
|
|
45
|
-
|
|
46
|
-
expect(toggleButton).toHaveAttribute('aria-expanded', 'false');
|
|
47
|
-
});
|
|
91
|
+
expect(screen.getByRole('button')).toHaveAttribute('data-prop', 'test');
|
|
48
92
|
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Matches snapshot 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<div
|
|
6
|
+
class="pf-v5-c-clipboard-copy"
|
|
7
|
+
data-ouia-component-id="snapshot"
|
|
8
|
+
data-ouia-component-type="PF5/ClipboardCopy"
|
|
9
|
+
data-ouia-safe="true"
|
|
10
|
+
id="snapshot"
|
|
11
|
+
>
|
|
12
|
+
<div
|
|
13
|
+
class="pf-v5-c-clipboard-copy__group"
|
|
14
|
+
>
|
|
15
|
+
<span
|
|
16
|
+
class="pf-v5-c-form-control"
|
|
17
|
+
>
|
|
18
|
+
<input
|
|
19
|
+
aria-invalid="false"
|
|
20
|
+
aria-label="Copyable input"
|
|
21
|
+
data-ouia-component-id="OUIA-Generated-TextInputBase-26"
|
|
22
|
+
data-ouia-component-type="PF5/TextInput"
|
|
23
|
+
data-ouia-safe="true"
|
|
24
|
+
id="text-input-34"
|
|
25
|
+
type="text"
|
|
26
|
+
value="Copyable text"
|
|
27
|
+
/>
|
|
28
|
+
</span>
|
|
29
|
+
<div
|
|
30
|
+
data-testid="clipboardCopyButton-mock"
|
|
31
|
+
>
|
|
32
|
+
<p>
|
|
33
|
+
exitDelay: 1500
|
|
34
|
+
</p>
|
|
35
|
+
<p>
|
|
36
|
+
entryDelay: 300
|
|
37
|
+
</p>
|
|
38
|
+
<p>
|
|
39
|
+
maxWidth: 150px
|
|
40
|
+
</p>
|
|
41
|
+
<p>
|
|
42
|
+
position: top
|
|
43
|
+
</p>
|
|
44
|
+
<p>
|
|
45
|
+
button-ariaLabel: Copy to clipboard
|
|
46
|
+
</p>
|
|
47
|
+
<div>
|
|
48
|
+
children: Copy to clipboard
|
|
49
|
+
</div>
|
|
50
|
+
<button>
|
|
51
|
+
Test CCB clicker
|
|
52
|
+
</button>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</DocumentFragment>
|
|
57
|
+
`;
|
package/src/components/ClipboardCopy/__tests__/__snapshots__/ClipboardCopyButton.test.tsx.snap
CHANGED
|
@@ -1,31 +1,57 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
3
|
+
exports[`Matches snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
aria-label="click this button to copy text"
|
|
8
|
-
aria-labelledby="my-id my-text-id"
|
|
9
|
-
class="pf-v5-c-button pf-m-control fancy-copy-button"
|
|
10
|
-
data-ouia-component-id="OUIA-Generated-Button-control-1"
|
|
11
|
-
data-ouia-component-type="PF5/Button"
|
|
12
|
-
data-ouia-safe="true"
|
|
13
|
-
id="my-id"
|
|
14
|
-
type="button"
|
|
5
|
+
<div
|
|
6
|
+
data-testid="tooltip-mock"
|
|
15
7
|
>
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
class="pf-v5-svg"
|
|
19
|
-
fill="currentColor"
|
|
20
|
-
height="1em"
|
|
21
|
-
role="img"
|
|
22
|
-
viewBox="0 0 448 512"
|
|
23
|
-
width="1em"
|
|
8
|
+
<div
|
|
9
|
+
data-testid="tooltip-mock-content"
|
|
24
10
|
>
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</
|
|
29
|
-
|
|
11
|
+
<div>
|
|
12
|
+
Button content
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
<p>
|
|
16
|
+
exitDelay: 0
|
|
17
|
+
</p>
|
|
18
|
+
<p>
|
|
19
|
+
entryDelay: 300
|
|
20
|
+
</p>
|
|
21
|
+
<p>
|
|
22
|
+
maxWidth: 100px
|
|
23
|
+
</p>
|
|
24
|
+
<p>
|
|
25
|
+
position: top
|
|
26
|
+
</p>
|
|
27
|
+
<a>
|
|
28
|
+
onTooltipHidden clicker
|
|
29
|
+
</a>
|
|
30
|
+
<button
|
|
31
|
+
aria-disabled="false"
|
|
32
|
+
aria-label="Copyable input"
|
|
33
|
+
aria-labelledby="button-id text-id"
|
|
34
|
+
class="pf-v5-c-button pf-m-control"
|
|
35
|
+
data-ouia-component-id="OUIA-Generated-Button-control-1"
|
|
36
|
+
data-ouia-component-type="PF5/Button"
|
|
37
|
+
data-ouia-safe="true"
|
|
38
|
+
id="button-id"
|
|
39
|
+
type="button"
|
|
40
|
+
>
|
|
41
|
+
<svg
|
|
42
|
+
aria-hidden="true"
|
|
43
|
+
class="pf-v5-svg"
|
|
44
|
+
fill="currentColor"
|
|
45
|
+
height="1em"
|
|
46
|
+
role="img"
|
|
47
|
+
viewBox="0 0 448 512"
|
|
48
|
+
width="1em"
|
|
49
|
+
>
|
|
50
|
+
<path
|
|
51
|
+
d="M320 448v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24V120c0-13.255 10.745-24 24-24h72v296c0 30.879 25.121 56 56 56h168zm0-344V0H152c-13.255 0-24 10.745-24 24v368c0 13.255 10.745 24 24 24h272c13.255 0 24-10.745 24-24V128H344c-13.2 0-24-10.8-24-24zm120.971-31.029L375.029 7.029A24 24 0 0 0 358.059 0H352v96h96v-6.059a24 24 0 0 0-7.029-16.97z"
|
|
52
|
+
/>
|
|
53
|
+
</svg>
|
|
54
|
+
</button>
|
|
55
|
+
</div>
|
|
30
56
|
</DocumentFragment>
|
|
31
57
|
`;
|
package/src/components/ClipboardCopy/__tests__/__snapshots__/ClipboardCopyExpanded.test.tsx.snap
CHANGED
|
@@ -1,32 +1,12 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
3
|
+
exports[`Matches snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
|
-
class="pf-v5-c-clipboard-copy__expandable-content
|
|
6
|
+
class="pf-v5-c-clipboard-copy__expandable-content"
|
|
7
7
|
contenteditable="true"
|
|
8
|
-
id="id-1"
|
|
9
8
|
>
|
|
10
|
-
|
|
11
|
-
dir="ltr"
|
|
12
|
-
>
|
|
13
|
-
{
|
|
14
|
-
"name": "@patternfly/react-core",
|
|
15
|
-
"version": "1.33.2"
|
|
16
|
-
}
|
|
17
|
-
</pre>
|
|
18
|
-
</div>
|
|
19
|
-
</DocumentFragment>
|
|
20
|
-
`;
|
|
21
|
-
|
|
22
|
-
exports[`expanded content render 1`] = `
|
|
23
|
-
<DocumentFragment>
|
|
24
|
-
<div
|
|
25
|
-
class="pf-v5-c-clipboard-copy__expandable-content class-1"
|
|
26
|
-
contenteditable="true"
|
|
27
|
-
id="id-1"
|
|
28
|
-
>
|
|
29
|
-
This is my text
|
|
9
|
+
Expanded content
|
|
30
10
|
</div>
|
|
31
11
|
</DocumentFragment>
|
|
32
12
|
`;
|
package/src/components/ClipboardCopy/__tests__/__snapshots__/ClipboardCopyToggle.test.tsx.snap
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
3
|
+
exports[`Matches snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<button
|
|
6
|
-
aria-controls="
|
|
6
|
+
aria-controls="content-id"
|
|
7
7
|
aria-disabled="false"
|
|
8
8
|
aria-expanded="false"
|
|
9
|
-
aria-
|
|
10
|
-
|
|
11
|
-
class="pf-v5-c-button pf-m-control myclassName"
|
|
9
|
+
aria-labelledby="main-id text-id"
|
|
10
|
+
class="pf-v5-c-button pf-m-control"
|
|
12
11
|
data-ouia-component-id="OUIA-Generated-Button-control-1"
|
|
13
12
|
data-ouia-component-type="PF5/Button"
|
|
14
13
|
data-ouia-safe="true"
|
|
15
|
-
id="
|
|
14
|
+
id="main-id"
|
|
16
15
|
type="button"
|
|
17
16
|
>
|
|
18
17
|
<div
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This test was generated
|
|
3
|
-
*/
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { render } from '@testing-library/react';
|
|
6
|
-
import { ClipboardCopy } from '../../ClipboardCopy';
|
|
7
|
-
// any missing imports can usually be resolved by adding them here
|
|
8
|
-
import {} from '../..';
|
|
9
|
-
|
|
10
|
-
it('ClipboardCopy should match snapshot (auto-generated)', () => {
|
|
11
|
-
const { asFragment } = render(
|
|
12
|
-
<ClipboardCopy
|
|
13
|
-
className={'string'}
|
|
14
|
-
hoverTip={"'Copy to clipboard'"}
|
|
15
|
-
clickTip={"'Successfully copied to clipboard!'"}
|
|
16
|
-
textAriaLabel={"'Copyable input'"}
|
|
17
|
-
toggleAriaLabel={"'Show content'"}
|
|
18
|
-
isReadOnly={false}
|
|
19
|
-
isExpanded={false}
|
|
20
|
-
isCode={false}
|
|
21
|
-
variant={'inline'}
|
|
22
|
-
position={'auto'}
|
|
23
|
-
maxWidth={"'150px'"}
|
|
24
|
-
exitDelay={1600}
|
|
25
|
-
entryDelay={100}
|
|
26
|
-
onCopy={(event: React.ClipboardEvent<HTMLDivElement>, text?: React.ReactNode) => {
|
|
27
|
-
const clipboard = event.currentTarget.parentElement;
|
|
28
|
-
const el = document.createElement('input');
|
|
29
|
-
el.value = text.toString();
|
|
30
|
-
clipboard.appendChild(el);
|
|
31
|
-
el.select();
|
|
32
|
-
document.execCommand('copy');
|
|
33
|
-
clipboard.removeChild(el);
|
|
34
|
-
}}
|
|
35
|
-
onChange={(): any => undefined}
|
|
36
|
-
children={<div>ReactNode</div>}
|
|
37
|
-
/>
|
|
38
|
-
);
|
|
39
|
-
expect(asFragment()).toMatchSnapshot();
|
|
40
|
-
});
|
package/src/components/ClipboardCopy/__tests__/Generated/__snapshots__/ClipboardCopy.test.tsx.snap
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`ClipboardCopy should match snapshot (auto-generated) 1`] = `
|
|
4
|
-
<DocumentFragment>
|
|
5
|
-
<div
|
|
6
|
-
class="pf-v5-c-clipboard-copy string"
|
|
7
|
-
data-ouia-component-type="PF5/ClipboardCopy"
|
|
8
|
-
data-ouia-safe="true"
|
|
9
|
-
>
|
|
10
|
-
<div
|
|
11
|
-
class="pf-v5-c-clipboard-copy__group"
|
|
12
|
-
>
|
|
13
|
-
<span
|
|
14
|
-
class="pf-v5-c-form-control"
|
|
15
|
-
>
|
|
16
|
-
<input
|
|
17
|
-
aria-invalid="false"
|
|
18
|
-
aria-label="'Copyable input'"
|
|
19
|
-
data-ouia-component-id="OUIA-Generated-TextInputBase-1"
|
|
20
|
-
data-ouia-component-type="PF5/TextInput"
|
|
21
|
-
data-ouia-safe="true"
|
|
22
|
-
id="text-input-0"
|
|
23
|
-
type="text"
|
|
24
|
-
value="[object Object]"
|
|
25
|
-
/>
|
|
26
|
-
</span>
|
|
27
|
-
<button
|
|
28
|
-
aria-disabled="false"
|
|
29
|
-
aria-label="'Copy to clipboard'"
|
|
30
|
-
aria-labelledby="copy-button-0 text-input-0"
|
|
31
|
-
class="pf-v5-c-button pf-m-control"
|
|
32
|
-
data-ouia-component-id="OUIA-Generated-Button-control-1"
|
|
33
|
-
data-ouia-component-type="PF5/Button"
|
|
34
|
-
data-ouia-safe="true"
|
|
35
|
-
id="copy-button-0"
|
|
36
|
-
type="button"
|
|
37
|
-
>
|
|
38
|
-
<svg
|
|
39
|
-
aria-hidden="true"
|
|
40
|
-
class="pf-v5-svg"
|
|
41
|
-
fill="currentColor"
|
|
42
|
-
height="1em"
|
|
43
|
-
role="img"
|
|
44
|
-
viewBox="0 0 448 512"
|
|
45
|
-
width="1em"
|
|
46
|
-
>
|
|
47
|
-
<path
|
|
48
|
-
d="M320 448v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24V120c0-13.255 10.745-24 24-24h72v296c0 30.879 25.121 56 56 56h168zm0-344V0H152c-13.255 0-24 10.745-24 24v368c0 13.255 10.745 24 24 24h272c13.255 0 24-10.745 24-24V128H344c-13.2 0-24-10.8-24-24zm120.971-31.029L375.029 7.029A24 24 0 0 0 358.059 0H352v96h96v-6.059a24 24 0 0 0-7.029-16.97z"
|
|
49
|
-
/>
|
|
50
|
-
</svg>
|
|
51
|
-
</button>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
</DocumentFragment>
|
|
55
|
-
`;
|