@patternfly/react-core 4.202.33 → 4.202.36
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/ApplicationLauncher/ApplicationLauncher.d.ts +9 -2
- package/dist/esm/components/ApplicationLauncher/ApplicationLauncher.d.ts.map +1 -1
- package/dist/esm/components/ApplicationLauncher/ApplicationLauncher.js.map +1 -1
- package/dist/esm/components/Brand/Brand.d.ts +23 -3
- package/dist/esm/components/Brand/Brand.d.ts.map +1 -1
- package/dist/esm/components/Brand/Brand.js +12 -2
- package/dist/esm/components/Brand/Brand.js.map +1 -1
- package/dist/esm/components/ContextSelector/ContextSelector.d.ts +10 -2
- package/dist/esm/components/ContextSelector/ContextSelector.d.ts.map +1 -1
- package/dist/esm/components/ContextSelector/ContextSelector.js +3 -2
- package/dist/esm/components/ContextSelector/ContextSelector.js.map +1 -1
- package/dist/esm/components/ContextSelector/ContextSelectorToggle.js +3 -3
- package/dist/esm/components/ContextSelector/ContextSelectorToggle.js.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.d.ts +9 -2
- package/dist/esm/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.js +2 -2
- package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/components/OptionsMenu/OptionsMenu.d.ts +9 -2
- package/dist/esm/components/OptionsMenu/OptionsMenu.d.ts.map +1 -1
- package/dist/esm/components/OptionsMenu/OptionsMenu.js.map +1 -1
- package/dist/esm/components/Select/Select.d.ts +9 -2
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.d.ts +2 -0
- package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/esm/components/Tabs/Tabs.js +3 -2
- package/dist/esm/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/helpers/Popper/Popper.d.ts +0 -10
- package/dist/esm/helpers/Popper/Popper.d.ts.map +1 -1
- package/dist/esm/helpers/Popper/Popper.js.map +1 -1
- package/dist/js/components/ApplicationLauncher/ApplicationLauncher.d.ts +9 -2
- package/dist/js/components/ApplicationLauncher/ApplicationLauncher.d.ts.map +1 -1
- package/dist/js/components/ApplicationLauncher/ApplicationLauncher.js.map +1 -1
- package/dist/js/components/Brand/Brand.d.ts +23 -3
- package/dist/js/components/Brand/Brand.d.ts.map +1 -1
- package/dist/js/components/Brand/Brand.js +12 -2
- package/dist/js/components/Brand/Brand.js.map +1 -1
- package/dist/js/components/ContextSelector/ContextSelector.d.ts +10 -2
- package/dist/js/components/ContextSelector/ContextSelector.d.ts.map +1 -1
- package/dist/js/components/ContextSelector/ContextSelector.js +3 -2
- package/dist/js/components/ContextSelector/ContextSelector.js.map +1 -1
- package/dist/js/components/ContextSelector/ContextSelectorToggle.js +3 -3
- package/dist/js/components/ContextSelector/ContextSelectorToggle.js.map +1 -1
- package/dist/js/components/Dropdown/Dropdown.d.ts +9 -2
- package/dist/js/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/js/components/Dropdown/Dropdown.js +2 -2
- package/dist/js/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/js/components/OptionsMenu/OptionsMenu.d.ts +9 -2
- package/dist/js/components/OptionsMenu/OptionsMenu.d.ts.map +1 -1
- package/dist/js/components/OptionsMenu/OptionsMenu.js.map +1 -1
- package/dist/js/components/Select/Select.d.ts +9 -2
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/js/components/Tabs/Tabs.d.ts +2 -0
- package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/js/components/Tabs/Tabs.js +3 -2
- package/dist/js/components/Tabs/Tabs.js.map +1 -1
- package/dist/js/helpers/Popper/Popper.d.ts +0 -10
- package/dist/js/helpers/Popper/Popper.d.ts.map +1 -1
- package/dist/js/helpers/Popper/Popper.js.map +1 -1
- package/dist/umd/react-core.css +64 -0
- package/dist/umd/react-core.js +152 -130
- package/dist/umd/react-core.min.css +64 -0
- package/dist/umd/react-core.min.js +4 -4
- package/package.json +5 -5
- package/src/components/ApplicationLauncher/ApplicationLauncher.tsx +9 -2
- package/src/components/Brand/Brand.tsx +61 -8
- package/src/components/Brand/__tests__/Brand.test.tsx +15 -4
- package/src/components/Brand/__tests__/__snapshots__/Brand.test.tsx.snap +1 -1
- package/src/components/Brand/examples/Brand.md +13 -0
- package/src/components/Brand/examples/BrandResponsive.tsx +18 -0
- package/src/components/Brand/examples/pf-c-brand--logo-base.jpg +0 -0
- package/src/components/Brand/examples/pf-c-brand--logo-on-lg.svg +32 -0
- package/src/components/Brand/examples/pf-c-brand--logo-on-md.svg +42 -0
- package/src/components/Brand/examples/pf-c-brand--logo-on-sm.svg +17 -0
- package/src/components/Brand/examples/pf-c-brand--logo-on-xl.svg +39 -0
- package/src/components/Brand/examples/pf-c-brand--logo.svg +10 -0
- package/src/components/ContextSelector/ContextSelector.tsx +12 -4
- package/src/components/ContextSelector/ContextSelectorToggle.tsx +3 -3
- package/src/components/Dropdown/Dropdown.tsx +11 -3
- package/src/components/OptionsMenu/OptionsMenu.tsx +9 -2
- package/src/components/Select/Select.tsx +10 -3
- package/src/components/Tabs/Tabs.tsx +5 -0
- package/src/components/Tabs/__tests__/Tabs.test.tsx +17 -0
- package/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +153 -0
- package/src/components/TextInputGroup/__tests__/TextInputGroup.test.tsx +47 -146
- package/src/components/TextInputGroup/__tests__/TextInputGroupMain.test.tsx +302 -0
- package/src/components/TextInputGroup/__tests__/TextInputGroupUtilities.test.tsx +34 -0
- package/src/components/TextInputGroup/__tests__/__snapshots__/TextInputGroup.test.tsx.snap +2 -203
- package/src/components/TextInputGroup/__tests__/__snapshots__/TextInputGroupMain.test.tsx.snap +21 -0
- package/src/components/TextInputGroup/__tests__/__snapshots__/TextInputGroupUtilities.test.tsx.snap +13 -0
- package/src/demos/Tabs.md +5 -0
- package/src/demos/examples/Tabs/TabsAndTablesAutoWidthTabs.tsx +442 -0
- package/src/helpers/Popper/Popper.tsx +0 -11
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
|
+
|
|
6
|
+
import { TextInputGroupMain } from '../TextInputGroupMain';
|
|
7
|
+
import { TextInputGroupContext } from '../TextInputGroup';
|
|
8
|
+
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
9
|
+
|
|
10
|
+
describe('TextInputGroupMain', () => {
|
|
11
|
+
it('renders without children', () => {
|
|
12
|
+
render(<TextInputGroupMain data-testid='TextInputGroupMain'/>);
|
|
13
|
+
|
|
14
|
+
expect(screen.getByTestId('TextInputGroupMain')).toBeVisible();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('renders children', () => {
|
|
18
|
+
render(<TextInputGroupMain>Test</TextInputGroupMain>);
|
|
19
|
+
|
|
20
|
+
expect(screen.getByText('Test')).toBeVisible();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('renders with class pf-c-text-input-group__main', () => {
|
|
24
|
+
render(<TextInputGroupMain>Test</TextInputGroupMain>);
|
|
25
|
+
|
|
26
|
+
const inputGroupMain = screen.getByText('Test');
|
|
27
|
+
|
|
28
|
+
expect(inputGroupMain).toHaveClass('pf-c-text-input-group__main');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('does not render with class pf-m-icon when an icon prop is not passed', () => {
|
|
32
|
+
render(<TextInputGroupMain>Test</TextInputGroupMain>);
|
|
33
|
+
|
|
34
|
+
const inputGroupMain = screen.getByText('Test');
|
|
35
|
+
|
|
36
|
+
expect(inputGroupMain).not.toHaveClass('pf-m-icon');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('renders with class pf-m-icon when an icon prop is passed', () => {
|
|
40
|
+
render(<TextInputGroupMain icon="icon">Test</TextInputGroupMain>);
|
|
41
|
+
|
|
42
|
+
const inputGroupMain = screen.getByText('Test');
|
|
43
|
+
|
|
44
|
+
expect(inputGroupMain).toHaveClass('pf-m-icon');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('renders with custom class names provided via prop', () => {
|
|
48
|
+
render(<TextInputGroupMain className="custom-class">Test</TextInputGroupMain>);
|
|
49
|
+
|
|
50
|
+
const inputGroupMain = screen.getByText('Test');
|
|
51
|
+
|
|
52
|
+
expect(inputGroupMain).toHaveClass('custom-class');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('renders with class pf-c-text-input-group__text on the inputs parent', () => {
|
|
56
|
+
render(<TextInputGroupMain>Test</TextInputGroupMain>);
|
|
57
|
+
|
|
58
|
+
const inputGroupText = screen.getByRole('textbox').parentNode;
|
|
59
|
+
|
|
60
|
+
expect(inputGroupText).toHaveClass('pf-c-text-input-group__text');
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('renders the input with class pf-c-text-input-group__text-input', () => {
|
|
64
|
+
render(<TextInputGroupMain>Test</TextInputGroupMain>);
|
|
65
|
+
|
|
66
|
+
const input = screen.getByRole('textbox');
|
|
67
|
+
|
|
68
|
+
expect(input).toHaveClass('pf-c-text-input-group__text-input');
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('does not render the icon when it is not passed', () => {
|
|
72
|
+
render(<TextInputGroupMain />);
|
|
73
|
+
|
|
74
|
+
const icon = screen.queryByRole('img', { hidden: true });
|
|
75
|
+
|
|
76
|
+
expect(icon).not.toBeInTheDocument();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('renders the icon when passed', () => {
|
|
80
|
+
render(<TextInputGroupMain icon={<SearchIcon />} />);
|
|
81
|
+
|
|
82
|
+
const icon = screen.getByRole('img', { hidden: true });
|
|
83
|
+
|
|
84
|
+
expect(icon).toBeInTheDocument();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('renders the icon as aria hidden', () => {
|
|
88
|
+
render(<TextInputGroupMain icon={<SearchIcon />} />);
|
|
89
|
+
|
|
90
|
+
const icon = screen.getByRole('img', { hidden: true });
|
|
91
|
+
|
|
92
|
+
expect(icon).toHaveAttribute('aria-hidden', 'true');
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('passes the aria-label prop to the input', () => {
|
|
96
|
+
render(<TextInputGroupMain aria-label="Test label">Test</TextInputGroupMain>);
|
|
97
|
+
|
|
98
|
+
const input = screen.getByRole('textbox');
|
|
99
|
+
|
|
100
|
+
expect(input).toHaveAccessibleName('Test label');
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('passes the value prop to the input', () => {
|
|
104
|
+
render(<TextInputGroupMain value="value text">Test</TextInputGroupMain>);
|
|
105
|
+
|
|
106
|
+
const inputValue = screen.getByDisplayValue('value text');
|
|
107
|
+
|
|
108
|
+
expect(inputValue).toBeVisible();
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('passes the placeholder prop to the input', () => {
|
|
112
|
+
render(<TextInputGroupMain placeholder="placeholder text">Test</TextInputGroupMain>);
|
|
113
|
+
|
|
114
|
+
const inputPlaceholder = screen.getByPlaceholderText('placeholder text');
|
|
115
|
+
|
|
116
|
+
expect(inputPlaceholder).toBeVisible();
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('defaults to an input type of text', () => {
|
|
120
|
+
render(<TextInputGroupMain>Test</TextInputGroupMain>);
|
|
121
|
+
|
|
122
|
+
const input = screen.getByRole('textbox');
|
|
123
|
+
|
|
124
|
+
expect(input).toHaveAttribute('type', 'text');
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('updates the input type when a different type is passed', () => {
|
|
128
|
+
render(<TextInputGroupMain type="search">Test</TextInputGroupMain>);
|
|
129
|
+
|
|
130
|
+
const textInput = screen.queryByRole('textbox');
|
|
131
|
+
const searchInput = screen.getByRole('searchbox');
|
|
132
|
+
|
|
133
|
+
expect(textInput).not.toBeInTheDocument();
|
|
134
|
+
expect(searchInput).toBeVisible();
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('does not disable the input when TextInputGroupContext isDisabled is false', () => {
|
|
138
|
+
render(
|
|
139
|
+
<TextInputGroupContext.Provider value={{ isDisabled: false }}>
|
|
140
|
+
<TextInputGroupMain />
|
|
141
|
+
</TextInputGroupContext.Provider>
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
const input = screen.getByRole('textbox');
|
|
145
|
+
|
|
146
|
+
expect(input).not.toBeDisabled();
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it('disables the input when TextInputGroupContext isDisabled is true', () => {
|
|
150
|
+
render(
|
|
151
|
+
<TextInputGroupContext.Provider value={{ isDisabled: true }}>
|
|
152
|
+
<TextInputGroupMain />
|
|
153
|
+
</TextInputGroupContext.Provider>
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
const input = screen.getByRole('textbox');
|
|
157
|
+
|
|
158
|
+
expect(input).toBeDisabled();
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
it("doesn't render the hint input when a hint prop isn't passed", () => {
|
|
162
|
+
// we set the type of the main input to search here so that we can accurately target the hint input
|
|
163
|
+
render(<TextInputGroupMain type="search">Test</TextInputGroupMain>);
|
|
164
|
+
|
|
165
|
+
const hintInput = screen.queryByRole('textbox', { hidden: true });
|
|
166
|
+
|
|
167
|
+
expect(hintInput).not.toBeInTheDocument();
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
it('renders the hint input when a hint prop is passed', () => {
|
|
171
|
+
// we set the type of the main input to search here so that we can accurately target the hint input
|
|
172
|
+
render(
|
|
173
|
+
<TextInputGroupMain hint="Test" type="search">
|
|
174
|
+
Test
|
|
175
|
+
</TextInputGroupMain>
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
const hintInput = screen.getByRole('textbox', { hidden: true });
|
|
179
|
+
|
|
180
|
+
expect(hintInput).toBeInTheDocument();
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('renders the hint input with classes pf-c-text-input-group__text-input and pf-m-hint', () => {
|
|
184
|
+
// we set the type of the main input to search here so that we can accurately target the hint input
|
|
185
|
+
render(
|
|
186
|
+
<TextInputGroupMain hint="Test" type="search">
|
|
187
|
+
Test
|
|
188
|
+
</TextInputGroupMain>
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
const hintInput = screen.getByRole('textbox', { hidden: true });
|
|
192
|
+
|
|
193
|
+
expect(hintInput).toHaveClass('pf-m-hint');
|
|
194
|
+
expect(hintInput).toHaveClass('pf-c-text-input-group__text-input');
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
it('renders the hint input as disabled', () => {
|
|
198
|
+
// we set the type of the main input to search here so that we can accurately target the hint input
|
|
199
|
+
render(
|
|
200
|
+
<TextInputGroupMain hint="Test" type="search">
|
|
201
|
+
Test
|
|
202
|
+
</TextInputGroupMain>
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
const hintInput = screen.getByRole('textbox', { hidden: true });
|
|
206
|
+
|
|
207
|
+
expect(hintInput).toBeDisabled();
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it('renders the hint input as aria-hidden', () => {
|
|
211
|
+
// we set the type of the main input to search here so that we can accurately target the hint input
|
|
212
|
+
render(
|
|
213
|
+
<TextInputGroupMain hint="Test" type="search">
|
|
214
|
+
Test
|
|
215
|
+
</TextInputGroupMain>
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
const hintInput = screen.getByRole('textbox', { hidden: true });
|
|
219
|
+
|
|
220
|
+
expect(hintInput).toHaveAttribute('aria-hidden', 'true');
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
it('passes the hint prop to the hint input as its value', () => {
|
|
224
|
+
// we set the type of the main input to search here so that we can accurately target the hint input
|
|
225
|
+
render(
|
|
226
|
+
<TextInputGroupMain hint="value text" type="search">
|
|
227
|
+
Test
|
|
228
|
+
</TextInputGroupMain>
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
const hintInput = screen.getByDisplayValue('value text');
|
|
232
|
+
|
|
233
|
+
expect(hintInput).toBeVisible();
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
it('does not call onChange callback when the input does not change', () => {
|
|
237
|
+
const onChangeMock = jest.fn();
|
|
238
|
+
|
|
239
|
+
render(<TextInputGroupMain onChange={onChangeMock}>Test</TextInputGroupMain>);
|
|
240
|
+
|
|
241
|
+
expect(onChangeMock).not.toHaveBeenCalled();
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
it('calls the onChange callback when the input changes', () => {
|
|
245
|
+
const onChangeMock = jest.fn();
|
|
246
|
+
|
|
247
|
+
render(<TextInputGroupMain onChange={onChangeMock}>Test</TextInputGroupMain>);
|
|
248
|
+
|
|
249
|
+
const input = screen.getByRole('textbox');
|
|
250
|
+
userEvent.type(input, 'Test');
|
|
251
|
+
|
|
252
|
+
expect(onChangeMock).toHaveBeenCalledTimes(4);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it('does not call onFocus callback when the input does not get focus', () => {
|
|
256
|
+
const onFocusMock = jest.fn();
|
|
257
|
+
|
|
258
|
+
render(<TextInputGroupMain onFocus={onFocusMock}>Test</TextInputGroupMain>);
|
|
259
|
+
|
|
260
|
+
expect(onFocusMock).not.toHaveBeenCalled();
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it('calls the onFocus callback when the input is focused', () => {
|
|
264
|
+
const onFocusMock = jest.fn();
|
|
265
|
+
|
|
266
|
+
render(<TextInputGroupMain onFocus={onFocusMock}>Test</TextInputGroupMain>);
|
|
267
|
+
|
|
268
|
+
const input = screen.getByRole('textbox');
|
|
269
|
+
userEvent.click(input);
|
|
270
|
+
|
|
271
|
+
expect(onFocusMock).toHaveBeenCalledTimes(1);
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
it('does not call onBlur callback when the input does not lose focus', () => {
|
|
275
|
+
const onBlurMock = jest.fn();
|
|
276
|
+
|
|
277
|
+
render(<TextInputGroupMain onBlur={onBlurMock}>Test</TextInputGroupMain>);
|
|
278
|
+
|
|
279
|
+
const input = screen.getByRole('textbox');
|
|
280
|
+
userEvent.click(input);
|
|
281
|
+
|
|
282
|
+
expect(onBlurMock).not.toHaveBeenCalled();
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
it('calls the onBlur callback when the input loses focus', () => {
|
|
286
|
+
const onBlurMock = jest.fn();
|
|
287
|
+
|
|
288
|
+
render(<TextInputGroupMain onBlur={onBlurMock}>Test</TextInputGroupMain>);
|
|
289
|
+
|
|
290
|
+
const input = screen.getByRole('textbox');
|
|
291
|
+
userEvent.click(input);
|
|
292
|
+
userEvent.click(document.body);
|
|
293
|
+
|
|
294
|
+
expect(onBlurMock).toHaveBeenCalledTimes(1);
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
it('matches the snapshot', () => {
|
|
298
|
+
const { asFragment } = render(<TextInputGroupMain>Test</TextInputGroupMain>);
|
|
299
|
+
|
|
300
|
+
expect(asFragment()).toMatchSnapshot();
|
|
301
|
+
});
|
|
302
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
|
+
|
|
6
|
+
import { TextInputGroupUtilities } from '../TextInputGroupUtilities';
|
|
7
|
+
|
|
8
|
+
describe('TextInputGroupUtilities', () => {
|
|
9
|
+
it('renders without children', () => {
|
|
10
|
+
render(<TextInputGroupUtilities data-testid="TextInputGroupUtilities" />);
|
|
11
|
+
|
|
12
|
+
expect(screen.getByTestId('TextInputGroupUtilities')).toBeVisible();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('renders the children', () => {
|
|
16
|
+
render(<TextInputGroupUtilities>{<button>Test</button>}</TextInputGroupUtilities>);
|
|
17
|
+
|
|
18
|
+
expect(screen.getByRole('button', { name: 'Test' })).toBeVisible();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('renders with class pf-c-text-input-group__utilities', () => {
|
|
22
|
+
render(<TextInputGroupUtilities>Test</TextInputGroupUtilities>);
|
|
23
|
+
|
|
24
|
+
const utilities = screen.getByText('Test');
|
|
25
|
+
|
|
26
|
+
expect(utilities).toHaveClass('pf-c-text-input-group__utilities');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('matches the snapshot', () => {
|
|
30
|
+
const { asFragment } = render(<TextInputGroupUtilities>{<button>Test</button>}</TextInputGroupUtilities>);
|
|
31
|
+
|
|
32
|
+
expect(asFragment()).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -1,212 +1,11 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`TextInputGroup
|
|
4
|
-
<DocumentFragment>
|
|
5
|
-
<div
|
|
6
|
-
class="pf-c-text-input-group custom-class"
|
|
7
|
-
id="test-id"
|
|
8
|
-
>
|
|
9
|
-
<div
|
|
10
|
-
class="pf-c-text-input-group__main"
|
|
11
|
-
>
|
|
12
|
-
Foo
|
|
13
|
-
<span
|
|
14
|
-
class="pf-c-text-input-group__text"
|
|
15
|
-
>
|
|
16
|
-
<input
|
|
17
|
-
aria-label="Type to filter"
|
|
18
|
-
class="pf-c-text-input-group__text-input"
|
|
19
|
-
type="text"
|
|
20
|
-
value=""
|
|
21
|
-
/>
|
|
22
|
-
</span>
|
|
23
|
-
</div>
|
|
24
|
-
<div
|
|
25
|
-
class="pf-c-text-input-group__utilities"
|
|
26
|
-
/>
|
|
27
|
-
</div>
|
|
28
|
-
</DocumentFragment>
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
exports[`TextInputGroup renders content 1`] = `
|
|
3
|
+
exports[`TextInputGroup matches the snapshot 1`] = `
|
|
32
4
|
<DocumentFragment>
|
|
33
5
|
<div
|
|
34
6
|
class="pf-c-text-input-group"
|
|
35
7
|
>
|
|
36
|
-
|
|
37
|
-
class="pf-c-text-input-group__main"
|
|
38
|
-
>
|
|
39
|
-
Foo
|
|
40
|
-
<span
|
|
41
|
-
class="pf-c-text-input-group__text"
|
|
42
|
-
>
|
|
43
|
-
<input
|
|
44
|
-
aria-label="Type to filter"
|
|
45
|
-
class="pf-c-text-input-group__text-input"
|
|
46
|
-
type="text"
|
|
47
|
-
value=""
|
|
48
|
-
/>
|
|
49
|
-
</span>
|
|
50
|
-
</div>
|
|
51
|
-
<div
|
|
52
|
-
class="pf-c-text-input-group__utilities"
|
|
53
|
-
/>
|
|
54
|
-
</div>
|
|
55
|
-
</DocumentFragment>
|
|
56
|
-
`;
|
|
57
|
-
|
|
58
|
-
exports[`TextInputGroup renders with the proper stying when disabled 1`] = `
|
|
59
|
-
<DocumentFragment>
|
|
60
|
-
<div
|
|
61
|
-
class="pf-c-text-input-group pf-m-disabled"
|
|
62
|
-
>
|
|
63
|
-
<div
|
|
64
|
-
class="pf-c-text-input-group__main"
|
|
65
|
-
>
|
|
66
|
-
Foo
|
|
67
|
-
<span
|
|
68
|
-
class="pf-c-text-input-group__text"
|
|
69
|
-
>
|
|
70
|
-
<input
|
|
71
|
-
aria-label="Type to filter"
|
|
72
|
-
class="pf-c-text-input-group__text-input"
|
|
73
|
-
disabled=""
|
|
74
|
-
type="text"
|
|
75
|
-
value=""
|
|
76
|
-
/>
|
|
77
|
-
</span>
|
|
78
|
-
</div>
|
|
79
|
-
<div
|
|
80
|
-
class="pf-c-text-input-group__utilities"
|
|
81
|
-
/>
|
|
82
|
-
</div>
|
|
83
|
-
</DocumentFragment>
|
|
84
|
-
`;
|
|
85
|
-
|
|
86
|
-
exports[`TextInputGroupMain input is disabled when TextInputGroupContext isDisabled is true 1`] = `
|
|
87
|
-
<DocumentFragment>
|
|
88
|
-
<div
|
|
89
|
-
class="pf-c-text-input-group__main"
|
|
90
|
-
>
|
|
91
|
-
<span
|
|
92
|
-
class="pf-c-text-input-group__text"
|
|
93
|
-
>
|
|
94
|
-
<input
|
|
95
|
-
aria-label="Type to filter"
|
|
96
|
-
class="pf-c-text-input-group__text-input"
|
|
97
|
-
disabled=""
|
|
98
|
-
type="text"
|
|
99
|
-
value=""
|
|
100
|
-
/>
|
|
101
|
-
</span>
|
|
102
|
-
</div>
|
|
103
|
-
</DocumentFragment>
|
|
104
|
-
`;
|
|
105
|
-
|
|
106
|
-
exports[`TextInputGroupMain input is not disabled when TextInputGroupContext isDisabled is false 1`] = `
|
|
107
|
-
<DocumentFragment>
|
|
108
|
-
<div
|
|
109
|
-
class="pf-c-text-input-group__main"
|
|
110
|
-
>
|
|
111
|
-
<span
|
|
112
|
-
class="pf-c-text-input-group__text"
|
|
113
|
-
>
|
|
114
|
-
<input
|
|
115
|
-
aria-label="Type to filter"
|
|
116
|
-
class="pf-c-text-input-group__text-input"
|
|
117
|
-
type="text"
|
|
118
|
-
value=""
|
|
119
|
-
/>
|
|
120
|
-
</span>
|
|
121
|
-
</div>
|
|
122
|
-
</DocumentFragment>
|
|
123
|
-
`;
|
|
124
|
-
|
|
125
|
-
exports[`TextInputGroupMain renders content 1`] = `
|
|
126
|
-
<DocumentFragment>
|
|
127
|
-
<div
|
|
128
|
-
class="pf-c-text-input-group__main"
|
|
129
|
-
>
|
|
130
|
-
Foo
|
|
131
|
-
<span
|
|
132
|
-
class="pf-c-text-input-group__text"
|
|
133
|
-
>
|
|
134
|
-
<input
|
|
135
|
-
aria-label="Type to filter"
|
|
136
|
-
class="pf-c-text-input-group__text-input"
|
|
137
|
-
type="text"
|
|
138
|
-
value=""
|
|
139
|
-
/>
|
|
140
|
-
</span>
|
|
141
|
-
</div>
|
|
142
|
-
</DocumentFragment>
|
|
143
|
-
`;
|
|
144
|
-
|
|
145
|
-
exports[`TextInputGroupMain renders given input icon props 1`] = `
|
|
146
|
-
<DocumentFragment>
|
|
147
|
-
<div
|
|
148
|
-
class="pf-c-text-input-group__main pf-m-icon"
|
|
149
|
-
>
|
|
150
|
-
Foo
|
|
151
|
-
<span
|
|
152
|
-
class="pf-c-text-input-group__text"
|
|
153
|
-
>
|
|
154
|
-
<span
|
|
155
|
-
class="pf-c-text-input-group__icon"
|
|
156
|
-
>
|
|
157
|
-
<svg
|
|
158
|
-
aria-hidden="true"
|
|
159
|
-
fill="currentColor"
|
|
160
|
-
height="1em"
|
|
161
|
-
role="img"
|
|
162
|
-
style="vertical-align: -0.125em;"
|
|
163
|
-
viewBox="0 0 512 512"
|
|
164
|
-
width="1em"
|
|
165
|
-
>
|
|
166
|
-
<path
|
|
167
|
-
d="M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"
|
|
168
|
-
/>
|
|
169
|
-
</svg>
|
|
170
|
-
</span>
|
|
171
|
-
<input
|
|
172
|
-
aria-label="Type to filter"
|
|
173
|
-
class="pf-c-text-input-group__text-input"
|
|
174
|
-
type="text"
|
|
175
|
-
value=""
|
|
176
|
-
/>
|
|
177
|
-
</span>
|
|
178
|
-
</div>
|
|
179
|
-
</DocumentFragment>
|
|
180
|
-
`;
|
|
181
|
-
|
|
182
|
-
exports[`TextInputGroupMain renders the input with custom aria label when given 1`] = `
|
|
183
|
-
<DocumentFragment>
|
|
184
|
-
<div
|
|
185
|
-
class="pf-c-text-input-group__main"
|
|
186
|
-
>
|
|
187
|
-
Foo
|
|
188
|
-
<span
|
|
189
|
-
class="pf-c-text-input-group__text"
|
|
190
|
-
>
|
|
191
|
-
<input
|
|
192
|
-
aria-label="Foo"
|
|
193
|
-
class="pf-c-text-input-group__text-input"
|
|
194
|
-
type="text"
|
|
195
|
-
value=""
|
|
196
|
-
/>
|
|
197
|
-
</span>
|
|
198
|
-
</div>
|
|
199
|
-
</DocumentFragment>
|
|
200
|
-
`;
|
|
201
|
-
|
|
202
|
-
exports[`TextInputGroupUtilities renders the content 1`] = `
|
|
203
|
-
<DocumentFragment>
|
|
204
|
-
<div
|
|
205
|
-
class="pf-c-text-input-group__utilities"
|
|
206
|
-
>
|
|
207
|
-
<button>
|
|
208
|
-
Foo
|
|
209
|
-
</button>
|
|
8
|
+
Test
|
|
210
9
|
</div>
|
|
211
10
|
</DocumentFragment>
|
|
212
11
|
`;
|
package/src/components/TextInputGroup/__tests__/__snapshots__/TextInputGroupMain.test.tsx.snap
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`TextInputGroupMain matches the snapshot 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<div
|
|
6
|
+
class="pf-c-text-input-group__main"
|
|
7
|
+
>
|
|
8
|
+
Test
|
|
9
|
+
<span
|
|
10
|
+
class="pf-c-text-input-group__text"
|
|
11
|
+
>
|
|
12
|
+
<input
|
|
13
|
+
aria-label="Type to filter"
|
|
14
|
+
class="pf-c-text-input-group__text-input"
|
|
15
|
+
type="text"
|
|
16
|
+
value=""
|
|
17
|
+
/>
|
|
18
|
+
</span>
|
|
19
|
+
</div>
|
|
20
|
+
</DocumentFragment>
|
|
21
|
+
`;
|
package/src/demos/Tabs.md
CHANGED
|
@@ -453,6 +453,11 @@ TabsOpenWithSecondaryTabsDemo = () => {
|
|
|
453
453
|
```js isFullscreen file="./examples/Tabs/TabsAndTable.tsx"
|
|
454
454
|
```
|
|
455
455
|
|
|
456
|
+
### Tables and tabs, auto width tabs
|
|
457
|
+
|
|
458
|
+
```js isFullscreen file="./examples/Tabs/TabsAndTablesAutoWidthTabs.tsx"
|
|
459
|
+
```
|
|
460
|
+
|
|
456
461
|
### Modal tabs
|
|
457
462
|
|
|
458
463
|
```js isFullscreen file="./examples/Tabs/ModalTabs.tsx"
|