@patternfly/react-core 4.202.15 → 4.202.18
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/package.json +5 -5
- 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/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/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
|
@@ -6,96 +6,43 @@ propComponents: ['Divider']
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
## Examples
|
|
9
|
+
|
|
9
10
|
### Using hr
|
|
10
|
-
```js
|
|
11
|
-
import React from 'react';
|
|
12
|
-
import { Divider } from '@patternfly/react-core';
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
```ts file='./DividerUsingHr.tsx'
|
|
15
13
|
```
|
|
16
14
|
|
|
17
15
|
### Using li
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import { Divider } from '@patternfly/react-core/dist';
|
|
21
|
-
|
|
22
|
-
<ul>
|
|
23
|
-
<li>List item one</li>
|
|
24
|
-
<Divider component="li"/>
|
|
25
|
-
<li>List item two</li>
|
|
26
|
-
</ul>
|
|
16
|
+
|
|
17
|
+
```ts file='./DividerUsingLi.tsx'
|
|
27
18
|
```
|
|
28
19
|
|
|
29
20
|
### Using div
|
|
30
|
-
```js
|
|
31
|
-
import React from 'react';
|
|
32
|
-
import { Divider } from '@patternfly/react-core';
|
|
33
21
|
|
|
34
|
-
|
|
22
|
+
```ts file='./DividerUsingDiv.tsx'
|
|
35
23
|
```
|
|
36
24
|
|
|
37
25
|
### Inset medium
|
|
38
|
-
```js
|
|
39
|
-
import React from 'react';
|
|
40
|
-
import { Divider } from '@patternfly/react-core';
|
|
41
26
|
|
|
42
|
-
|
|
27
|
+
```ts file='./DividerInsetMedium.tsx'
|
|
43
28
|
```
|
|
44
29
|
|
|
45
30
|
### Inset at various breakpoints
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
import { Divider } from '@patternfly/react-core';
|
|
49
|
-
|
|
50
|
-
<Divider
|
|
51
|
-
inset={{
|
|
52
|
-
default: 'insetMd',
|
|
53
|
-
md: 'insetNone',
|
|
54
|
-
lg: 'inset3xl',
|
|
55
|
-
xl: 'insetLg'
|
|
56
|
-
}}
|
|
57
|
-
/>
|
|
31
|
+
|
|
32
|
+
```ts file='./DividerInsetVariousBreakpoints.tsx'
|
|
58
33
|
```
|
|
59
34
|
|
|
60
35
|
### Vertical in flex layout
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
import { Divider, Flex, FlexItem } from '@patternfly/react-core';
|
|
64
|
-
|
|
65
|
-
<Flex>
|
|
66
|
-
<FlexItem>first item</FlexItem>
|
|
67
|
-
<Divider isVertical/>
|
|
68
|
-
<FlexItem>second item</FlexItem>
|
|
69
|
-
</Flex>
|
|
36
|
+
|
|
37
|
+
```ts file='./DividerVerticalFlex.tsx'
|
|
70
38
|
```
|
|
71
39
|
|
|
72
|
-
### Vertical
|
|
73
|
-
```js
|
|
74
|
-
import React from 'react';
|
|
75
|
-
import { Divider, Flex, FlexItem } from '@patternfly/react-core';
|
|
40
|
+
### Vertical in flex layout, inset medium
|
|
76
41
|
|
|
77
|
-
|
|
78
|
-
<FlexItem>first item</FlexItem>
|
|
79
|
-
<Divider isVertical inset={{default: 'insetMd'}}/>
|
|
80
|
-
<FlexItem>second item</FlexItem>
|
|
81
|
-
</Flex>
|
|
42
|
+
```ts file='./DividerVerticalFlexInsetMedium.tsx'
|
|
82
43
|
```
|
|
83
44
|
|
|
84
|
-
### Vertical, inset at various breakpoints
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
import { Divider, Flex, FlexItem } from '@patternfly/react-core';
|
|
88
|
-
|
|
89
|
-
<Flex>
|
|
90
|
-
<FlexItem>first item</FlexItem>
|
|
91
|
-
<Divider isVertical
|
|
92
|
-
inset={{
|
|
93
|
-
default: 'insetMd',
|
|
94
|
-
md: 'insetNone',
|
|
95
|
-
lg: 'insetSm',
|
|
96
|
-
xl: 'insetXs'
|
|
97
|
-
}}
|
|
98
|
-
/>
|
|
99
|
-
<FlexItem>first item</FlexItem>
|
|
100
|
-
</Flex>
|
|
45
|
+
### Vertical in flex layout, inset at various breakpoints
|
|
46
|
+
|
|
47
|
+
```ts file='./DividerVerticalFlexInsetVariousBreakpoints.tsx'
|
|
101
48
|
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Divider } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const DividerInsetVariousBreakpoints: React.FunctionComponent = () => (
|
|
5
|
+
<Divider
|
|
6
|
+
inset={{
|
|
7
|
+
default: 'insetMd',
|
|
8
|
+
md: 'insetNone',
|
|
9
|
+
lg: 'inset3xl',
|
|
10
|
+
xl: 'insetLg'
|
|
11
|
+
}}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Divider, Flex, FlexItem } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const DividerVerticalFlex: React.FunctionComponent = () => (
|
|
5
|
+
<Flex>
|
|
6
|
+
<FlexItem>first item</FlexItem>
|
|
7
|
+
<Divider isVertical />
|
|
8
|
+
<FlexItem>second item</FlexItem>
|
|
9
|
+
</Flex>
|
|
10
|
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Divider, Flex, FlexItem } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const DividerVerticalFlexInsetMedium: React.FunctionComponent = () => (
|
|
5
|
+
<Flex>
|
|
6
|
+
<FlexItem>first item</FlexItem>
|
|
7
|
+
<Divider isVertical inset={{ default: 'insetMd' }} />
|
|
8
|
+
<FlexItem>second item</FlexItem>
|
|
9
|
+
</Flex>
|
|
10
|
+
);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Divider, Flex, FlexItem } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const DividerVerticalFlexInsetVariousBreakpoints: React.FunctionComponent = () => (
|
|
5
|
+
<Flex>
|
|
6
|
+
<FlexItem>first item</FlexItem>
|
|
7
|
+
<Divider
|
|
8
|
+
isVertical
|
|
9
|
+
inset={{
|
|
10
|
+
default: 'insetMd',
|
|
11
|
+
md: 'insetNone',
|
|
12
|
+
lg: 'insetSm',
|
|
13
|
+
xl: 'insetXs'
|
|
14
|
+
}}
|
|
15
|
+
/>
|
|
16
|
+
<FlexItem>first item</FlexItem>
|
|
17
|
+
</Flex>
|
|
18
|
+
);
|
|
@@ -4,7 +4,6 @@ import { render, screen } from '@testing-library/react';
|
|
|
4
4
|
import userEvent from '@testing-library/user-event';
|
|
5
5
|
import '@testing-library/jest-dom';
|
|
6
6
|
|
|
7
|
-
import { Form } from '../../Form';
|
|
8
7
|
import { FormSelect } from '../FormSelect';
|
|
9
8
|
import { FormSelectOption } from '../FormSelectOption';
|
|
10
9
|
import { FormSelectOptionGroup } from '../FormSelectOptionGroup';
|
|
@@ -1,120 +1,120 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
|
+
|
|
6
6
|
import BookOpen from '@patternfly/react-icons/dist/esm/icons/book-open-icon';
|
|
7
7
|
import Key from '@patternfly/react-icons/dist/esm/icons/key-icon';
|
|
8
8
|
import Desktop from '@patternfly/react-icons/dist/esm/icons/desktop-icon';
|
|
9
|
+
import { List, ListVariant, ListComponent, OrderType } from '../List';
|
|
10
|
+
import { ListItem } from '../ListItem';
|
|
9
11
|
|
|
10
12
|
const ListItems = () => (
|
|
11
|
-
<
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
</List>
|
|
17
|
-
</React.Fragment>
|
|
13
|
+
<List>
|
|
14
|
+
<ListItem>First</ListItem>
|
|
15
|
+
<ListItem>Second</ListItem>
|
|
16
|
+
<ListItem>Third</ListItem>
|
|
17
|
+
</List>
|
|
18
18
|
);
|
|
19
19
|
|
|
20
|
-
describe('
|
|
20
|
+
describe('List', () => {
|
|
21
21
|
test('simple list', () => {
|
|
22
|
-
const
|
|
22
|
+
const { asFragment } = render(
|
|
23
23
|
<List>
|
|
24
24
|
<ListItems />
|
|
25
25
|
</List>
|
|
26
26
|
);
|
|
27
|
-
expect(
|
|
27
|
+
expect(asFragment()).toMatchSnapshot();
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
test('inline list', () => {
|
|
31
|
-
const
|
|
31
|
+
const { asFragment } = render(
|
|
32
32
|
<List variant={ListVariant.inline}>
|
|
33
33
|
<ListItems />
|
|
34
34
|
</List>
|
|
35
35
|
);
|
|
36
|
-
expect(
|
|
36
|
+
expect(asFragment()).toMatchSnapshot();
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
test('ordered list', () => {
|
|
40
|
-
const
|
|
40
|
+
const { asFragment } = render(
|
|
41
41
|
<List component={ListComponent.ol}>
|
|
42
42
|
<ListItem>Apple</ListItem>
|
|
43
43
|
<ListItem>Banana</ListItem>
|
|
44
44
|
<ListItem>Orange</ListItem>
|
|
45
45
|
</List>
|
|
46
46
|
);
|
|
47
|
-
expect(
|
|
47
|
+
expect(asFragment()).toMatchSnapshot();
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
test('ordered list starts with 2nd item', () => {
|
|
51
|
-
|
|
51
|
+
render(
|
|
52
52
|
<List component={ListComponent.ol} start={2}>
|
|
53
53
|
<ListItem>Banana</ListItem>
|
|
54
54
|
<ListItem>Orange</ListItem>
|
|
55
55
|
</List>
|
|
56
56
|
);
|
|
57
|
-
expect(
|
|
57
|
+
expect(screen.getByRole('list')).toHaveAttribute('start', '2');
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
test('ordered list items will be numbered with uppercase letters', () => {
|
|
61
|
-
|
|
61
|
+
render(
|
|
62
62
|
<List component={ListComponent.ol} type={OrderType.uppercaseLetter}>
|
|
63
63
|
<ListItem>Banana</ListItem>
|
|
64
64
|
<ListItem>Orange</ListItem>
|
|
65
65
|
</List>
|
|
66
66
|
);
|
|
67
|
-
expect(
|
|
67
|
+
expect(screen.getByRole('list')).toHaveAttribute('type', 'A');
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
test('inlined ordered list', () => {
|
|
71
|
-
|
|
71
|
+
render(
|
|
72
72
|
<List variant={ListVariant.inline} component={ListComponent.ol}>
|
|
73
73
|
<ListItem>Apple</ListItem>
|
|
74
74
|
<ListItem>Banana</ListItem>
|
|
75
75
|
<ListItem>Orange</ListItem>
|
|
76
76
|
</List>
|
|
77
77
|
);
|
|
78
|
-
expect(
|
|
78
|
+
expect(screen.getByRole('list')).toHaveClass('pf-m-inline');
|
|
79
79
|
});
|
|
80
80
|
|
|
81
81
|
test('bordered list', () => {
|
|
82
|
-
|
|
82
|
+
render(
|
|
83
83
|
<List isBordered>
|
|
84
84
|
<ListItems />
|
|
85
85
|
</List>
|
|
86
86
|
);
|
|
87
|
-
expect(
|
|
87
|
+
expect(screen.getAllByRole('list')[0]).toHaveClass('pf-m-bordered');
|
|
88
88
|
});
|
|
89
89
|
|
|
90
90
|
test('plain list', () => {
|
|
91
|
-
|
|
91
|
+
render(
|
|
92
92
|
<List isPlain>
|
|
93
93
|
<ListItems />
|
|
94
94
|
</List>
|
|
95
95
|
);
|
|
96
|
-
expect(
|
|
96
|
+
expect(screen.getAllByRole('list')[0]).toHaveClass('pf-m-plain');
|
|
97
97
|
});
|
|
98
98
|
|
|
99
99
|
test('icon list', () => {
|
|
100
|
-
const
|
|
100
|
+
const { asFragment } = render(
|
|
101
101
|
<List isPlain>
|
|
102
102
|
<ListItem icon={<BookOpen />}>Apple</ListItem>
|
|
103
103
|
<ListItem icon={<Key />}>Banana</ListItem>
|
|
104
104
|
<ListItem icon={<Desktop />}>Orange</ListItem>
|
|
105
105
|
</List>
|
|
106
106
|
);
|
|
107
|
-
expect(
|
|
107
|
+
expect(asFragment()).toMatchSnapshot();
|
|
108
108
|
});
|
|
109
109
|
|
|
110
110
|
test('icon large list', () => {
|
|
111
|
-
const
|
|
112
|
-
<List iconSize=
|
|
111
|
+
const { asFragment } = render(
|
|
112
|
+
<List iconSize="large">
|
|
113
113
|
<ListItem icon={<BookOpen />}>Apple</ListItem>
|
|
114
114
|
<ListItem icon={<Key />}>Banana</ListItem>
|
|
115
115
|
<ListItem icon={<Desktop />}>Orange</ListItem>
|
|
116
116
|
</List>
|
|
117
117
|
);
|
|
118
|
-
expect(
|
|
118
|
+
expect(asFragment()).toMatchSnapshot();
|
|
119
119
|
});
|
|
120
120
|
});
|
|
@@ -1,35 +1,7 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
4
|
-
<
|
|
5
|
-
<ul
|
|
6
|
-
class="pf-c-list pf-m-bordered"
|
|
7
|
-
>
|
|
8
|
-
<ul
|
|
9
|
-
class="pf-c-list"
|
|
10
|
-
>
|
|
11
|
-
<li
|
|
12
|
-
class=""
|
|
13
|
-
>
|
|
14
|
-
First
|
|
15
|
-
</li>
|
|
16
|
-
<li
|
|
17
|
-
class=""
|
|
18
|
-
>
|
|
19
|
-
Second
|
|
20
|
-
</li>
|
|
21
|
-
<li
|
|
22
|
-
class=""
|
|
23
|
-
>
|
|
24
|
-
Third
|
|
25
|
-
</li>
|
|
26
|
-
</ul>
|
|
27
|
-
</ul>
|
|
28
|
-
</div>
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
exports[`list icon large list 1`] = `
|
|
32
|
-
<div>
|
|
3
|
+
exports[`List icon large list 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
33
5
|
<ul
|
|
34
6
|
class="pf-c-list pf-m-icon-lg"
|
|
35
7
|
>
|
|
@@ -100,11 +72,11 @@ exports[`list icon large list 1`] = `
|
|
|
100
72
|
Orange
|
|
101
73
|
</li>
|
|
102
74
|
</ul>
|
|
103
|
-
</
|
|
75
|
+
</DocumentFragment>
|
|
104
76
|
`;
|
|
105
77
|
|
|
106
|
-
exports[`
|
|
107
|
-
<
|
|
78
|
+
exports[`List icon list 1`] = `
|
|
79
|
+
<DocumentFragment>
|
|
108
80
|
<ul
|
|
109
81
|
class="pf-c-list pf-m-plain"
|
|
110
82
|
>
|
|
@@ -175,11 +147,11 @@ exports[`list icon list 1`] = `
|
|
|
175
147
|
Orange
|
|
176
148
|
</li>
|
|
177
149
|
</ul>
|
|
178
|
-
</
|
|
150
|
+
</DocumentFragment>
|
|
179
151
|
`;
|
|
180
152
|
|
|
181
|
-
exports[`
|
|
182
|
-
<
|
|
153
|
+
exports[`List inline list 1`] = `
|
|
154
|
+
<DocumentFragment>
|
|
183
155
|
<ul
|
|
184
156
|
class="pf-c-list pf-m-inline"
|
|
185
157
|
>
|
|
@@ -203,39 +175,36 @@ exports[`list inline list 1`] = `
|
|
|
203
175
|
</li>
|
|
204
176
|
</ul>
|
|
205
177
|
</ul>
|
|
206
|
-
</
|
|
178
|
+
</DocumentFragment>
|
|
207
179
|
`;
|
|
208
180
|
|
|
209
|
-
exports[`
|
|
210
|
-
<
|
|
211
|
-
<
|
|
212
|
-
class="pf-c-list
|
|
181
|
+
exports[`List ordered list 1`] = `
|
|
182
|
+
<DocumentFragment>
|
|
183
|
+
<ol
|
|
184
|
+
class="pf-c-list"
|
|
185
|
+
type="1"
|
|
213
186
|
>
|
|
214
|
-
<
|
|
215
|
-
class="
|
|
187
|
+
<li
|
|
188
|
+
class=""
|
|
216
189
|
>
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
</li>
|
|
232
|
-
</ul>
|
|
233
|
-
</ul>
|
|
234
|
-
</div>
|
|
190
|
+
Apple
|
|
191
|
+
</li>
|
|
192
|
+
<li
|
|
193
|
+
class=""
|
|
194
|
+
>
|
|
195
|
+
Banana
|
|
196
|
+
</li>
|
|
197
|
+
<li
|
|
198
|
+
class=""
|
|
199
|
+
>
|
|
200
|
+
Orange
|
|
201
|
+
</li>
|
|
202
|
+
</ol>
|
|
203
|
+
</DocumentFragment>
|
|
235
204
|
`;
|
|
236
205
|
|
|
237
|
-
exports[`
|
|
238
|
-
<
|
|
206
|
+
exports[`List simple list 1`] = `
|
|
207
|
+
<DocumentFragment>
|
|
239
208
|
<ul
|
|
240
209
|
class="pf-c-list"
|
|
241
210
|
>
|
|
@@ -259,5 +228,5 @@ exports[`list simple list 1`] = `
|
|
|
259
228
|
</li>
|
|
260
229
|
</ul>
|
|
261
230
|
</ul>
|
|
262
|
-
</
|
|
231
|
+
</DocumentFragment>
|
|
263
232
|
`;
|
|
@@ -1,46 +1,50 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import "@testing-library/jest-dom";
|
|
5
|
+
|
|
4
6
|
import { Menu } from '../Menu';
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
describe('Menu', () => {
|
|
9
|
+
test('should render Menu successfully', () => {
|
|
10
|
+
const { asFragment } = render(
|
|
11
|
+
<Menu activeItemId={0} onSelect={jest.fn()}>
|
|
12
|
+
content
|
|
13
|
+
</Menu>
|
|
11
14
|
);
|
|
12
|
-
expect(
|
|
13
|
-
});
|
|
15
|
+
expect(asFragment()).toMatchSnapshot();
|
|
16
|
+
});
|
|
14
17
|
|
|
15
|
-
describe('with isPlain', () => {
|
|
18
|
+
describe('with isPlain', () => {
|
|
16
19
|
test('should render Menu with plain styles applied', () => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
render(
|
|
21
|
+
<Menu activeItemId={0} onSelect={jest.fn()} isPlain>
|
|
22
|
+
content
|
|
23
|
+
</Menu>
|
|
24
|
+
);
|
|
25
|
+
expect(screen.getByText('content')).toHaveClass('pf-m-plain');
|
|
23
26
|
});
|
|
24
|
-
});
|
|
27
|
+
});
|
|
25
28
|
|
|
26
|
-
describe('with isScrollable', () => {
|
|
29
|
+
describe('with isScrollable', () => {
|
|
27
30
|
test('should render Menu with scrollable styles applied', () => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
render(
|
|
32
|
+
<Menu activeItemId={0} onSelect={jest.fn()} isScrollable>
|
|
33
|
+
content
|
|
34
|
+
</Menu>
|
|
35
|
+
);
|
|
36
|
+
expect(screen.getByText('content')).toHaveClass('pf-m-scrollable');
|
|
34
37
|
});
|
|
35
|
-
});
|
|
38
|
+
});
|
|
36
39
|
|
|
37
|
-
describe('with isNavFlyout', () => {
|
|
40
|
+
describe('with isNavFlyout', () => {
|
|
38
41
|
test('should render Menu with nav flyout styles applied', () => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
render(
|
|
43
|
+
<Menu activeItemId={0} onSelect={jest.fn()} isNavFlyout>
|
|
44
|
+
content
|
|
45
|
+
</Menu>
|
|
46
|
+
);
|
|
47
|
+
expect(screen.getByText('content')).toHaveClass('pf-m-nav');
|
|
45
48
|
});
|
|
46
|
-
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`should render Menu successfully 1`] = `
|
|
4
|
-
<
|
|
3
|
+
exports[`Menu should render Menu successfully 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
6
|
class="pf-c-menu"
|
|
7
7
|
data-ouia-component-id="OUIA-Generated-Menu-1"
|
|
@@ -10,38 +10,5 @@ exports[`should render Menu successfully 1`] = `
|
|
|
10
10
|
>
|
|
11
11
|
content
|
|
12
12
|
</div>
|
|
13
|
-
</
|
|
14
|
-
`;
|
|
15
|
-
|
|
16
|
-
exports[`with isNavFlyout should render Menu with nav flyout styles applied 1`] = `
|
|
17
|
-
<div
|
|
18
|
-
className="pf-c-menu pf-m-nav"
|
|
19
|
-
data-ouia-component-id="OUIA-Generated-Menu-4"
|
|
20
|
-
data-ouia-component-type="PF4/Menu"
|
|
21
|
-
data-ouia-safe={true}
|
|
22
|
-
>
|
|
23
|
-
content
|
|
24
|
-
</div>
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
exports[`with isPlain should render Menu with plain styles applied 1`] = `
|
|
28
|
-
<div
|
|
29
|
-
className="pf-c-menu pf-m-plain"
|
|
30
|
-
data-ouia-component-id="OUIA-Generated-Menu-2"
|
|
31
|
-
data-ouia-component-type="PF4/Menu"
|
|
32
|
-
data-ouia-safe={true}
|
|
33
|
-
>
|
|
34
|
-
content
|
|
35
|
-
</div>
|
|
36
|
-
`;
|
|
37
|
-
|
|
38
|
-
exports[`with isScrollable should render Menu with scrollable styles applied 1`] = `
|
|
39
|
-
<div
|
|
40
|
-
className="pf-c-menu pf-m-scrollable"
|
|
41
|
-
data-ouia-component-id="OUIA-Generated-Menu-3"
|
|
42
|
-
data-ouia-component-type="PF4/Menu"
|
|
43
|
-
data-ouia-safe={true}
|
|
44
|
-
>
|
|
45
|
-
content
|
|
46
|
-
</div>
|
|
13
|
+
</DocumentFragment>
|
|
47
14
|
`;
|