@patternfly/react-core 4.224.11 → 4.224.14

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/Wizard/Wizard.d.ts +2 -0
  5. package/dist/esm/components/Wizard/Wizard.d.ts.map +1 -1
  6. package/dist/esm/components/Wizard/Wizard.js +26 -5
  7. package/dist/esm/components/Wizard/Wizard.js.map +1 -1
  8. package/dist/esm/helpers/OUIA/ouia.d.ts.map +1 -1
  9. package/dist/esm/helpers/OUIA/ouia.js +2 -4
  10. package/dist/esm/helpers/OUIA/ouia.js.map +1 -1
  11. package/dist/js/components/DragDrop/DragDrop.d.ts +1 -1
  12. package/dist/js/components/DragDrop/DragDrop.d.ts.map +1 -1
  13. package/dist/js/components/Wizard/Wizard.d.ts +2 -0
  14. package/dist/js/components/Wizard/Wizard.d.ts.map +1 -1
  15. package/dist/js/components/Wizard/Wizard.js +26 -5
  16. package/dist/js/components/Wizard/Wizard.js.map +1 -1
  17. package/dist/js/helpers/OUIA/ouia.d.ts.map +1 -1
  18. package/dist/js/helpers/OUIA/ouia.js +2 -4
  19. package/dist/js/helpers/OUIA/ouia.js.map +1 -1
  20. package/dist/umd/react-core.css +759 -759
  21. package/dist/umd/react-core.js +28 -9
  22. package/dist/umd/react-core.min.js +2 -2
  23. package/package.json +6 -6
  24. package/src/components/Accordion/__tests__/Accordion.test.tsx +134 -104
  25. package/src/components/Accordion/__tests__/AccordionContent.test.tsx +180 -0
  26. package/src/components/Accordion/__tests__/AccordionExpandedContentBody.test.tsx +33 -0
  27. package/src/components/Accordion/__tests__/AccordionItem.test.tsx +18 -0
  28. package/src/components/Accordion/__tests__/AccordionToggle.test.tsx +164 -0
  29. package/src/components/Accordion/__tests__/__snapshots__/Accordion.test.tsx.snap +1 -214
  30. package/src/components/Accordion/__tests__/__snapshots__/AccordionContent.test.tsx.snap +17 -0
  31. package/src/components/Accordion/__tests__/__snapshots__/AccordionExpandedContentBody.test.tsx.snap +19 -0
  32. package/src/components/Accordion/__tests__/__snapshots__/AccordionItem.test.tsx.snap +7 -0
  33. package/src/components/Accordion/__tests__/__snapshots__/AccordionToggle.test.tsx.snap +25 -0
  34. package/src/components/DragDrop/DragDrop.tsx +1 -1
  35. package/src/components/Hint/__tests__/Hint.test.tsx +63 -10
  36. package/src/components/Hint/__tests__/HintBody.test.tsx +47 -0
  37. package/src/components/Hint/__tests__/HintFooter.test.tsx +47 -0
  38. package/src/components/Hint/__tests__/HintTitle.test.tsx +47 -0
  39. package/src/components/Hint/__tests__/__snapshots__/Hint.test.tsx.snap +1 -16
  40. package/src/components/Hint/__tests__/__snapshots__/HintBody.test.tsx.snap +13 -0
  41. package/src/components/Hint/__tests__/__snapshots__/HintFooter.test.tsx.snap +13 -0
  42. package/src/components/Hint/__tests__/__snapshots__/HintTitle.test.tsx.snap +13 -0
  43. package/src/components/Wizard/Wizard.tsx +37 -5
  44. package/src/components/Wizard/__tests__/Wizard.test.tsx +92 -0
  45. package/src/components/Wizard/examples/Wizard.md +25 -0
  46. package/src/helpers/OUIA/ouia.ts +2 -4
@@ -0,0 +1,164 @@
1
+ import React from 'react';
2
+
3
+ import { render, screen } from '@testing-library/react';
4
+
5
+ import { AccordionToggle } from '../AccordionToggle';
6
+ import { AccordionContext } from '../AccordionContext';
7
+
8
+ jest.mock('@patternfly/react-icons/dist/esm/icons/angle-right-icon', () => () => 'Icon mock');
9
+
10
+ test('Renders without children', () => {
11
+ render(
12
+ <AccordionContext.Provider value={{ ToggleContainer: 'h3' }}>
13
+ <AccordionToggle id="accordion-toggle" data-testid="accordion-toggle-test-id" />
14
+ </AccordionContext.Provider>
15
+ );
16
+
17
+ expect(screen.getByTestId('accordion-toggle-test-id')).toBeVisible();
18
+ });
19
+
20
+ test('Renders children', () => {
21
+ render(
22
+ <AccordionContext.Provider value={{ ToggleContainer: 'h3' }}>
23
+ <AccordionToggle id="accordion-toggle">Test</AccordionToggle>
24
+ </AccordionContext.Provider>
25
+ );
26
+
27
+ expect(screen.getByText('Test')).toBeVisible();
28
+ });
29
+
30
+ test('Renders with inherited element props spread to the component', () => {
31
+ render(
32
+ <>
33
+ <AccordionContext.Provider value={{ ToggleContainer: 'h3' }}>
34
+ <AccordionToggle id="accordion-toggle" aria-labelledby="labelling-id">
35
+ Test
36
+ </AccordionToggle>
37
+ <p id="labelling-id">Label</p>
38
+ </AccordionContext.Provider>
39
+ </>
40
+ );
41
+
42
+ expect(screen.getByRole('button')).toHaveAccessibleName('Label');
43
+ });
44
+
45
+ test('Renders the accordion toggle with class pf-c-accordion__toggle', () => {
46
+ render(
47
+ <AccordionContext.Provider value={{ ToggleContainer: 'h3' }}>
48
+ <AccordionToggle id="accordion-toggle" aria-label="Accordion test">
49
+ Test
50
+ </AccordionToggle>
51
+ </AccordionContext.Provider>
52
+ );
53
+
54
+ expect(screen.getByRole('button')).toHaveClass('pf-c-accordion__toggle');
55
+ });
56
+
57
+ test('Renders the accordion toggle with custom class names provided via prop', () => {
58
+ render(
59
+ <AccordionContext.Provider value={{ ToggleContainer: 'h3' }}>
60
+ <AccordionToggle id="accordion-toggle" aria-label="Accordion test" className="test-class">
61
+ Test
62
+ </AccordionToggle>
63
+ </AccordionContext.Provider>
64
+ );
65
+
66
+ expect(screen.getByRole('button')).toHaveClass('test-class');
67
+ });
68
+
69
+ test('Renders with children inside class pf-c-accordion__toggle-text', () => {
70
+ render(
71
+ <AccordionContext.Provider value={{ ToggleContainer: 'h3' }}>
72
+ <AccordionToggle id="accordion-toggle" aria-label="Accordion test">
73
+ Test
74
+ </AccordionToggle>
75
+ </AccordionContext.Provider>
76
+ );
77
+
78
+ expect(screen.getByText('Test')).toHaveClass('pf-c-accordion__toggle-text');
79
+ });
80
+
81
+ test('Renders with the toggle icon inside class pf-c-accordion__toggle-icon', () => {
82
+ render(
83
+ <AccordionContext.Provider value={{ ToggleContainer: 'h3' }}>
84
+ <AccordionToggle id="accordion-toggle" aria-label="Accordion test">
85
+ Test
86
+ </AccordionToggle>
87
+ </AccordionContext.Provider>
88
+ );
89
+
90
+ expect(screen.getByText('Icon mock')).toHaveClass('pf-c-accordion__toggle-icon');
91
+ });
92
+
93
+ test('Renders with the id prop passed to the toggle', () => {
94
+ render(
95
+ <AccordionContext.Provider value={{ ToggleContainer: 'h3' }}>
96
+ <AccordionToggle id="accordion-toggle" aria-label="Accordion test">
97
+ Test
98
+ </AccordionToggle>
99
+ </AccordionContext.Provider>
100
+ );
101
+
102
+ expect(screen.getByRole('button')).toHaveProperty('id', 'accordion-toggle');
103
+ });
104
+
105
+ test('Renders the container as the element provided in ToggleContainer from a context by default', () => {
106
+ render(
107
+ <AccordionContext.Provider value={{ ToggleContainer: 'h3' }}>
108
+ <AccordionToggle id="accordion-toggle">Test</AccordionToggle>
109
+ </AccordionContext.Provider>
110
+ );
111
+
112
+ expect(screen.queryByRole('heading', { level: 1 })).not.toBeInTheDocument();
113
+ expect(screen.getByRole('heading', { level: 3 })).toBeVisible();
114
+ });
115
+
116
+ test('Renders the container as the element provided via the component prop when one is provided', () => {
117
+ render(
118
+ <AccordionContext.Provider value={{ ToggleContainer: 'h3' }}>
119
+ <AccordionToggle id="accordion-toggle" component="h1">
120
+ Test
121
+ </AccordionToggle>
122
+ </AccordionContext.Provider>
123
+ );
124
+
125
+ expect(screen.queryByRole('heading', { level: 3 })).not.toBeInTheDocument();
126
+ expect(screen.getByRole('heading', { level: 1 })).toBeVisible();
127
+ });
128
+
129
+ test('Renders the toggle without pf-m-expanded and aria-expanded=false by default', () => {
130
+ render(
131
+ <AccordionContext.Provider value={{ ToggleContainer: 'h3' }}>
132
+ <AccordionToggle id="accordion-toggle">Test</AccordionToggle>
133
+ </AccordionContext.Provider>
134
+ );
135
+
136
+ const toggle = screen.getByRole('button');
137
+
138
+ expect(toggle).not.toHaveClass('pf-m-expanded');
139
+ expect(toggle).toHaveAttribute('aria-expanded', 'false');
140
+ });
141
+
142
+ test('Renders the toggle with pf-m-expanded and aria-expanded=true when isExpanded=true', () => {
143
+ render(
144
+ <AccordionContext.Provider value={{ ToggleContainer: 'h3' }}>
145
+ <AccordionToggle id="accordion-toggle" isExpanded>
146
+ Test
147
+ </AccordionToggle>
148
+ </AccordionContext.Provider>
149
+ );
150
+
151
+ const toggle = screen.getByRole('button');
152
+
153
+ expect(toggle).toHaveClass('pf-m-expanded');
154
+ expect(toggle).toHaveAttribute('aria-expanded', 'true');
155
+ });
156
+
157
+ test('Matches the snapshot', () => {
158
+ const { asFragment } = render(
159
+ <AccordionContext.Provider value={{ ToggleContainer: 'h3' }}>
160
+ <AccordionToggle id="accordion-toggle">Test</AccordionToggle>
161
+ </AccordionContext.Provider>
162
+ );
163
+ expect(asFragment()).toMatchSnapshot();
164
+ });
@@ -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,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
+ });
@@ -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 { HintTitle } from "../HintTitle";
6
+
7
+ test('renders without children', () => {
8
+ render(<HintTitle data-testid="HintTitle"></HintTitle>);
9
+
10
+ expect(screen.getByTestId('HintTitle')).toBeVisible();
11
+ });
12
+
13
+ test('renders children', () => {
14
+ render(<HintTitle>{<button>Test Me</button>}</HintTitle>);
15
+
16
+ expect(screen.getByRole('button', { name: 'Test Me' })).toBeVisible();
17
+ });
18
+
19
+ test('renders with class pf-c-hint__title', () => {
20
+ render(<HintTitle>Hint Body Test</HintTitle>);
21
+
22
+ const body = screen.getByText('Hint Body Test');
23
+
24
+ expect(body).toHaveClass('pf-c-hint__title');
25
+ });
26
+
27
+ test('renders with custom class names provided via prop', () => {
28
+ render(<HintTitle className="custom-classname">Hint Body Test</HintTitle>);
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
+ <HintTitle aria-label="labelling-id">Test</HintTitle>
38
+ );
39
+
40
+ expect(screen.getByText('Test')).toHaveAccessibleName('labelling-id');
41
+ });
42
+
43
+ test('matches snapshot', () => {
44
+ const { asFragment } = render(<HintTitle>{<button>Test</button>}</HintTitle>);
45
+
46
+ expect(asFragment()).toMatchSnapshot();
47
+ });