@patternfly/react-core 4.202.17 → 4.202.20
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/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/esm/components/CalendarMonth/CalendarMonth.js +12 -4
- package/dist/esm/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/esm/components/NumberInput/NumberInput.d.ts +2 -0
- package/dist/esm/components/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/esm/components/NumberInput/NumberInput.js +2 -2
- package/dist/esm/components/NumberInput/NumberInput.js.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.js +12 -4
- package/dist/js/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/js/components/NumberInput/NumberInput.d.ts +2 -0
- package/dist/js/components/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/js/components/NumberInput/NumberInput.js +2 -2
- package/dist/js/components/NumberInput/NumberInput.js.map +1 -1
- package/dist/umd/react-core.js +14 -6
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +5 -5
- package/src/components/CalendarMonth/CalendarMonth.tsx +10 -4
- package/src/components/CalendarMonth/examples/CalendarMonth.md +9 -0
- package/src/components/CalendarMonth/examples/CalendarMonthDateRange.tsx +10 -0
- package/src/components/ContextSelector/examples/ContextSelector.md +3 -279
- package/src/components/ContextSelector/examples/ContextSelectorBasic.tsx +84 -0
- package/src/components/ContextSelector/examples/ContextSelectorPlainText.tsx +85 -0
- package/src/components/ContextSelector/examples/ContextSelectorWithFooter.tsx +91 -0
- package/src/components/DescriptionList/examples/DescriptionList.md +22 -930
- package/src/components/DescriptionList/examples/DescriptionListAutoFitBasic.tsx +40 -0
- package/src/components/DescriptionList/examples/DescriptionListAutoFitMinWidthModified.tsx +40 -0
- package/src/components/DescriptionList/examples/DescriptionListAutoFitMinWidthResponsive.tsx +40 -0
- package/src/components/DescriptionList/examples/DescriptionListBasic.tsx +40 -0
- package/src/components/DescriptionList/examples/DescriptionListColumnFill.tsx +42 -0
- package/src/components/DescriptionList/examples/DescriptionListCompact.tsx +40 -0
- package/src/components/DescriptionList/examples/DescriptionListCompactHorizontal.tsx +40 -0
- package/src/components/DescriptionList/examples/DescriptionListDefaultAutoColumn.tsx +40 -0
- package/src/components/DescriptionList/examples/DescriptionListDefaultInlineGrid.tsx +40 -0
- package/src/components/DescriptionList/examples/DescriptionListDefaultResponsiveColumns.tsx +40 -0
- package/src/components/DescriptionList/examples/DescriptionListDefaultThreeColLg.tsx +40 -0
- package/src/components/DescriptionList/examples/DescriptionListDefaultTwoCol.tsx +44 -0
- package/src/components/DescriptionList/examples/DescriptionListFluidHorizontal.tsx +40 -0
- package/src/components/DescriptionList/examples/DescriptionListHorizontal.tsx +40 -0
- package/src/components/DescriptionList/examples/DescriptionListHorizontalAutoColumn.tsx +40 -0
- package/src/components/DescriptionList/examples/DescriptionListHorizontalCustomTermWidth.tsx +50 -0
- package/src/components/DescriptionList/examples/DescriptionListHorizontalResponsiveColumns.tsx +40 -0
- package/src/components/DescriptionList/examples/DescriptionListHorizontalThreeColLg.tsx +40 -0
- package/src/components/DescriptionList/examples/DescriptionListHorizontalTwoCol.tsx +40 -0
- package/src/components/DescriptionList/examples/DescriptionListIconsOnTerms.tsx +45 -0
- package/src/components/DescriptionList/examples/DescriptionListResponsiveHoriVertGroup.tsx +48 -0
- package/src/components/DescriptionList/examples/DescriptionListWithTermHelpText.tsx +62 -0
- package/src/components/Divider/examples/Divider.md +15 -68
- package/src/components/Divider/examples/DividerInsetMedium.tsx +4 -0
- package/src/components/Divider/examples/DividerInsetVariousBreakpoints.tsx +13 -0
- package/src/components/Divider/examples/DividerUsingDiv.tsx +4 -0
- package/src/components/Divider/examples/DividerUsingHr.tsx +4 -0
- package/src/components/Divider/examples/DividerUsingLi.tsx +10 -0
- package/src/components/Divider/examples/DividerVerticalFlex.tsx +10 -0
- package/src/components/Divider/examples/DividerVerticalFlexInsetMedium.tsx +10 -0
- package/src/components/Divider/examples/DividerVerticalFlexInsetVariousBreakpoints.tsx +18 -0
- package/src/components/FormSelect/__tests__/FormSelect.test.tsx +0 -1
- package/src/components/List/__tests__/List.test.tsx +33 -33
- package/src/components/List/__tests__/__snapshots__/List.test.tsx.snap +33 -64
- package/src/components/Menu/__tests__/Menu.test.tsx +37 -33
- package/src/components/Menu/__tests__/__snapshots__/Menu.test.tsx.snap +3 -36
- package/src/components/Modal/__tests__/Modal.test.tsx +65 -67
- package/src/components/Modal/__tests__/ModalBoxCloseButton.test.tsx +13 -10
- package/src/components/Nav/__tests__/Nav.test.tsx +185 -214
- package/src/components/Nav/__tests__/__snapshots__/Nav.test.tsx.snap +877 -1729
- package/src/components/NotificationDrawer/__tests__/NotificationDrawer.test.tsx +13 -15
- package/src/components/NotificationDrawer/__tests__/NotificationDrawerBody.test.tsx +13 -15
- package/src/components/NotificationDrawer/__tests__/NotificationDrawerGroup.test.tsx +21 -27
- package/src/components/NotificationDrawer/__tests__/NotificationDrawerGroupList.test.tsx +13 -15
- package/src/components/NotificationDrawer/__tests__/NotificationDrawerHeader.test.tsx +25 -27
- package/src/components/NotificationDrawer/__tests__/NotificationDrawerList.test.tsx +17 -19
- package/src/components/NotificationDrawer/__tests__/NotificationDrawerListItem.test.tsx +20 -27
- package/src/components/NotificationDrawer/__tests__/NotificationDrawerListItemBody.test.tsx +17 -13
- package/src/components/NotificationDrawer/__tests__/NotificationDrawerListItemHeader.test.tsx +30 -25
- package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawer.test.tsx.snap +3 -5
- package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawerBody.test.tsx.snap +3 -5
- package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawerGroup.test.tsx.snap +9 -11
- package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawerGroupList.test.tsx.snap +3 -5
- package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawerHeader.test.tsx.snap +16 -18
- package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawerList.test.tsx.snap +7 -8
- package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawerListItem.test.tsx.snap +3 -5
- package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawerListItemBody.test.tsx.snap +6 -8
- package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawerListItemHeader.test.tsx.snap +12 -14
- package/src/components/NumberInput/NumberInput.tsx +4 -0
- package/src/components/NumberInput/examples/NumberInput.md +8 -0
- package/src/components/OverflowMenu/__tests__/OverflowMenu.test.tsx +15 -12
- package/src/components/OverflowMenu/__tests__/OverflowMenuControl.test.tsx +9 -8
- package/src/components/OverflowMenu/__tests__/OverflowMenuGroup.test.tsx +17 -18
- package/src/components/OverflowMenu/__tests__/OverflowMenuItem.test.tsx +10 -9
- package/src/components/OverflowMenu/__tests__/__snapshots__/OverflowMenu.test.tsx.snap +6 -16
- package/src/components/OverflowMenu/__tests__/__snapshots__/OverflowMenuControl.test.tsx.snap +3 -15
- package/src/components/OverflowMenu/__tests__/__snapshots__/OverflowMenuItem.test.tsx.snap +3 -17
- package/src/components/Modal/__tests__/__snapshots__/ModalBoxCloseButton.test.tsx.snap +0 -16
- package/src/components/OverflowMenu/__tests__/__snapshots__/OverflowMenuGroup.test.tsx.snap +0 -33
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
|
|
6
|
+
import { Nav, NavContext } from '../Nav';
|
|
4
7
|
import { NavList } from '../NavList';
|
|
5
8
|
import { NavGroup } from '../NavGroup';
|
|
6
9
|
import { NavItem } from '../NavItem';
|
|
@@ -15,250 +18,218 @@ const props = {
|
|
|
15
18
|
]
|
|
16
19
|
};
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
window.location.hash = '#link1';
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const context = {
|
|
24
|
-
onSelect: () => undefined as any,
|
|
25
|
-
onToggle: () => undefined as any
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
test('Default Nav List', () => {
|
|
29
|
-
const view = mount(
|
|
30
|
-
<Nav className="test=nav-class">
|
|
31
|
-
<NavList className="test-nav-list-class">
|
|
32
|
-
{props.items.map(item => (
|
|
33
|
-
<NavItem to={item.to} key={item.to} className="test-nav-item-class">
|
|
34
|
-
{item.label}
|
|
35
|
-
</NavItem>
|
|
36
|
-
))}
|
|
37
|
-
</NavList>
|
|
38
|
-
</Nav>,
|
|
39
|
-
{ context }
|
|
40
|
-
);
|
|
41
|
-
expect(view).toMatchSnapshot();
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test('Dark Nav List', () => {
|
|
45
|
-
const view = mount(
|
|
46
|
-
<Nav className="test=nav-class" theme="dark">
|
|
47
|
-
<NavList className="test-nav-list-class">
|
|
48
|
-
{props.items.map(item => (
|
|
49
|
-
<NavItem to={item.to} key={item.to} className="test-nav-item-class">
|
|
50
|
-
{item.label}
|
|
51
|
-
</NavItem>
|
|
52
|
-
))}
|
|
53
|
-
</NavList>
|
|
54
|
-
</Nav>,
|
|
55
|
-
{ context }
|
|
56
|
-
);
|
|
57
|
-
expect(view).toMatchSnapshot();
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
test('Default Nav List - Trigger item active update', () => {
|
|
61
|
-
window.location.hash = '#link2';
|
|
62
|
-
const view = mount(
|
|
63
|
-
<Nav>
|
|
64
|
-
<NavList>
|
|
65
|
-
{props.items.map(item => (
|
|
66
|
-
<NavItem to={item.to} key={item.to}>
|
|
67
|
-
{item.label}
|
|
68
|
-
</NavItem>
|
|
69
|
-
))}
|
|
70
|
-
</NavList>
|
|
71
|
-
</Nav>,
|
|
72
|
-
{ context }
|
|
73
|
-
);
|
|
74
|
-
view
|
|
75
|
-
.find({ href: '#link2' })
|
|
76
|
-
.first()
|
|
77
|
-
.simulate('click');
|
|
78
|
-
expect(view).toMatchSnapshot();
|
|
79
|
-
});
|
|
21
|
+
const renderNav = (ui: React.ReactElement<any, string | React.JSXElementConstructor<any>>) =>
|
|
22
|
+
render(<NavContext.Provider value={{ onSelect: jest.fn(), onToggle: jest.fn() }}>{ui}</NavContext.Provider>);
|
|
80
23
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
{props.items.map(item => (
|
|
86
|
-
<NavItem to={item.to} key={item.to}>
|
|
87
|
-
{item.label}
|
|
88
|
-
</NavItem>
|
|
89
|
-
))}
|
|
90
|
-
</NavList>
|
|
91
|
-
</Nav>,
|
|
92
|
-
{ context }
|
|
93
|
-
);
|
|
94
|
-
expect(view).toMatchSnapshot();
|
|
95
|
-
});
|
|
24
|
+
describe('Nav', () => {
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
window.location.hash = '#link1';
|
|
27
|
+
});
|
|
96
28
|
|
|
97
|
-
test('
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
<NavExpandable id="grp-1" title="Section 1">
|
|
29
|
+
test('Default Nav List', () => {
|
|
30
|
+
const { asFragment } = renderNav(
|
|
31
|
+
<Nav className="test-nav-class">
|
|
32
|
+
<NavList className="test-nav-list-class">
|
|
102
33
|
{props.items.map(item => (
|
|
103
|
-
<NavItem to={item.to} key={item.to}>
|
|
34
|
+
<NavItem to={item.to} key={item.to} className="test-nav-item-class">
|
|
104
35
|
{item.label}
|
|
105
36
|
</NavItem>
|
|
106
37
|
))}
|
|
107
|
-
</
|
|
108
|
-
</
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const view = mount(
|
|
118
|
-
<Nav>
|
|
119
|
-
<NavList>
|
|
120
|
-
<NavExpandable id="grp-1" title="Section 1" onExpand={onExpandSpy}>
|
|
38
|
+
</NavList>
|
|
39
|
+
</Nav>
|
|
40
|
+
);
|
|
41
|
+
expect(asFragment()).toMatchSnapshot();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('Dark Nav List', () => {
|
|
45
|
+
const { asFragment } = renderNav(
|
|
46
|
+
<Nav className="test=nav-class" theme="dark">
|
|
47
|
+
<NavList className="test-nav-list-class">
|
|
121
48
|
{props.items.map(item => (
|
|
122
|
-
<NavItem to={item.to} key={item.to}>
|
|
49
|
+
<NavItem to={item.to} key={item.to} className="test-nav-item-class">
|
|
123
50
|
{item.label}
|
|
124
51
|
</NavItem>
|
|
125
52
|
))}
|
|
126
|
-
</
|
|
127
|
-
</
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
test('Expandable Nav List - Trigger toggle', () => {
|
|
137
|
-
window.location.hash = '#link2';
|
|
138
|
-
const view = mount(
|
|
139
|
-
<Nav>
|
|
140
|
-
<NavList>
|
|
141
|
-
<NavExpandable id="grp-1" title="Section 1" className="expandable-group" isExpanded>
|
|
53
|
+
</NavList>
|
|
54
|
+
</Nav>
|
|
55
|
+
);
|
|
56
|
+
expect(asFragment()).toMatchSnapshot();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('Default Nav List - Trigger item active update', () => {
|
|
60
|
+
const { asFragment } = renderNav(
|
|
61
|
+
<Nav>
|
|
62
|
+
<NavList>
|
|
142
63
|
{props.items.map(item => (
|
|
143
64
|
<NavItem to={item.to} key={item.to}>
|
|
144
65
|
{item.label}
|
|
145
66
|
</NavItem>
|
|
146
67
|
))}
|
|
147
|
-
</
|
|
148
|
-
</
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
68
|
+
</NavList>
|
|
69
|
+
</Nav>
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
userEvent.click(screen.getByText('Link 2'));
|
|
73
|
+
expect(asFragment()).toMatchSnapshot();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('Expandable Nav List', () => {
|
|
77
|
+
const { asFragment } = renderNav(
|
|
78
|
+
<Nav>
|
|
79
|
+
<NavList>
|
|
80
|
+
<NavExpandable id="grp-1" title="Section 1">
|
|
81
|
+
{props.items.map(item => (
|
|
82
|
+
<NavItem to={item.to} key={item.to}>
|
|
83
|
+
{item.label}
|
|
84
|
+
</NavItem>
|
|
85
|
+
))}
|
|
86
|
+
</NavExpandable>
|
|
87
|
+
</NavList>
|
|
88
|
+
</Nav>
|
|
89
|
+
);
|
|
90
|
+
expect(asFragment()).toMatchSnapshot();
|
|
91
|
+
});
|
|
158
92
|
|
|
159
|
-
test('Expandable Nav
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
93
|
+
test('Expandable Nav verify onExpand', () => {
|
|
94
|
+
const onExpand = jest.fn();
|
|
95
|
+
|
|
96
|
+
renderNav(
|
|
97
|
+
<Nav>
|
|
98
|
+
<NavList>
|
|
99
|
+
<NavExpandable id="grp-1" title="Section 1" onExpand={onExpand}>
|
|
100
|
+
{props.items.map(item => (
|
|
101
|
+
<NavItem to={item.to} key={item.to}>
|
|
102
|
+
{item.label}
|
|
103
|
+
</NavItem>
|
|
104
|
+
))}
|
|
105
|
+
</NavExpandable>
|
|
106
|
+
</NavList>
|
|
107
|
+
</Nav>
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
userEvent.click(screen.getByRole('button'));
|
|
111
|
+
expect(onExpand).toBeCalled();
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test('Expandable Nav List - Trigger toggle', () => {
|
|
115
|
+
window.location.hash = '#link2';
|
|
116
|
+
|
|
117
|
+
const { asFragment } = renderNav(
|
|
118
|
+
<Nav>
|
|
119
|
+
<NavList>
|
|
120
|
+
<NavExpandable id="grp-1" title="Section 1" className="expandable-group" isExpanded>
|
|
121
|
+
{props.items.map(item => (
|
|
122
|
+
<NavItem to={item.to} key={item.to}>
|
|
123
|
+
{item.label}
|
|
124
|
+
</NavItem>
|
|
125
|
+
))}
|
|
126
|
+
</NavExpandable>
|
|
127
|
+
</NavList>
|
|
128
|
+
</Nav>
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
userEvent.click(screen.getByText('Section 1'));
|
|
132
|
+
expect(asFragment()).toMatchSnapshot();
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
test('Expandable Nav List with aria label', () => {
|
|
136
|
+
const { asFragment } = renderNav(
|
|
137
|
+
<Nav aria-label="Test">
|
|
138
|
+
<NavList>
|
|
139
|
+
<NavExpandable id="grp-1" title="Section 1" srText="Section 1 - Example sub-navigation">
|
|
140
|
+
{props.items.map(item => (
|
|
141
|
+
<NavItem to={item.to} key={item.to}>
|
|
142
|
+
{item.label}
|
|
143
|
+
</NavItem>
|
|
144
|
+
))}
|
|
145
|
+
</NavExpandable>
|
|
146
|
+
</NavList>
|
|
147
|
+
</Nav>
|
|
148
|
+
);
|
|
149
|
+
expect(asFragment()).toMatchSnapshot();
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
test('Nav Grouped List', () => {
|
|
153
|
+
const { asFragment } = renderNav(
|
|
154
|
+
<Nav>
|
|
155
|
+
<NavGroup id="grp-1" title="Section 1">
|
|
156
|
+
<NavList>
|
|
157
|
+
{props.items.map(item => (
|
|
158
|
+
<NavItem to={item.to} key={`section1_${item.to}`}>
|
|
159
|
+
{item.label}
|
|
160
|
+
</NavItem>
|
|
161
|
+
))}
|
|
162
|
+
</NavList>
|
|
163
|
+
</NavGroup>
|
|
164
|
+
<NavGroup id="grp-2" title="Section 2">
|
|
165
|
+
<NavList>
|
|
166
|
+
{props.items.map(item => (
|
|
167
|
+
<NavItem to={item.to} key={`section2_${item.to}`}>
|
|
168
|
+
{item.label}
|
|
169
|
+
</NavItem>
|
|
170
|
+
))}
|
|
171
|
+
</NavList>
|
|
172
|
+
</NavGroup>
|
|
173
|
+
</Nav>
|
|
174
|
+
);
|
|
175
|
+
expect(asFragment()).toMatchSnapshot();
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
test('Horizontal Nav List', () => {
|
|
179
|
+
const { asFragment } = renderNav(
|
|
180
|
+
<Nav variant="horizontal">
|
|
181
|
+
<NavList>
|
|
164
182
|
{props.items.map(item => (
|
|
165
183
|
<NavItem to={item.to} key={item.to}>
|
|
166
184
|
{item.label}
|
|
167
185
|
</NavItem>
|
|
168
186
|
))}
|
|
169
|
-
</
|
|
170
|
-
</
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
);
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const view = mount(
|
|
179
|
-
<Nav>
|
|
180
|
-
<NavGroup id="grp-1" title="Section 1">
|
|
187
|
+
</NavList>
|
|
188
|
+
</Nav>
|
|
189
|
+
);
|
|
190
|
+
expect(asFragment()).toMatchSnapshot();
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
test('Horizontal SubNav List', () => {
|
|
194
|
+
const { asFragment } = renderNav(
|
|
195
|
+
<Nav variant="horizontal-subnav">
|
|
181
196
|
<NavList>
|
|
182
197
|
{props.items.map(item => (
|
|
183
|
-
<NavItem to={item.to} key={
|
|
198
|
+
<NavItem to={item.to} key={item.to}>
|
|
184
199
|
{item.label}
|
|
185
200
|
</NavItem>
|
|
186
201
|
))}
|
|
187
202
|
</NavList>
|
|
188
|
-
</
|
|
189
|
-
|
|
203
|
+
</Nav>
|
|
204
|
+
);
|
|
205
|
+
expect(asFragment()).toMatchSnapshot();
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
test('Tertiary Nav List', () => {
|
|
209
|
+
const { asFragment } = renderNav(
|
|
210
|
+
<Nav variant="tertiary">
|
|
190
211
|
<NavList>
|
|
191
212
|
{props.items.map(item => (
|
|
192
|
-
<NavItem to={item.to} key={
|
|
213
|
+
<NavItem to={item.to} key={item.to}>
|
|
193
214
|
{item.label}
|
|
194
215
|
</NavItem>
|
|
195
216
|
))}
|
|
196
217
|
</NavList>
|
|
197
|
-
</
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
);
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
{props.items.map(item => (
|
|
209
|
-
<NavItem to={item.to} key={item.to}>
|
|
210
|
-
{item.label}
|
|
211
|
-
</NavItem>
|
|
212
|
-
))}
|
|
213
|
-
</NavList>
|
|
214
|
-
</Nav>,
|
|
215
|
-
{ context }
|
|
216
|
-
);
|
|
217
|
-
expect(view).toMatchSnapshot();
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
test('Horizontal SubNav List', () => {
|
|
221
|
-
const view = mount(
|
|
222
|
-
<Nav variant="horizontal-subnav">
|
|
223
|
-
<NavList>
|
|
224
|
-
{props.items.map(item => (
|
|
225
|
-
<NavItem to={item.to} key={item.to}>
|
|
226
|
-
{item.label}
|
|
227
|
-
</NavItem>
|
|
228
|
-
))}
|
|
229
|
-
</NavList>
|
|
230
|
-
</Nav>,
|
|
231
|
-
{ context }
|
|
232
|
-
);
|
|
233
|
-
expect(view).toMatchSnapshot();
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
test('Tertiary Nav List', () => {
|
|
237
|
-
const view = mount(
|
|
238
|
-
<Nav variant="tertiary">
|
|
239
|
-
<NavList>
|
|
240
|
-
{props.items.map(item => (
|
|
241
|
-
<NavItem to={item.to} key={item.to}>
|
|
242
|
-
{item.label}
|
|
218
|
+
</Nav>
|
|
219
|
+
);
|
|
220
|
+
expect(asFragment()).toMatchSnapshot();
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
test('Nav List with custom item nodes', () => {
|
|
224
|
+
const { asFragment } = renderNav(
|
|
225
|
+
<Nav variant="tertiary">
|
|
226
|
+
<NavList>
|
|
227
|
+
<NavItem to="/components/nav#link1" className="test-nav-item-class">
|
|
228
|
+
<div className="my-custom-node">My custom node</div>
|
|
243
229
|
</NavItem>
|
|
244
|
-
|
|
245
|
-
</
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
);
|
|
249
|
-
expect(view).toMatchSnapshot();
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
test('Nav List with custom item nodes', () => {
|
|
253
|
-
const view = mount(
|
|
254
|
-
<Nav variant="tertiary">
|
|
255
|
-
<NavList>
|
|
256
|
-
<NavItem to="/components/nav#link1" className="test-nav-item-class">
|
|
257
|
-
<div className="my-custom-node">My custom node</div>
|
|
258
|
-
</NavItem>
|
|
259
|
-
</NavList>
|
|
260
|
-
</Nav>,
|
|
261
|
-
{ context }
|
|
262
|
-
);
|
|
263
|
-
expect(view).toMatchSnapshot();
|
|
230
|
+
</NavList>
|
|
231
|
+
</Nav>
|
|
232
|
+
);
|
|
233
|
+
expect(asFragment()).toMatchSnapshot();
|
|
234
|
+
});
|
|
264
235
|
});
|