@patternfly/react-core 4.224.10 → 4.224.13

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/esm/components/DragDrop/DragDrop.d.ts +1 -1
  3. package/dist/esm/components/DragDrop/DragDrop.d.ts.map +1 -1
  4. package/dist/esm/components/SearchInput/SearchInput.d.ts +7 -0
  5. package/dist/esm/components/SearchInput/SearchInput.d.ts.map +1 -1
  6. package/dist/esm/components/SearchInput/SearchInput.js +9 -4
  7. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  8. package/dist/js/components/DragDrop/DragDrop.d.ts +1 -1
  9. package/dist/js/components/DragDrop/DragDrop.d.ts.map +1 -1
  10. package/dist/js/components/SearchInput/SearchInput.d.ts +7 -0
  11. package/dist/js/components/SearchInput/SearchInput.d.ts.map +1 -1
  12. package/dist/js/components/SearchInput/SearchInput.js +9 -4
  13. package/dist/js/components/SearchInput/SearchInput.js.map +1 -1
  14. package/dist/umd/react-core.css +415 -617
  15. package/dist/umd/react-core.js +683 -705
  16. package/dist/umd/react-core.min.css +103 -305
  17. package/dist/umd/react-core.min.js +4 -4
  18. package/package.json +5 -5
  19. package/src/components/Accordion/__tests__/Accordion.test.tsx +134 -104
  20. package/src/components/Accordion/__tests__/AccordionContent.test.tsx +180 -0
  21. package/src/components/Accordion/__tests__/AccordionExpandedContentBody.test.tsx +33 -0
  22. package/src/components/Accordion/__tests__/AccordionItem.test.tsx +18 -0
  23. package/src/components/Accordion/__tests__/AccordionToggle.test.tsx +164 -0
  24. package/src/components/Accordion/__tests__/__snapshots__/Accordion.test.tsx.snap +1 -214
  25. package/src/components/Accordion/__tests__/__snapshots__/AccordionContent.test.tsx.snap +17 -0
  26. package/src/components/Accordion/__tests__/__snapshots__/AccordionExpandedContentBody.test.tsx.snap +19 -0
  27. package/src/components/Accordion/__tests__/__snapshots__/AccordionItem.test.tsx.snap +7 -0
  28. package/src/components/Accordion/__tests__/__snapshots__/AccordionToggle.test.tsx.snap +25 -0
  29. package/src/components/ActionList/__tests__/ActionList.test.tsx +46 -11
  30. package/src/components/ActionList/__tests__/ActionListGroup.test.tsx +34 -7
  31. package/src/components/ActionList/__tests__/ActionListItem.test.tsx +34 -7
  32. package/src/components/ActionList/__tests__/__snapshots__/ActionList.test.tsx.snap +1 -11
  33. package/src/components/ActionList/__tests__/__snapshots__/ActionListGroup.test.tsx.snap +1 -1
  34. package/src/components/ActionList/__tests__/__snapshots__/ActionListItem.test.tsx.snap +1 -1
  35. package/src/components/DragDrop/DragDrop.tsx +1 -1
  36. package/src/components/Hint/__tests__/Hint.test.tsx +63 -10
  37. package/src/components/Hint/__tests__/HintBody.test.tsx +47 -0
  38. package/src/components/Hint/__tests__/HintFooter.test.tsx +47 -0
  39. package/src/components/Hint/__tests__/HintTitle.test.tsx +47 -0
  40. package/src/components/Hint/__tests__/__snapshots__/Hint.test.tsx.snap +1 -16
  41. package/src/components/Hint/__tests__/__snapshots__/HintBody.test.tsx.snap +13 -0
  42. package/src/components/Hint/__tests__/__snapshots__/HintFooter.test.tsx.snap +13 -0
  43. package/src/components/Hint/__tests__/__snapshots__/HintTitle.test.tsx.snap +13 -0
  44. package/src/components/SearchInput/SearchInput.tsx +32 -5
  45. package/src/components/SearchInput/__tests__/SearchInput.test.tsx +37 -0
  46. package/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap +193 -4
@@ -1,115 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Accordion Accordion bordered 1`] = `
4
- <DocumentFragment>
5
- <dl
6
- aria-label=""
7
- class="pf-c-accordion pf-m-bordered"
8
- >
9
- <dt>
10
- <button
11
- aria-expanded="false"
12
- class="pf-c-accordion__toggle"
13
- id="item-1"
14
- type="button"
15
- >
16
- <span
17
- class="pf-c-accordion__toggle-text"
18
- >
19
- Item One
20
- </span>
21
- <span
22
- class="pf-c-accordion__toggle-icon"
23
- >
24
- <svg
25
- aria-hidden="true"
26
- fill="currentColor"
27
- height="1em"
28
- role="img"
29
- style="vertical-align: -0.125em;"
30
- viewBox="0 0 256 512"
31
- width="1em"
32
- >
33
- <path
34
- d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"
35
- />
36
- </svg>
37
- </span>
38
- </button>
39
- </dt>
40
- <dd
41
- aria-label=""
42
- class="pf-c-accordion__expanded-content pf-m-expanded"
43
- id=""
44
- >
45
- <div
46
- class="pf-c-accordion__expanded-content-body"
47
- >
48
- Item One Content
49
- </div>
50
- </dd>
51
- </dl>
52
- </DocumentFragment>
53
- `;
54
-
55
- exports[`Accordion Accordion custom content 1`] = `
56
- <DocumentFragment>
57
- <dl
58
- aria-label=""
59
- class="pf-c-accordion"
60
- >
61
- <dt>
62
- <button
63
- aria-expanded="false"
64
- class="pf-c-accordion__toggle"
65
- id="item-1"
66
- type="button"
67
- >
68
- <span
69
- class="pf-c-accordion__toggle-text"
70
- >
71
- Item One
72
- </span>
73
- <span
74
- class="pf-c-accordion__toggle-icon"
75
- >
76
- <svg
77
- aria-hidden="true"
78
- fill="currentColor"
79
- height="1em"
80
- role="img"
81
- style="vertical-align: -0.125em;"
82
- viewBox="0 0 256 512"
83
- width="1em"
84
- >
85
- <path
86
- d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"
87
- />
88
- </svg>
89
- </span>
90
- </button>
91
- </dt>
92
- <dd
93
- aria-label=""
94
- class="pf-c-accordion__expanded-content pf-m-expanded"
95
- id=""
96
- >
97
- <div
98
- class="pf-c-accordion__expanded-content-body"
99
- >
100
- Item one content body 1
101
- </div>
102
- <div
103
- class="pf-c-accordion__expanded-content-body"
104
- >
105
- Item one Content body 2
106
- </div>
107
- </dd>
108
- </dl>
109
- </DocumentFragment>
110
- `;
111
-
112
- exports[`Accordion Accordion default 1`] = `
3
+ exports[`Matches the snapshot 1`] = `
113
4
  <DocumentFragment>
114
5
  <dl
115
6
  aria-label="this is a simple accordion"
@@ -117,107 +8,3 @@ exports[`Accordion Accordion default 1`] = `
117
8
  />
118
9
  </DocumentFragment>
119
10
  `;
120
-
121
- exports[`Accordion Accordion display large 1`] = `
122
- <DocumentFragment>
123
- <dl
124
- aria-label=""
125
- class="pf-c-accordion pf-m-display-lg"
126
- >
127
- <dt>
128
- <button
129
- aria-expanded="false"
130
- class="pf-c-accordion__toggle"
131
- id="item-1"
132
- type="button"
133
- >
134
- <span
135
- class="pf-c-accordion__toggle-text"
136
- >
137
- Item One
138
- </span>
139
- <span
140
- class="pf-c-accordion__toggle-icon"
141
- >
142
- <svg
143
- aria-hidden="true"
144
- fill="currentColor"
145
- height="1em"
146
- role="img"
147
- style="vertical-align: -0.125em;"
148
- viewBox="0 0 256 512"
149
- width="1em"
150
- >
151
- <path
152
- d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"
153
- />
154
- </svg>
155
- </span>
156
- </button>
157
- </dt>
158
- <dd
159
- aria-label=""
160
- class="pf-c-accordion__expanded-content pf-m-expanded"
161
- id=""
162
- >
163
- <div
164
- class="pf-c-accordion__expanded-content-body"
165
- >
166
- Item One Content
167
- </div>
168
- </dd>
169
- </dl>
170
- </DocumentFragment>
171
- `;
172
-
173
- exports[`Accordion Accordion with non-default headingLevel 1`] = `
174
- <DocumentFragment>
175
- <div
176
- aria-label=""
177
- class="pf-c-accordion"
178
- >
179
- <h2>
180
- <button
181
- aria-expanded="false"
182
- class="pf-c-accordion__toggle"
183
- id="item-1"
184
- type="button"
185
- >
186
- <span
187
- class="pf-c-accordion__toggle-text"
188
- >
189
- Item One
190
- </span>
191
- <span
192
- class="pf-c-accordion__toggle-icon"
193
- >
194
- <svg
195
- aria-hidden="true"
196
- fill="currentColor"
197
- height="1em"
198
- role="img"
199
- style="vertical-align: -0.125em;"
200
- viewBox="0 0 256 512"
201
- width="1em"
202
- >
203
- <path
204
- d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"
205
- />
206
- </svg>
207
- </span>
208
- </button>
209
- </h2>
210
- <div
211
- aria-label=""
212
- class="pf-c-accordion__expanded-content pf-m-expanded"
213
- id=""
214
- >
215
- <div
216
- class="pf-c-accordion__expanded-content-body"
217
- >
218
- Item One Content
219
- </div>
220
- </div>
221
- </div>
222
- </DocumentFragment>
223
- `;
@@ -0,0 +1,17 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Matches the snapshot 1`] = `
4
+ <DocumentFragment>
5
+ <h3
6
+ aria-label="this is a simple accordion"
7
+ class="pf-c-accordion__expanded-content pf-m-expanded"
8
+ id=""
9
+ >
10
+ <div
11
+ aria-label="Expanded content body mock"
12
+ >
13
+ Test
14
+ </div>
15
+ </h3>
16
+ </DocumentFragment>
17
+ `;
@@ -0,0 +1,19 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Matches the snapshot 1`] = `
4
+ <DocumentFragment>
5
+ <div
6
+ class="pf-c-accordion__expanded-content-body"
7
+ >
8
+ Test
9
+ </div>
10
+ </DocumentFragment>
11
+ `;
12
+
13
+ exports[`Renders without children 1`] = `
14
+ <DocumentFragment>
15
+ <div
16
+ class="pf-c-accordion__expanded-content-body"
17
+ />
18
+ </DocumentFragment>
19
+ `;
@@ -0,0 +1,7 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Matches the snapshot 1`] = `
4
+ <DocumentFragment>
5
+ Test
6
+ </DocumentFragment>
7
+ `;
@@ -0,0 +1,25 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Matches the snapshot 1`] = `
4
+ <DocumentFragment>
5
+ <h3>
6
+ <button
7
+ aria-expanded="false"
8
+ class="pf-c-accordion__toggle"
9
+ id="accordion-toggle"
10
+ type="button"
11
+ >
12
+ <span
13
+ class="pf-c-accordion__toggle-text"
14
+ >
15
+ Test
16
+ </span>
17
+ <span
18
+ class="pf-c-accordion__toggle-icon"
19
+ >
20
+ Icon mock
21
+ </span>
22
+ </button>
23
+ </h3>
24
+ </DocumentFragment>
25
+ `;
@@ -1,14 +1,49 @@
1
- import * as React from 'react';
2
- import { render } from '@testing-library/react';
1
+ import React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
3
  import { ActionList } from '../ActionList';
4
4
 
5
- describe('action list', () => {
6
- test('renders successfully', () => {
7
- const { asFragment } = render(<ActionList>test</ActionList>);
8
- expect(asFragment()).toMatchSnapshot();
9
- });
10
- test('isIconList flag adds modifier', () => {
11
- const { asFragment } = render(<ActionList isIconList>test</ActionList>);
12
- expect(asFragment()).toMatchSnapshot();
13
- });
5
+ test('Renders without children', () => {
6
+ render(<ActionList data-testid="action-list" />);
7
+ expect(screen.getByTestId('action-list')).toBeVisible();
8
+ });
9
+
10
+ test('Renders children', () => {
11
+ render(<ActionList>Test</ActionList>);
12
+
13
+ expect(screen.getByText('Test')).toBeVisible();
14
+ });
15
+
16
+ test('Renders with class pf-c-action-list', () => {
17
+ render(<ActionList>Test</ActionList>);
18
+
19
+ expect(screen.getByText('Test')).toHaveClass('pf-c-action-list');
20
+ });
21
+
22
+ test('Renders with custom class names provided via prop', () => {
23
+ render(<ActionList className="custom-class">Test</ActionList>);
24
+
25
+ expect(screen.getByText('Test')).toHaveClass('custom-class');
26
+ });
27
+
28
+ test('Does not render with class pf-m-icons by default', () => {
29
+ render(<ActionList>Test</ActionList>);
30
+
31
+ expect(screen.getByText('Test')).not.toHaveClass('pf-m-icons');
32
+ });
33
+
34
+ test('Renders with class pf-m-icons when isIconList is true', () => {
35
+ render(<ActionList isIconList={true}>Test</ActionList>);
36
+
37
+ expect(screen.getByText('Test')).toHaveClass('pf-m-icons');
38
+ });
39
+
40
+ test('Renders with inherited element props spread to the component', () => {
41
+ render(<ActionList aria-label="Test label">Test</ActionList>);
42
+
43
+ expect(screen.getByText('Test')).toHaveAccessibleName('Test label');
44
+ })
45
+
46
+ test('Matches the snapshot', () => {
47
+ const { asFragment } = render(<ActionList>test</ActionList>);
48
+ expect(asFragment()).toMatchSnapshot();
14
49
  });
@@ -1,10 +1,37 @@
1
- import * as React from 'react';
2
- import { render } from '@testing-library/react';
1
+ import React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
3
  import { ActionListGroup } from '../ActionListGroup';
4
4
 
5
- describe('action list group', () => {
6
- test('renders successfully', () => {
7
- const { asFragment } = render(<ActionListGroup>test</ActionListGroup>);
8
- expect(asFragment()).toMatchSnapshot();
9
- });
5
+ test('Renders without children', () => {
6
+ render(<ActionListGroup data-testid="action-list-group" />);
7
+ expect(screen.getByTestId('action-list-group')).toBeVisible();
8
+ });
9
+
10
+ test('Renders children', () => {
11
+ render(<ActionListGroup>Test</ActionListGroup>);
12
+
13
+ expect(screen.getByText('Test')).toBeVisible();
14
+ });
15
+
16
+ test('Renders with class pf-c-action-list__group', () => {
17
+ render(<ActionListGroup>Test</ActionListGroup>);
18
+
19
+ expect(screen.getByText('Test')).toHaveClass('pf-c-action-list__group');
20
+ });
21
+
22
+ test('Renders with custom class names provided via prop', () => {
23
+ render(<ActionListGroup className="custom-class">Test</ActionListGroup>);
24
+
25
+ expect(screen.getByText('Test')).toHaveClass('custom-class');
26
+ });
27
+
28
+ test('Renders with inherited element props spread to the component', () => {
29
+ render(<ActionListGroup aria-label="Test label">Test</ActionListGroup>);
30
+
31
+ expect(screen.getByText('Test')).toHaveAccessibleName('Test label');
32
+ })
33
+
34
+ test('Matches the snapshot', () => {
35
+ const { asFragment } = render(<ActionListGroup>test</ActionListGroup>);
36
+ expect(asFragment()).toMatchSnapshot();
10
37
  });
@@ -1,10 +1,37 @@
1
- import * as React from 'react';
2
- import { render } from '@testing-library/react';
1
+ import React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
3
  import { ActionListItem } from '../ActionListItem';
4
4
 
5
- describe('action list item', () => {
6
- test('renders successfully', () => {
7
- const { asFragment } = render(<ActionListItem>test</ActionListItem>);
8
- expect(asFragment()).toMatchSnapshot();
9
- });
5
+ test('Renders without children', () => {
6
+ render(<ActionListItem data-testid="action-list-item" />);
7
+ expect(screen.getByTestId('action-list-item')).toBeVisible();
8
+ });
9
+
10
+ test('Renders children', () => {
11
+ render(<ActionListItem>Test</ActionListItem>);
12
+
13
+ expect(screen.getByText('Test')).toBeVisible();
14
+ });
15
+
16
+ test('Renders with class pf-c-action-list__item', () => {
17
+ render(<ActionListItem>Test</ActionListItem>);
18
+
19
+ expect(screen.getByText('Test')).toHaveClass('pf-c-action-list__item');
20
+ });
21
+
22
+ test('Renders with custom class names provided via prop', () => {
23
+ render(<ActionListItem className="custom-class">Test</ActionListItem>);
24
+
25
+ expect(screen.getByText('Test')).toHaveClass('custom-class');
26
+ });
27
+
28
+ test('Renders with inherited element props spread to the component', () => {
29
+ render(<ActionListItem aria-label="Test label">Test</ActionListItem>);
30
+
31
+ expect(screen.getByText('Test')).toHaveAccessibleName('Test label');
32
+ })
33
+
34
+ test('Matches the snapshot', () => {
35
+ const { asFragment } = render(<ActionListItem>test</ActionListItem>);
36
+ expect(asFragment()).toMatchSnapshot();
10
37
  });
@@ -1,16 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`action list isIconList flag adds modifier 1`] = `
4
- <DocumentFragment>
5
- <div
6
- class="pf-c-action-list pf-m-icons"
7
- >
8
- test
9
- </div>
10
- </DocumentFragment>
11
- `;
12
-
13
- exports[`action list renders successfully 1`] = `
3
+ exports[`Matches the snapshot 1`] = `
14
4
  <DocumentFragment>
15
5
  <div
16
6
  class="pf-c-action-list"
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`action list group renders successfully 1`] = `
3
+ exports[`Matches the snapshot 1`] = `
4
4
  <DocumentFragment>
5
5
  <div
6
6
  class="pf-c-action-list__group"
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`action list item renders successfully 1`] = `
3
+ exports[`Matches the snapshot 1`] = `
4
4
  <DocumentFragment>
5
5
  <div
6
6
  class="pf-c-action-list__item"
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
 
3
- interface DraggableItemPosition {
3
+ export interface DraggableItemPosition {
4
4
  /** Parent droppableId */
5
5
  droppableId: string;
6
6
  /** Index of item in parent Droppable */
@@ -1,17 +1,70 @@
1
1
  import * as React from 'react';
2
- import { render } from '@testing-library/react';
2
+ import { render, screen } from '@testing-library/react';
3
3
  import { Hint } from '../Hint';
4
- import { HintBody } from '../HintBody';
5
- import { HintTitle } from '../HintTitle';
6
- import { HintFooter } from '../HintFooter';
7
4
 
8
- test('simple hint', () => {
5
+ test('renders without children', () => {
6
+ render(<Hint data-testid='Hint' />);
7
+
8
+ expect(screen.getByTestId('Hint')).toBeVisible();
9
+ });
10
+
11
+ test('renders children', () => {
12
+ render(<Hint>Test</Hint>);
13
+
14
+ expect(screen.getByText('Test')).toBeVisible();
15
+ });
16
+
17
+ test('renders with class pf-c-hint', () => {
18
+ render(<Hint>Test</Hint>);
19
+
20
+ const hint = screen.getByText('Test');
21
+
22
+ expect(hint).toHaveClass('pf-c-hint');
23
+ });
24
+
25
+ test('renders with custom class names provided via prop', () => {
26
+ render(<Hint className='custom-classname'>Test</Hint>);
27
+
28
+ const hint = screen.getByText('Test');
29
+
30
+ expect(hint).toHaveClass('custom-classname');
31
+ });
32
+
33
+ test('does not render actions options when not passed', () => {
34
+ render(<Hint>Test</Hint>);
35
+
36
+ const actions = screen.queryByText('actions');
37
+
38
+ expect(actions).not.toBeInTheDocument();
39
+ });
40
+
41
+ test('renders actions options', () => {
42
+ render(<Hint actions="actions">Test</Hint>);
43
+
44
+ const actions = screen.getByText("actions");
45
+
46
+ expect(actions).toBeVisible();
47
+ });
48
+
49
+ test('renders with class pf-c-hint__actions if there is an action prop', () => {
50
+ render(<Hint actions="actions">Test</Hint>);
51
+
52
+ const hint = screen.getByText('actions');
53
+
54
+ expect(hint).toHaveClass('pf-c-hint__actions');
55
+ });
56
+
57
+ test('renders with inherited element props spread to the component', () => {
58
+ render(
59
+ <Hint aria-label="labelling-id">Test</Hint>
60
+ );
61
+
62
+ expect(screen.getByText('Test')).toHaveAccessibleName('labelling-id');
63
+ });
64
+
65
+ test('matches hint snapshot', () => {
9
66
  const { asFragment } = render(
10
- <Hint>
11
- <HintTitle>Title</HintTitle>
12
- <HintBody>Body</HintBody>
13
- <HintFooter>Footer</HintFooter>
14
- </Hint>
67
+ <Hint />
15
68
  );
16
69
  expect(asFragment()).toMatchSnapshot();
17
70
  });
@@ -0,0 +1,47 @@
1
+ import React from "react";
2
+ import { render, screen } from '@testing-library/react';
3
+ import '@testing-library/jest-dom';
4
+
5
+ import { HintBody } from "../HintBody";
6
+
7
+ test('renders without children', () => {
8
+ render(<HintBody data-testid="HintBody"></HintBody>);
9
+
10
+ expect(screen.getByTestId('HintBody')).toBeVisible();
11
+ });
12
+
13
+ test('renders children', () => {
14
+ render(<HintBody>{<button>Test Me</button>}</HintBody>);
15
+
16
+ expect(screen.getByRole('button', { name: 'Test Me' })).toBeVisible();
17
+ });
18
+
19
+ test('renders with class pf-c-hint__body', () => {
20
+ render(<HintBody>Hint Body Test</HintBody>);
21
+
22
+ const body = screen.getByText('Hint Body Test');
23
+
24
+ expect(body).toHaveClass('pf-c-hint__body');
25
+ });
26
+
27
+ test('renders with custom class names provided via prop', () => {
28
+ render(<HintBody className="custom-classname">Hint Body Test</HintBody>);
29
+
30
+ const body = screen.getByText('Hint Body Test');
31
+
32
+ expect(body).toHaveClass('custom-classname');
33
+ });
34
+
35
+ test('renders with inherited element props spread to the component', () => {
36
+ render(
37
+ <HintBody aria-label="labelling-id">Test</HintBody>
38
+ );
39
+
40
+ expect(screen.getByText('Test')).toHaveAccessibleName('labelling-id');
41
+ });
42
+
43
+ test('matches snapshot', () => {
44
+ const { asFragment } = render(<HintBody>{<button>Test</button>}</HintBody>);
45
+
46
+ expect(asFragment()).toMatchSnapshot();
47
+ });
@@ -0,0 +1,47 @@
1
+ import React from "react";
2
+ import { render, screen } from '@testing-library/react';
3
+ import '@testing-library/jest-dom';
4
+
5
+ import { HintFooter } from "../HintFooter";
6
+
7
+ test('renders without children', () => {
8
+ render(<HintFooter data-testid="HintFooter"></HintFooter>);
9
+
10
+ expect(screen.getByTestId('HintFooter')).toBeVisible();
11
+ });
12
+
13
+ test('renders children', () => {
14
+ render(<HintFooter>{<button>Test Me</button>}</HintFooter>);
15
+
16
+ expect(screen.getByRole('button', { name: 'Test Me' })).toBeVisible();
17
+ });
18
+
19
+ test('renders with class pf-c-hint__footer', () => {
20
+ render(<HintFooter>Hint Body Test</HintFooter>);
21
+
22
+ const body = screen.getByText('Hint Body Test');
23
+
24
+ expect(body).toHaveClass('pf-c-hint__footer');
25
+ });
26
+
27
+ test('renders with custom class names provided via prop', () => {
28
+ render(<HintFooter className="custom-classname">Hint Body Test</HintFooter>);
29
+
30
+ const body = screen.getByText('Hint Body Test');
31
+
32
+ expect(body).toHaveClass('custom-classname');
33
+ });
34
+
35
+ test('renders with inherited element props spread to the component', () => {
36
+ render(
37
+ <HintFooter aria-label="labelling-id">Test</HintFooter>
38
+ );
39
+
40
+ expect(screen.getByText('Test')).toHaveAccessibleName('labelling-id');
41
+ });
42
+
43
+ test('matches snapshot', () => {
44
+ const { asFragment } = render(<HintFooter>{<button>Test</button>}</HintFooter>);
45
+
46
+ expect(asFragment()).toMatchSnapshot();
47
+ });