@patternfly/react-core 4.202.28 → 4.202.31
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 +24 -0
- package/dist/esm/components/JumpLinks/JumpLinksItem.d.ts.map +1 -1
- package/dist/esm/components/JumpLinks/JumpLinksItem.js +1 -1
- package/dist/esm/components/JumpLinks/JumpLinksItem.js.map +1 -1
- package/dist/esm/components/ProgressStepper/ProgressStep.d.ts +3 -0
- package/dist/esm/components/ProgressStepper/ProgressStep.d.ts.map +1 -1
- package/dist/esm/components/ProgressStepper/ProgressStep.js +2 -2
- package/dist/esm/components/ProgressStepper/ProgressStep.js.map +1 -1
- package/dist/esm/components/Tabs/Tab.d.ts.map +1 -1
- package/dist/esm/components/Tabs/Tab.js +2 -2
- package/dist/esm/components/Tabs/Tab.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.d.ts +1 -1
- package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/esm/components/Tabs/Tabs.js +1 -1
- package/dist/esm/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/helpers/Popper/Popper.d.ts.map +1 -1
- package/dist/esm/helpers/Popper/Popper.js +1 -7
- package/dist/esm/helpers/Popper/Popper.js.map +1 -1
- package/dist/js/components/JumpLinks/JumpLinksItem.d.ts.map +1 -1
- package/dist/js/components/JumpLinks/JumpLinksItem.js +1 -1
- package/dist/js/components/JumpLinks/JumpLinksItem.js.map +1 -1
- package/dist/js/components/ProgressStepper/ProgressStep.d.ts +3 -0
- package/dist/js/components/ProgressStepper/ProgressStep.d.ts.map +1 -1
- package/dist/js/components/ProgressStepper/ProgressStep.js +2 -2
- package/dist/js/components/ProgressStepper/ProgressStep.js.map +1 -1
- package/dist/js/components/Tabs/Tab.d.ts.map +1 -1
- package/dist/js/components/Tabs/Tab.js +2 -2
- package/dist/js/components/Tabs/Tab.js.map +1 -1
- package/dist/js/components/Tabs/Tabs.d.ts +1 -1
- package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/js/components/Tabs/Tabs.js +1 -1
- package/dist/js/components/Tabs/Tabs.js.map +1 -1
- package/dist/js/helpers/Popper/Popper.d.ts.map +1 -1
- package/dist/js/helpers/Popper/Popper.js +1 -7
- package/dist/js/helpers/Popper/Popper.js.map +1 -1
- package/dist/umd/react-core.js +7 -13
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +5 -5
- package/src/components/Dropdown/__tests__/DropdownToggleCheckbox.test.tsx +1 -1
- package/src/components/ExpandableSection/examples/ExpandableSection.md +1 -1
- package/src/components/JumpLinks/JumpLinksItem.tsx +5 -1
- package/src/components/JumpLinks/__tests__/__snapshots__/JumpLinks.test.tsx.snap +5 -0
- package/src/components/Page/__tests__/Page.test.tsx +225 -205
- package/src/components/Page/__tests__/__snapshots__/Page.test.tsx.snap +1088 -2059
- package/src/components/Pagination/__tests__/Pagination.test.tsx +235 -283
- package/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap +143 -577
- package/src/components/ProgressStepper/ProgressStep.tsx +6 -0
- package/src/components/ProgressStepper/__tests__/__snapshots__/ProgressStepper.test.tsx.snap +1 -0
- package/src/components/ProgressStepper/examples/ProgressStepper.md +9 -9
- package/src/components/Radio/__tests__/Radio.test.tsx +38 -44
- package/src/components/Radio/__tests__/__snapshots__/Radio.test.tsx.snap +30 -30
- package/src/components/SearchInput/__tests__/SearchInput.test.tsx +87 -68
- package/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap +230 -137
- package/src/components/Select/__tests__/Select.test.tsx +238 -195
- package/src/components/Select/__tests__/SelectToggle.test.tsx +68 -130
- package/src/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +978 -2149
- package/src/components/Select/__tests__/__snapshots__/SelectToggle.test.tsx.snap +3 -3
- package/src/components/SimpleList/__tests__/SimpleList.test.tsx +29 -32
- package/src/components/SimpleList/__tests__/__snapshots__/SimpleList.test.tsx.snap +4 -366
- package/src/components/Switch/__tests__/Switch.test.tsx +85 -75
- package/src/components/Switch/__tests__/__snapshots__/Switch.test.tsx.snap +30 -40
- package/src/components/Tabs/Tab.tsx +6 -1
- package/src/components/Tabs/Tabs.tsx +2 -2
- package/src/components/Tabs/__tests__/Generated/__snapshots__/Tabs.test.tsx.snap +1 -0
- package/src/components/Tabs/__tests__/__snapshots__/Tab.test.tsx.snap +3 -0
- package/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +135 -0
- package/src/components/Tabs/examples/Tabs.md +32 -26
- package/src/components/TextArea/__tests__/TextArea.test.tsx +98 -103
- package/src/components/TextArea/__tests__/__snapshots__/TextArea.test.tsx.snap +24 -103
- package/src/components/TextInput/__tests__/TextInput.test.tsx +71 -70
- package/src/components/TextInput/__tests__/__snapshots__/TextInput.test.tsx.snap +15 -103
- package/src/components/TextInputGroup/__tests__/TextInputGroup.test.tsx +65 -39
- package/src/components/TextInputGroup/__tests__/__snapshots__/TextInputGroup.test.tsx.snap +53 -14
- package/src/components/TimePicker/__tests__/TimePicker.test.tsx +113 -110
- package/src/components/Title/__tests__/Title.test.tsx +21 -20
- package/src/components/Title/__tests__/__snapshots__/Title.test.tsx.snap +24 -30
- package/src/components/ToggleGroup/__tests__/ToggleGroup.test.tsx +43 -39
- package/src/components/ToggleGroup/__tests__/__snapshots__/ToggleGroup.test.tsx.snap +20 -19
- package/src/components/Wizard/__tests__/Wizard.test.tsx +195 -189
- package/src/components/Wizard/__tests__/__snapshots__/Wizard.test.tsx.snap +131 -10
- package/src/helpers/Popper/Popper.tsx +5 -7
- package/src/helpers/__tests__/util.test.ts +113 -0
- package/src/layouts/Bullseye/__tests__/Bullseye.test.tsx +25 -25
- package/src/layouts/Bullseye/__tests__/__snapshots__/Bullseye.test.tsx.snap +3 -5
- package/src/layouts/Flex/__tests__/Flex.test.tsx +159 -96
- package/src/layouts/Flex/__tests__/__snapshots__/Flex.test.tsx.snap +9 -17
- package/src/components/Page/__tests__/Generated/Page.test.tsx +0 -28
- package/src/components/Page/__tests__/Generated/__snapshots__/Page.test.tsx.snap +0 -19
- package/src/components/Pagination/__tests__/Generated/Pagination.test.tsx +0 -58
- package/src/components/Pagination/__tests__/Generated/__snapshots__/Pagination.test.tsx.snap +0 -205
- package/src/components/Radio/__tests__/Generated/Radio.test.tsx +0 -29
- package/src/components/Radio/__tests__/Generated/__snapshots__/Radio.test.tsx.snap +0 -36
- package/src/components/Select/__tests__/Generated/Select.test.tsx +0 -49
- package/src/components/Select/__tests__/Generated/SelectToggle.test.tsx +0 -34
- package/src/components/Select/__tests__/Generated/__snapshots__/Select.test.tsx.snap +0 -48
- package/src/components/Select/__tests__/Generated/__snapshots__/SelectToggle.test.tsx.snap +0 -36
- package/src/components/SimpleList/__tests__/Generated/SimpleList.test.tsx +0 -22
- package/src/components/SimpleList/__tests__/Generated/__snapshots__/SimpleList.test.tsx.snap +0 -13
- package/src/components/Switch/__tests__/Generated/Switch.test.tsx +0 -24
- package/src/components/Switch/__tests__/Generated/__snapshots__/Switch.test.tsx.snap +0 -36
- package/src/components/TextArea/__tests__/Generated/TextArea.test.tsx +0 -23
- package/src/components/TextArea/__tests__/Generated/__snapshots__/TextArea.test.tsx.snap +0 -13
- package/src/components/Title/__tests__/Generated/Title.test.tsx +0 -13
- package/src/components/Title/__tests__/Generated/__snapshots__/Title.test.tsx.snap +0 -12
- package/src/helpers/__tests__/util.test.js +0 -235
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`basic not selected 1`] = `
|
|
4
|
-
<
|
|
3
|
+
exports[`ToggleGroup basic not selected 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
6
|
class="pf-c-toggle-group__item"
|
|
7
7
|
>
|
|
@@ -19,18 +19,18 @@ exports[`basic not selected 1`] = `
|
|
|
19
19
|
</span>
|
|
20
20
|
</button>
|
|
21
21
|
</div>
|
|
22
|
-
</
|
|
22
|
+
</DocumentFragment>
|
|
23
23
|
`;
|
|
24
24
|
|
|
25
|
-
exports[`basic selected 1`] = `
|
|
26
|
-
<
|
|
25
|
+
exports[`ToggleGroup basic selected 1`] = `
|
|
26
|
+
<DocumentFragment>
|
|
27
27
|
<div
|
|
28
28
|
class="pf-c-toggle-group__item"
|
|
29
29
|
>
|
|
30
30
|
<button
|
|
31
31
|
aria-label="basic selected"
|
|
32
|
-
aria-pressed="
|
|
33
|
-
class="pf-c-toggle-group__button"
|
|
32
|
+
aria-pressed="true"
|
|
33
|
+
class="pf-c-toggle-group__button pf-m-selected"
|
|
34
34
|
id="toggleGroupItem"
|
|
35
35
|
type="button"
|
|
36
36
|
>
|
|
@@ -41,18 +41,18 @@ exports[`basic selected 1`] = `
|
|
|
41
41
|
</span>
|
|
42
42
|
</button>
|
|
43
43
|
</div>
|
|
44
|
-
</
|
|
44
|
+
</DocumentFragment>
|
|
45
45
|
`;
|
|
46
46
|
|
|
47
|
-
exports[`icon variant 1`] = `
|
|
48
|
-
<
|
|
47
|
+
exports[`ToggleGroup icon variant 1`] = `
|
|
48
|
+
<DocumentFragment>
|
|
49
49
|
<div
|
|
50
50
|
class="pf-c-toggle-group__item"
|
|
51
51
|
>
|
|
52
52
|
<button
|
|
53
53
|
aria-label="icon variant"
|
|
54
|
-
aria-pressed="
|
|
55
|
-
class="pf-c-toggle-group__button"
|
|
54
|
+
aria-pressed="true"
|
|
55
|
+
class="pf-c-toggle-group__button pf-m-selected"
|
|
56
56
|
id="toggleGroupItem"
|
|
57
57
|
type="button"
|
|
58
58
|
>
|
|
@@ -63,12 +63,13 @@ exports[`icon variant 1`] = `
|
|
|
63
63
|
</span>
|
|
64
64
|
</button>
|
|
65
65
|
</div>
|
|
66
|
-
</
|
|
66
|
+
</DocumentFragment>
|
|
67
67
|
`;
|
|
68
68
|
|
|
69
|
-
exports[`isCompact 1`] = `
|
|
70
|
-
<
|
|
69
|
+
exports[`ToggleGroup isCompact 1`] = `
|
|
70
|
+
<DocumentFragment>
|
|
71
71
|
<div
|
|
72
|
+
aria-label="Label"
|
|
72
73
|
class="pf-c-toggle-group pf-m-compact"
|
|
73
74
|
role="group"
|
|
74
75
|
>
|
|
@@ -103,11 +104,11 @@ exports[`isCompact 1`] = `
|
|
|
103
104
|
</button>
|
|
104
105
|
</div>
|
|
105
106
|
</div>
|
|
106
|
-
</
|
|
107
|
+
</DocumentFragment>
|
|
107
108
|
`;
|
|
108
109
|
|
|
109
|
-
exports[`isDisabled 1`] = `
|
|
110
|
-
<
|
|
110
|
+
exports[`ToggleGroup isDisabled 1`] = `
|
|
111
|
+
<DocumentFragment>
|
|
111
112
|
<div
|
|
112
113
|
class="pf-c-toggle-group__item"
|
|
113
114
|
>
|
|
@@ -126,5 +127,5 @@ exports[`isDisabled 1`] = `
|
|
|
126
127
|
</span>
|
|
127
128
|
</button>
|
|
128
129
|
</div>
|
|
129
|
-
</
|
|
130
|
+
</DocumentFragment>
|
|
130
131
|
`;
|
|
@@ -1,201 +1,207 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
|
+
|
|
4
6
|
import { Wizard, WizardStepFunctionType, WizardStep } from '../Wizard';
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const view = render(
|
|
33
|
-
<Wizard title="Wizard title" description="Description here" steps={steps} startAtStep={1} onBack={onBack} />
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
expect(view.container).toMatchSnapshot();
|
|
37
|
-
});
|
|
8
|
+
describe('Wizard', () => {
|
|
9
|
+
test('Wizard should match snapshot', () => {
|
|
10
|
+
const steps: WizardStep[] = [
|
|
11
|
+
{ name: 'A', component: <p>Step 1</p> },
|
|
12
|
+
{
|
|
13
|
+
name: 'B',
|
|
14
|
+
steps: [
|
|
15
|
+
{
|
|
16
|
+
name: 'B-1',
|
|
17
|
+
component: <p>Step 2</p>,
|
|
18
|
+
enableNext: true
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'B-2',
|
|
22
|
+
component: <p>Step 3</p>,
|
|
23
|
+
enableNext: false
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
{ name: 'C', component: <p>Step 4</p> },
|
|
28
|
+
{ name: 'D', component: <p>Step 5</p> }
|
|
29
|
+
];
|
|
30
|
+
const onBack: WizardStepFunctionType = step => {
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
32
|
+
const name = { step };
|
|
33
|
+
};
|
|
38
34
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
name: 'B',
|
|
44
|
-
steps: [
|
|
45
|
-
{
|
|
46
|
-
name: 'B-1',
|
|
47
|
-
component: <p>Step 2</p>,
|
|
48
|
-
enableNext: true
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: 'B-2',
|
|
52
|
-
component: <p>Step 3</p>,
|
|
53
|
-
enableNext: false
|
|
54
|
-
}
|
|
55
|
-
]
|
|
56
|
-
},
|
|
57
|
-
{ name: 'C', component: <p>Step 4</p> },
|
|
58
|
-
{ name: 'D', component: <p>Step 5</p> }
|
|
59
|
-
];
|
|
60
|
-
const onBack: WizardStepFunctionType = step => {
|
|
61
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
62
|
-
const name = { step };
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const view = render(
|
|
66
|
-
<Wizard title="Wizard title" description="Description here" steps={steps} startAtStep={1} onBack={onBack} isNavExpandable />
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
expect(view.container).toMatchSnapshot();
|
|
70
|
-
});
|
|
35
|
+
const { asFragment } = render(
|
|
36
|
+
<Wizard title="Wizard title" description="Description here" steps={steps} startAtStep={1} onBack={onBack} />
|
|
37
|
+
);
|
|
71
38
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const wiz = (
|
|
75
|
-
<Wizard
|
|
76
|
-
description="This wizard uses anchor tags for the nav item elements"
|
|
77
|
-
id="inPageWizWithAnchorsId"
|
|
78
|
-
steps={steps}
|
|
79
|
-
/>
|
|
80
|
-
);
|
|
81
|
-
const view = mount(wiz);
|
|
82
|
-
const hasHeader = view.at(0).find('.pf-c-wizard__header').length;
|
|
83
|
-
const hasTitle = view.at(0).find('.pf-c-wizard__title').length;
|
|
84
|
-
expect(hasHeader).toBeFalsy();
|
|
85
|
-
expect(hasTitle).toBeFalsy();
|
|
86
|
-
});
|
|
39
|
+
expect(asFragment()).toMatchSnapshot();
|
|
40
|
+
});
|
|
87
41
|
|
|
88
|
-
test('
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
42
|
+
test('Expandable Nav Wizard should match snapshot', () => {
|
|
43
|
+
const steps: WizardStep[] = [
|
|
44
|
+
{ name: 'A', component: <p>Step 1</p> },
|
|
45
|
+
{
|
|
46
|
+
name: 'B',
|
|
47
|
+
steps: [
|
|
48
|
+
{
|
|
49
|
+
name: 'B-1',
|
|
50
|
+
component: <p>Step 2</p>,
|
|
51
|
+
enableNext: true
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'B-2',
|
|
55
|
+
component: <p>Step 3</p>,
|
|
56
|
+
enableNext: false
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
{ name: 'C', component: <p>Step 4</p> },
|
|
61
|
+
{ name: 'D', component: <p>Step 5</p> }
|
|
62
|
+
];
|
|
63
|
+
const onBack: WizardStepFunctionType = step => {
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
65
|
+
const name = { step };
|
|
66
|
+
};
|
|
101
67
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
68
|
+
const { asFragment } = render(
|
|
69
|
+
<Wizard
|
|
70
|
+
title="Wizard title"
|
|
71
|
+
description="Description here"
|
|
72
|
+
steps={steps}
|
|
73
|
+
startAtStep={1}
|
|
74
|
+
onBack={onBack}
|
|
75
|
+
isNavExpandable
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
112
78
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const wiz = (
|
|
116
|
-
<Wizard
|
|
117
|
-
title="Wizard"
|
|
118
|
-
navAriaLabel="nav aria-label"
|
|
119
|
-
mainAriaLabel="main aria-label"
|
|
120
|
-
description="This wizard has a title"
|
|
121
|
-
steps={steps} />
|
|
122
|
-
);
|
|
123
|
-
const view = mount(wiz).at(0);
|
|
124
|
-
const nav = view.find('nav.pf-c-wizard__nav');
|
|
125
|
-
const main = view.find('div.pf-c-wizard__main');
|
|
126
|
-
expect(nav.find('[aria-labelledby="pf-wizard-title-5"]').length).toBe(1);
|
|
127
|
-
expect(nav.find('[aria-label="nav aria-label"]').length).toBe(1);
|
|
128
|
-
expect(main.props()['aria-label']).toBe('main aria-label');
|
|
129
|
-
});
|
|
79
|
+
expect(asFragment()).toMatchSnapshot();
|
|
80
|
+
});
|
|
130
81
|
|
|
131
|
-
test('wiz
|
|
132
|
-
|
|
133
|
-
const wiz = (
|
|
134
|
-
<Wizard
|
|
135
|
-
navAriaLabel="nav aria-label"
|
|
136
|
-
mainAriaLabel="main aria-label"
|
|
137
|
-
description="This wizard has a title"
|
|
138
|
-
steps={steps} />
|
|
139
|
-
);
|
|
140
|
-
const view = mount(wiz).at(0);
|
|
141
|
-
const nav = view.find('nav.pf-c-wizard__nav');
|
|
142
|
-
const main = view.find('div.pf-c-wizard__main');
|
|
143
|
-
expect(main.props()['aria-label']).toBe('main aria-label');
|
|
144
|
-
expect(main.props()['aria-labelledby']).toBe(null);
|
|
145
|
-
expect(nav.find('[aria-label="nav aria-label"]').length).toBe(1);
|
|
146
|
-
expect(nav.props()['aria-labelledby']).toBe(null);
|
|
147
|
-
});
|
|
82
|
+
test('bare wiz', () => {
|
|
83
|
+
const steps: WizardStep[] = [{ name: 'A', component: <p>Step 1</p> }];
|
|
148
84
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
description="This wizard has a title"
|
|
157
|
-
steps={steps} />
|
|
158
|
-
);
|
|
159
|
-
const view = mount(wiz).at(0);
|
|
160
|
-
const nav = view.find('nav.pf-c-wizard__nav');
|
|
161
|
-
const main = view.find('div.pf-c-wizard__main');
|
|
162
|
-
expect(nav.find('[aria-label="nav aria-label"]').length).toBe(1);
|
|
163
|
-
expect(nav.props()['aria-labelledby']).toBe('nav-aria-labelledby');
|
|
164
|
-
});
|
|
85
|
+
const { asFragment } = render(
|
|
86
|
+
<Wizard
|
|
87
|
+
description="This wizard uses anchor tags for the nav item elements"
|
|
88
|
+
id="inPageWizWithAnchorsId"
|
|
89
|
+
steps={steps}
|
|
90
|
+
/>
|
|
91
|
+
);
|
|
165
92
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
93
|
+
expect(asFragment()).toMatchSnapshot();
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('wiz with title', () => {
|
|
97
|
+
const steps: WizardStep[] = [{ name: 'A', component: <p>Step 1</p> }];
|
|
98
|
+
|
|
99
|
+
render(<Wizard title="Wizard" description="This wizard has a title" steps={steps} data-testid="wizard-test-id" />);
|
|
100
|
+
expect(screen.getByRole('heading', { name: 'Wizard' })).toBeInTheDocument();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test('wiz with title and navAriaLabel combination', () => {
|
|
104
|
+
const steps: WizardStep[] = [{ name: 'A', component: <p>Step 1</p> }];
|
|
105
|
+
|
|
106
|
+
render(<Wizard title="Wizard" navAriaLabel="Some label" description="This wizard has a title" steps={steps} />);
|
|
107
|
+
|
|
108
|
+
const nav = screen.getByLabelText('Some label');
|
|
109
|
+
|
|
110
|
+
expect(screen.getByRole('heading', { name: 'Wizard' })).toBeInTheDocument();
|
|
111
|
+
expect(nav).toBeInTheDocument();
|
|
112
|
+
expect(nav).toHaveAttribute('aria-labelledby', 'pf-wizard-title-4');
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
test('wiz with title, navAriaLabel, and mainAriaLabel combination', () => {
|
|
116
|
+
const steps: WizardStep[] = [{ name: 'A', component: <p>Step 1</p> }];
|
|
117
|
+
render(
|
|
118
|
+
<Wizard
|
|
119
|
+
title="Wizard"
|
|
120
|
+
navAriaLabel="nav aria-label"
|
|
121
|
+
mainAriaLabel="main aria-label"
|
|
122
|
+
description="This wizard has a title"
|
|
123
|
+
steps={steps}
|
|
124
|
+
/>
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
expect(screen.getByRole('heading', { name: 'Wizard' })).toBeInTheDocument();
|
|
128
|
+
expect(screen.getByLabelText('nav aria-label')).toBeInTheDocument();
|
|
129
|
+
expect(screen.getByLabelText('main aria-label')).toBeInTheDocument();
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test('wiz with navAriaLabel and mainAriaLabel but without title', () => {
|
|
133
|
+
const steps: WizardStep[] = [{ name: 'A', component: <p>Step 1</p> }];
|
|
134
|
+
|
|
135
|
+
render(
|
|
136
|
+
<Wizard
|
|
137
|
+
navAriaLabel="nav aria-label"
|
|
138
|
+
mainAriaLabel="main aria-label"
|
|
139
|
+
description="This wizard has a title"
|
|
140
|
+
steps={steps}
|
|
141
|
+
/>
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
expect(screen.getByLabelText('nav aria-label')).toBeInTheDocument();
|
|
145
|
+
expect(screen.getByLabelText('main aria-label')).toBeInTheDocument();
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
test('wiz with navAriaLabel and navAriaLabelledby and without title', () => {
|
|
149
|
+
const steps: WizardStep[] = [{ name: 'A', component: <p>Step 1</p> }];
|
|
150
|
+
|
|
151
|
+
render(
|
|
152
|
+
<Wizard
|
|
153
|
+
navAriaLabelledBy="nav-aria-labelledby"
|
|
154
|
+
navAriaLabel="nav aria-label"
|
|
155
|
+
mainAriaLabel="main aria-label"
|
|
156
|
+
description="This wizard has a title"
|
|
157
|
+
steps={steps}
|
|
158
|
+
/>
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
const nav = screen.getByLabelText('nav aria-label');
|
|
162
|
+
|
|
163
|
+
expect(nav).toBeInTheDocument();
|
|
164
|
+
expect(nav).toHaveAttribute('aria-labelledby', 'nav-aria-labelledby');
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
test('wiz with navAriaLabel and navAriaLabelledby and without title', () => {
|
|
168
|
+
const steps: WizardStep[] = [{ name: 'A', component: <p>Step 1</p> }];
|
|
169
|
+
render(
|
|
170
|
+
<Wizard
|
|
171
|
+
navAriaLabel="nav aria-label"
|
|
172
|
+
mainAriaLabel="main aria-label"
|
|
173
|
+
mainAriaLabelledBy="main-aria-labelledby"
|
|
174
|
+
description="This wizard has a title"
|
|
175
|
+
steps={steps}
|
|
176
|
+
/>
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
const main = screen.getByLabelText('main aria-label');
|
|
180
|
+
|
|
181
|
+
expect(main).toBeInTheDocument();
|
|
182
|
+
expect(main).toHaveAttribute('aria-labelledby', 'main-aria-labelledby');
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
test('wiz with title, navAriaLabelledBy, navAriaLabel, mainAriaLabel, and mainAriaLabelledby', () => {
|
|
186
|
+
const steps: WizardStep[] = [{ name: 'A', component: <p>Step 1</p> }];
|
|
187
|
+
render(
|
|
188
|
+
<Wizard
|
|
189
|
+
title="Wiz title"
|
|
190
|
+
navAriaLabel="nav aria-label"
|
|
191
|
+
navAriaLabelledBy="nav-aria-labelledby"
|
|
192
|
+
mainAriaLabel="main aria-label"
|
|
193
|
+
mainAriaLabelledBy="main-aria-labelledby"
|
|
194
|
+
description="This wizard has a title"
|
|
195
|
+
steps={steps}
|
|
196
|
+
/>
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
const nav = screen.getByLabelText('nav aria-label');
|
|
200
|
+
expect(nav).toBeInTheDocument();
|
|
201
|
+
expect(nav).toHaveAttribute('aria-labelledby', 'nav-aria-labelledby');
|
|
181
202
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
title="Wiz title"
|
|
187
|
-
navAriaLabel="nav aria-label"
|
|
188
|
-
navAriaLabelledBy="nav-aria-labelledby"
|
|
189
|
-
mainAriaLabel="main aria-label"
|
|
190
|
-
mainAriaLabelledBy="main-aria-labelledby"
|
|
191
|
-
description="This wizard has a title"
|
|
192
|
-
steps={steps} />
|
|
193
|
-
);
|
|
194
|
-
const view = mount(wiz).at(0);
|
|
195
|
-
const nav = view.find('nav.pf-c-wizard__nav');
|
|
196
|
-
const main = view.find('div.pf-c-wizard__main');
|
|
197
|
-
expect(nav.find('[aria-label="nav aria-label"]').length).toBe(1);
|
|
198
|
-
expect(nav.find('[aria-labelledby="nav-aria-labelledby"]').length).toBe(1);
|
|
199
|
-
expect(main.props()['aria-label']).toBe('main aria-label');
|
|
200
|
-
expect(main.props()['aria-labelledby']).toBe('main-aria-labelledby');
|
|
203
|
+
const main = screen.getByLabelText('main aria-label');
|
|
204
|
+
expect(main).toBeInTheDocument();
|
|
205
|
+
expect(main).toHaveAttribute('aria-labelledby', 'main-aria-labelledby');
|
|
206
|
+
});
|
|
201
207
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Expandable Nav Wizard should match snapshot 1`] = `
|
|
4
|
-
<
|
|
3
|
+
exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
6
|
class="pf-c-wizard"
|
|
7
7
|
>
|
|
@@ -64,8 +64,7 @@ exports[`Expandable Nav Wizard should match snapshot 1`] = `
|
|
|
64
64
|
>
|
|
65
65
|
1
|
|
66
66
|
</span>
|
|
67
|
-
|
|
68
|
-
A
|
|
67
|
+
A
|
|
69
68
|
</span>
|
|
70
69
|
</span>
|
|
71
70
|
<span
|
|
@@ -245,11 +244,11 @@ exports[`Expandable Nav Wizard should match snapshot 1`] = `
|
|
|
245
244
|
</footer>
|
|
246
245
|
</div>
|
|
247
246
|
</div>
|
|
248
|
-
</
|
|
247
|
+
</DocumentFragment>
|
|
249
248
|
`;
|
|
250
249
|
|
|
251
|
-
exports[`Wizard should match snapshot 1`] = `
|
|
252
|
-
<
|
|
250
|
+
exports[`Wizard Wizard should match snapshot 1`] = `
|
|
251
|
+
<DocumentFragment>
|
|
253
252
|
<div
|
|
254
253
|
class="pf-c-wizard"
|
|
255
254
|
>
|
|
@@ -312,8 +311,7 @@ exports[`Wizard should match snapshot 1`] = `
|
|
|
312
311
|
>
|
|
313
312
|
1
|
|
314
313
|
</span>
|
|
315
|
-
|
|
316
|
-
A
|
|
314
|
+
A
|
|
317
315
|
</span>
|
|
318
316
|
</span>
|
|
319
317
|
<span
|
|
@@ -467,5 +465,128 @@ exports[`Wizard should match snapshot 1`] = `
|
|
|
467
465
|
</footer>
|
|
468
466
|
</div>
|
|
469
467
|
</div>
|
|
470
|
-
</
|
|
468
|
+
</DocumentFragment>
|
|
469
|
+
`;
|
|
470
|
+
|
|
471
|
+
exports[`Wizard bare wiz 1`] = `
|
|
472
|
+
<DocumentFragment>
|
|
473
|
+
<div
|
|
474
|
+
class="pf-c-wizard"
|
|
475
|
+
id="inPageWizWithAnchorsId"
|
|
476
|
+
>
|
|
477
|
+
<button
|
|
478
|
+
aria-expanded="false"
|
|
479
|
+
aria-label="Wizard Toggle"
|
|
480
|
+
class="pf-c-wizard__toggle"
|
|
481
|
+
>
|
|
482
|
+
<span
|
|
483
|
+
class="pf-c-wizard__toggle-list"
|
|
484
|
+
>
|
|
485
|
+
<span
|
|
486
|
+
class="pf-c-wizard__toggle-list-item"
|
|
487
|
+
>
|
|
488
|
+
<span
|
|
489
|
+
class="pf-c-wizard__toggle-num"
|
|
490
|
+
>
|
|
491
|
+
1
|
|
492
|
+
</span>
|
|
493
|
+
A
|
|
494
|
+
</span>
|
|
495
|
+
</span>
|
|
496
|
+
<span
|
|
497
|
+
class="pf-c-wizard__toggle-icon"
|
|
498
|
+
>
|
|
499
|
+
<svg
|
|
500
|
+
aria-hidden="true"
|
|
501
|
+
fill="currentColor"
|
|
502
|
+
height="1em"
|
|
503
|
+
role="img"
|
|
504
|
+
style="vertical-align: -0.125em;"
|
|
505
|
+
viewBox="0 0 320 512"
|
|
506
|
+
width="1em"
|
|
507
|
+
>
|
|
508
|
+
<path
|
|
509
|
+
d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"
|
|
510
|
+
/>
|
|
511
|
+
</svg>
|
|
512
|
+
</span>
|
|
513
|
+
</button>
|
|
514
|
+
<div
|
|
515
|
+
class="pf-c-wizard__outer-wrap"
|
|
516
|
+
>
|
|
517
|
+
<div
|
|
518
|
+
class="pf-c-wizard__inner-wrap"
|
|
519
|
+
>
|
|
520
|
+
<nav
|
|
521
|
+
class="pf-c-wizard__nav"
|
|
522
|
+
>
|
|
523
|
+
<ol
|
|
524
|
+
class="pf-c-wizard__nav-list"
|
|
525
|
+
>
|
|
526
|
+
<li
|
|
527
|
+
class="pf-c-wizard__nav-item"
|
|
528
|
+
>
|
|
529
|
+
<button
|
|
530
|
+
aria-current="step"
|
|
531
|
+
class="pf-c-wizard__nav-link pf-m-current"
|
|
532
|
+
>
|
|
533
|
+
A
|
|
534
|
+
</button>
|
|
535
|
+
</li>
|
|
536
|
+
</ol>
|
|
537
|
+
</nav>
|
|
538
|
+
<div
|
|
539
|
+
class="pf-c-wizard__main"
|
|
540
|
+
>
|
|
541
|
+
<div
|
|
542
|
+
class="pf-c-wizard__main-body"
|
|
543
|
+
>
|
|
544
|
+
<p>
|
|
545
|
+
Step 1
|
|
546
|
+
</p>
|
|
547
|
+
</div>
|
|
548
|
+
</div>
|
|
549
|
+
</div>
|
|
550
|
+
<footer
|
|
551
|
+
class="pf-c-wizard__footer"
|
|
552
|
+
>
|
|
553
|
+
<button
|
|
554
|
+
aria-disabled="false"
|
|
555
|
+
class="pf-c-button pf-m-primary"
|
|
556
|
+
data-ouia-component-id="OUIA-Generated-Button-primary-3"
|
|
557
|
+
data-ouia-component-type="PF4/Button"
|
|
558
|
+
data-ouia-safe="true"
|
|
559
|
+
type="submit"
|
|
560
|
+
>
|
|
561
|
+
Next
|
|
562
|
+
</button>
|
|
563
|
+
<button
|
|
564
|
+
aria-disabled="true"
|
|
565
|
+
class="pf-c-button pf-m-secondary pf-m-disabled"
|
|
566
|
+
data-ouia-component-id="OUIA-Generated-Button-secondary-3"
|
|
567
|
+
data-ouia-component-type="PF4/Button"
|
|
568
|
+
data-ouia-safe="true"
|
|
569
|
+
disabled=""
|
|
570
|
+
type="button"
|
|
571
|
+
>
|
|
572
|
+
Back
|
|
573
|
+
</button>
|
|
574
|
+
<div
|
|
575
|
+
class="pf-c-wizard__footer-cancel"
|
|
576
|
+
>
|
|
577
|
+
<button
|
|
578
|
+
aria-disabled="false"
|
|
579
|
+
class="pf-c-button pf-m-link"
|
|
580
|
+
data-ouia-component-id="OUIA-Generated-Button-link-3"
|
|
581
|
+
data-ouia-component-type="PF4/Button"
|
|
582
|
+
data-ouia-safe="true"
|
|
583
|
+
type="button"
|
|
584
|
+
>
|
|
585
|
+
Cancel
|
|
586
|
+
</button>
|
|
587
|
+
</div>
|
|
588
|
+
</footer>
|
|
589
|
+
</div>
|
|
590
|
+
</div>
|
|
591
|
+
</DocumentFragment>
|
|
471
592
|
`;
|