@instructure/ui-drilldown 10.16.1-snapshot-0 → 10.16.1
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 +1 -1
- package/es/Drilldown/DrilldownGroup/__new-tests__/DrilldownGroup.test.js +448 -325
- package/es/Drilldown/DrilldownGroup/index.js +0 -1
- package/es/Drilldown/DrilldownOption/__new-tests__/DrilldownOption.test.js +422 -309
- package/es/Drilldown/DrilldownOption/index.js +0 -1
- package/es/Drilldown/DrilldownPage/__new-tests__/DrilldownPage.test.js +201 -147
- package/es/Drilldown/DrilldownPage/index.js +0 -1
- package/es/Drilldown/DrilldownSeparator/__new-tests__/DrilldownSeparator.test.js +22 -17
- package/es/Drilldown/DrilldownSeparator/index.js +0 -1
- package/es/Drilldown/__examples__/Drilldown.examples.js +99 -82
- package/es/Drilldown/__new-tests__/Drilldown.test.js +533 -352
- package/es/Drilldown/index.js +144 -126
- package/lib/Drilldown/DrilldownGroup/__new-tests__/DrilldownGroup.test.js +463 -340
- package/lib/Drilldown/DrilldownGroup/index.js +0 -1
- package/lib/Drilldown/DrilldownOption/__new-tests__/DrilldownOption.test.js +448 -336
- package/lib/Drilldown/DrilldownOption/index.js +0 -1
- package/lib/Drilldown/DrilldownPage/__new-tests__/DrilldownPage.test.js +221 -167
- package/lib/Drilldown/DrilldownPage/index.js +0 -2
- package/lib/Drilldown/DrilldownSeparator/__new-tests__/DrilldownSeparator.test.js +25 -21
- package/lib/Drilldown/DrilldownSeparator/index.js +0 -1
- package/lib/Drilldown/__examples__/Drilldown.examples.js +99 -83
- package/lib/Drilldown/__new-tests__/Drilldown.test.js +568 -387
- package/lib/Drilldown/index.js +143 -126
- package/package.json +21 -21
- package/src/Drilldown/DrilldownGroup/__new-tests__/DrilldownGroup.test.tsx +0 -1
- package/src/Drilldown/DrilldownGroup/index.tsx +0 -1
- package/src/Drilldown/DrilldownOption/__new-tests__/DrilldownOption.test.tsx +1 -1
- package/src/Drilldown/DrilldownOption/index.tsx +0 -1
- package/src/Drilldown/DrilldownPage/__new-tests__/DrilldownPage.test.tsx +0 -1
- package/src/Drilldown/DrilldownPage/index.tsx +0 -1
- package/src/Drilldown/DrilldownSeparator/__new-tests__/DrilldownSeparator.test.tsx +0 -1
- package/src/Drilldown/DrilldownSeparator/index.tsx +0 -1
- package/src/Drilldown/__examples__/Drilldown.examples.tsx +0 -2
- package/src/Drilldown/__new-tests__/Drilldown.test.tsx +0 -1
- package/src/Drilldown/index.tsx +4 -6
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Drilldown/DrilldownGroup/__new-tests__/DrilldownGroup.test.d.ts.map +1 -1
- package/types/Drilldown/DrilldownGroup/index.d.ts +0 -1
- package/types/Drilldown/DrilldownGroup/index.d.ts.map +1 -1
- package/types/Drilldown/DrilldownOption/index.d.ts +0 -1
- package/types/Drilldown/DrilldownOption/index.d.ts.map +1 -1
- package/types/Drilldown/DrilldownPage/__new-tests__/DrilldownPage.test.d.ts.map +1 -1
- package/types/Drilldown/DrilldownPage/index.d.ts +0 -1
- package/types/Drilldown/DrilldownPage/index.d.ts.map +1 -1
- package/types/Drilldown/DrilldownSeparator/__new-tests__/DrilldownSeparator.test.d.ts.map +1 -1
- package/types/Drilldown/DrilldownSeparator/index.d.ts +0 -1
- package/types/Drilldown/DrilldownSeparator/index.d.ts.map +1 -1
- package/types/Drilldown/__examples__/Drilldown.examples.d.ts.map +1 -1
- package/types/Drilldown/__new-tests__/Drilldown.test.d.ts.map +1 -1
- package/types/Drilldown/index.d.ts +7 -10
- package/types/Drilldown/index.d.ts.map +1 -1
|
@@ -22,13 +22,14 @@ var _Drilldown, _Drilldown$Option, _Drilldown2, _Drilldown3, _Drilldown4, _Drill
|
|
|
22
22
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
import { render, screen, waitFor } from '@testing-library/react';
|
|
27
27
|
import { vi } from 'vitest';
|
|
28
28
|
import userEvent from '@testing-library/user-event';
|
|
29
29
|
import '@testing-library/jest-dom';
|
|
30
30
|
import { IconCheckSolid } from '@instructure/ui-icons';
|
|
31
31
|
import { Drilldown } from '../../index';
|
|
32
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
32
33
|
describe('<Drilldown.Option />', () => {
|
|
33
34
|
let consoleWarningMock;
|
|
34
35
|
let consoleErrorMock;
|
|
@@ -42,22 +43,29 @@ describe('<Drilldown.Option />', () => {
|
|
|
42
43
|
consoleErrorMock.mockRestore();
|
|
43
44
|
});
|
|
44
45
|
it('should allow setting "selected" property on Options', async () => {
|
|
45
|
-
render(_Drilldown || (_Drilldown =
|
|
46
|
-
rootPageId: "page0"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
46
|
+
render(_Drilldown || (_Drilldown = _jsx(Drilldown, {
|
|
47
|
+
rootPageId: "page0",
|
|
48
|
+
children: _jsx(Drilldown.Page, {
|
|
49
|
+
id: "page0",
|
|
50
|
+
children: _jsxs(Drilldown.Group, {
|
|
51
|
+
id: "group0",
|
|
52
|
+
children: [_jsx(Drilldown.Option, {
|
|
53
|
+
id: "groupOption01",
|
|
54
|
+
children: "Option - 1"
|
|
55
|
+
}), _jsx(Drilldown.Option, {
|
|
56
|
+
selected: true,
|
|
57
|
+
id: "groupOption02",
|
|
58
|
+
children: "Option - 2"
|
|
59
|
+
}), _jsx(Drilldown.Option, {
|
|
60
|
+
id: "groupOption03",
|
|
61
|
+
children: "Option - 3"
|
|
62
|
+
}), _jsx(Drilldown.Option, {
|
|
63
|
+
id: "groupOption04",
|
|
64
|
+
children: "Option - 4"
|
|
65
|
+
})]
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
})));
|
|
61
69
|
const selectedOption = screen.getByLabelText('Option - 2');
|
|
62
70
|
expect(selectedOption).toBeInTheDocument();
|
|
63
71
|
expect(selectedOption).toHaveAttribute('id', 'groupOption02');
|
|
@@ -65,39 +73,52 @@ describe('<Drilldown.Option />', () => {
|
|
|
65
73
|
});
|
|
66
74
|
describe('id prop', () => {
|
|
67
75
|
it('should throw warning the id is not provided', async () => {
|
|
68
|
-
render(
|
|
69
|
-
rootPageId: "page0"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
76
|
+
render(_jsx(Drilldown, {
|
|
77
|
+
rootPageId: "page0",
|
|
78
|
+
children: _jsx(Drilldown.Page, {
|
|
79
|
+
id: "page0",
|
|
80
|
+
children: _Drilldown$Option || (_Drilldown$Option = _jsx(Drilldown.Option, {
|
|
81
|
+
children: "Option1"
|
|
82
|
+
}))
|
|
83
|
+
})
|
|
84
|
+
}));
|
|
73
85
|
const expectedErrorMessage = "Warning: Drilldown.Option without id won't be rendered. It is needed to internally track the options.";
|
|
74
86
|
expect(consoleWarningMock).toHaveBeenCalledWith(expect.stringContaining(expectedErrorMessage), expect.any(String));
|
|
75
87
|
});
|
|
76
88
|
it('should throw warning the id is duplicated', async () => {
|
|
77
|
-
render(_Drilldown2 || (_Drilldown2 =
|
|
78
|
-
rootPageId: "page0"
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
render(_Drilldown2 || (_Drilldown2 = _jsx(Drilldown, {
|
|
90
|
+
rootPageId: "page0",
|
|
91
|
+
children: _jsxs(Drilldown.Page, {
|
|
92
|
+
id: "page0",
|
|
93
|
+
children: [_jsx(Drilldown.Option, {
|
|
94
|
+
id: "option1",
|
|
95
|
+
children: "Option1"
|
|
96
|
+
}), _jsx(Drilldown.Option, {
|
|
97
|
+
id: "option1",
|
|
98
|
+
children: "Option2"
|
|
99
|
+
})]
|
|
100
|
+
})
|
|
101
|
+
})));
|
|
86
102
|
const expectedErrorMessage = 'Warning: Duplicate id: "option1"! Make sure all options have unique ids, otherwise they won\'t be rendered.';
|
|
87
103
|
expect(consoleWarningMock).toHaveBeenCalledWith(expect.stringContaining(expectedErrorMessage), expect.any(String));
|
|
88
104
|
});
|
|
89
105
|
it('should not render the options with duplicated id', async () => {
|
|
90
|
-
render(_Drilldown3 || (_Drilldown3 =
|
|
91
|
-
rootPageId: "page0"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
106
|
+
render(_Drilldown3 || (_Drilldown3 = _jsx(Drilldown, {
|
|
107
|
+
rootPageId: "page0",
|
|
108
|
+
children: _jsxs(Drilldown.Page, {
|
|
109
|
+
id: "page0",
|
|
110
|
+
children: [_jsx(Drilldown.Option, {
|
|
111
|
+
id: "option1",
|
|
112
|
+
children: "Option1"
|
|
113
|
+
}), _jsx(Drilldown.Option, {
|
|
114
|
+
id: "option1",
|
|
115
|
+
children: "Option2"
|
|
116
|
+
}), _jsx(Drilldown.Option, {
|
|
117
|
+
id: "option1",
|
|
118
|
+
children: "Option3"
|
|
119
|
+
})]
|
|
120
|
+
})
|
|
121
|
+
})));
|
|
101
122
|
const menuitems = screen.queryAllByRole('menuitem');
|
|
102
123
|
const option = screen.queryByText('Option2');
|
|
103
124
|
expect(menuitems.length).toBe(0);
|
|
@@ -106,25 +127,31 @@ describe('<Drilldown.Option />', () => {
|
|
|
106
127
|
});
|
|
107
128
|
describe('children function prop', () => {
|
|
108
129
|
it('should throw warning if it returns nothing', async () => {
|
|
109
|
-
render(
|
|
110
|
-
rootPageId: "page0"
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
130
|
+
render(_jsx(Drilldown, {
|
|
131
|
+
rootPageId: "page0",
|
|
132
|
+
children: _jsx(Drilldown.Page, {
|
|
133
|
+
id: "page0",
|
|
134
|
+
children: _jsx(Drilldown.Option, {
|
|
135
|
+
id: "option1",
|
|
136
|
+
children: () => null
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
}));
|
|
116
140
|
const expectedErrorMessage = 'Warning: There are no "children" prop provided for option with id: "option1", so it won\'t be rendered.';
|
|
117
141
|
expect(consoleWarningMock).toHaveBeenCalledWith(expect.stringContaining(expectedErrorMessage), expect.any(String));
|
|
118
142
|
});
|
|
119
143
|
it('should provide props as parameters', async () => {
|
|
120
144
|
const childrenFunction = vi.fn(() => 'Option');
|
|
121
|
-
render(
|
|
122
|
-
rootPageId: "page0"
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
145
|
+
render(_jsx(Drilldown, {
|
|
146
|
+
rootPageId: "page0",
|
|
147
|
+
children: _jsx(Drilldown.Page, {
|
|
148
|
+
id: "page0",
|
|
149
|
+
children: _jsx(Drilldown.Option, {
|
|
150
|
+
id: "option1",
|
|
151
|
+
children: childrenFunction
|
|
152
|
+
})
|
|
153
|
+
})
|
|
154
|
+
}));
|
|
128
155
|
expect(childrenFunction).toHaveBeenCalledWith({
|
|
129
156
|
id: 'option1',
|
|
130
157
|
variant: 'default',
|
|
@@ -135,14 +162,17 @@ describe('<Drilldown.Option />', () => {
|
|
|
135
162
|
describe('elementRef prop', () => {
|
|
136
163
|
it('should give back to ref for the option wrapper (Options.Item)', async () => {
|
|
137
164
|
const elementRef = vi.fn();
|
|
138
|
-
const _render = render(
|
|
139
|
-
rootPageId: "page0"
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
165
|
+
const _render = render(_jsx(Drilldown, {
|
|
166
|
+
rootPageId: "page0",
|
|
167
|
+
children: _jsx(Drilldown.Page, {
|
|
168
|
+
id: "page0",
|
|
169
|
+
children: _jsx(Drilldown.Option, {
|
|
170
|
+
id: "option1",
|
|
171
|
+
elementRef: elementRef,
|
|
172
|
+
children: "Option"
|
|
173
|
+
})
|
|
174
|
+
})
|
|
175
|
+
})),
|
|
146
176
|
container = _render.container;
|
|
147
177
|
const option = container.querySelector('li');
|
|
148
178
|
expect(elementRef).toHaveBeenCalledWith(option);
|
|
@@ -150,28 +180,34 @@ describe('<Drilldown.Option />', () => {
|
|
|
150
180
|
});
|
|
151
181
|
describe('subPageId prop', () => {
|
|
152
182
|
it('should display arrow icon', async () => {
|
|
153
|
-
const _render2 = render(_Drilldown4 || (_Drilldown4 =
|
|
154
|
-
rootPageId: "page0"
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
183
|
+
const _render2 = render(_Drilldown4 || (_Drilldown4 = _jsx(Drilldown, {
|
|
184
|
+
rootPageId: "page0",
|
|
185
|
+
children: _jsx(Drilldown.Page, {
|
|
186
|
+
id: "page0",
|
|
187
|
+
children: _jsx(Drilldown.Option, {
|
|
188
|
+
id: "option1",
|
|
189
|
+
subPageId: "page1",
|
|
190
|
+
children: "Option"
|
|
191
|
+
})
|
|
192
|
+
})
|
|
193
|
+
}))),
|
|
161
194
|
container = _render2.container;
|
|
162
195
|
const icon = container.querySelector('svg');
|
|
163
196
|
expect(icon).toBeInTheDocument();
|
|
164
197
|
expect(icon).toHaveAttribute('name', 'IconArrowOpenEnd');
|
|
165
198
|
});
|
|
166
199
|
it('should indicate subpage fo SR', async () => {
|
|
167
|
-
render(_Drilldown5 || (_Drilldown5 =
|
|
168
|
-
rootPageId: "page0"
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
200
|
+
render(_Drilldown5 || (_Drilldown5 = _jsx(Drilldown, {
|
|
201
|
+
rootPageId: "page0",
|
|
202
|
+
children: _jsx(Drilldown.Page, {
|
|
203
|
+
id: "page0",
|
|
204
|
+
children: _jsx(Drilldown.Option, {
|
|
205
|
+
id: "option1",
|
|
206
|
+
subPageId: "page1",
|
|
207
|
+
children: "Option"
|
|
208
|
+
})
|
|
209
|
+
})
|
|
210
|
+
})));
|
|
175
211
|
const option = screen.getByLabelText('Option');
|
|
176
212
|
expect(option).toHaveAttribute('role', 'button');
|
|
177
213
|
expect(option).toHaveAttribute('aria-haspopup', 'true');
|
|
@@ -179,42 +215,51 @@ describe('<Drilldown.Option />', () => {
|
|
|
179
215
|
});
|
|
180
216
|
describe('disabled prop', () => {
|
|
181
217
|
it('should mark option as disabled for SR', async () => {
|
|
182
|
-
render(_Drilldown6 || (_Drilldown6 =
|
|
183
|
-
rootPageId: "page0"
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
218
|
+
render(_Drilldown6 || (_Drilldown6 = _jsx(Drilldown, {
|
|
219
|
+
rootPageId: "page0",
|
|
220
|
+
children: _jsx(Drilldown.Page, {
|
|
221
|
+
id: "page0",
|
|
222
|
+
children: _jsx(Drilldown.Option, {
|
|
223
|
+
id: "option1",
|
|
224
|
+
disabled: true,
|
|
225
|
+
children: "Option"
|
|
226
|
+
})
|
|
227
|
+
})
|
|
228
|
+
})));
|
|
190
229
|
const option = screen.getByLabelText('Option');
|
|
191
230
|
expect(option).toHaveAttribute('aria-disabled', 'true');
|
|
192
231
|
});
|
|
193
232
|
});
|
|
194
233
|
describe('href prop', () => {
|
|
195
234
|
it('should display option as link', async () => {
|
|
196
|
-
render(_Drilldown7 || (_Drilldown7 =
|
|
197
|
-
rootPageId: "page0"
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
235
|
+
render(_Drilldown7 || (_Drilldown7 = _jsx(Drilldown, {
|
|
236
|
+
rootPageId: "page0",
|
|
237
|
+
children: _jsx(Drilldown.Page, {
|
|
238
|
+
id: "page0",
|
|
239
|
+
children: _jsx(Drilldown.Option, {
|
|
240
|
+
id: "option1",
|
|
241
|
+
href: "/helloWorld",
|
|
242
|
+
children: "Option"
|
|
243
|
+
})
|
|
244
|
+
})
|
|
245
|
+
})));
|
|
204
246
|
const option = screen.getByLabelText('Option');
|
|
205
247
|
expect(option.tagName).toBe('A');
|
|
206
248
|
expect(option).toHaveAttribute('href', '/helloWorld');
|
|
207
249
|
});
|
|
208
250
|
it('should throw warning if subPageId is provided too', async () => {
|
|
209
|
-
render(_Drilldown8 || (_Drilldown8 =
|
|
210
|
-
rootPageId: "page0"
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
251
|
+
render(_Drilldown8 || (_Drilldown8 = _jsx(Drilldown, {
|
|
252
|
+
rootPageId: "page0",
|
|
253
|
+
children: _jsx(Drilldown.Page, {
|
|
254
|
+
id: "page0",
|
|
255
|
+
children: _jsx(Drilldown.Option, {
|
|
256
|
+
id: "option1",
|
|
257
|
+
href: "/helloWorld",
|
|
258
|
+
subPageId: "page1",
|
|
259
|
+
children: "Option"
|
|
260
|
+
})
|
|
261
|
+
})
|
|
262
|
+
})));
|
|
218
263
|
const option = screen.getByLabelText('Option');
|
|
219
264
|
const expectedErrorMessage = 'Warning: Drilldown.Option with id "option1" has subPageId, so it will ignore the "href" property.';
|
|
220
265
|
expect(consoleWarningMock).toHaveBeenCalledWith(expect.stringContaining(expectedErrorMessage), expect.any(String));
|
|
@@ -222,17 +267,21 @@ describe('<Drilldown.Option />', () => {
|
|
|
222
267
|
expect(option).not.toHaveAttribute('href');
|
|
223
268
|
});
|
|
224
269
|
it('should throw warning if option is in selectable group', async () => {
|
|
225
|
-
render(_Drilldown9 || (_Drilldown9 =
|
|
226
|
-
rootPageId: "page0"
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
270
|
+
render(_Drilldown9 || (_Drilldown9 = _jsx(Drilldown, {
|
|
271
|
+
rootPageId: "page0",
|
|
272
|
+
children: _jsx(Drilldown.Page, {
|
|
273
|
+
id: "page0",
|
|
274
|
+
children: _jsx(Drilldown.Group, {
|
|
275
|
+
id: "group0",
|
|
276
|
+
selectableType: "multiple",
|
|
277
|
+
children: _jsx(Drilldown.Option, {
|
|
278
|
+
id: "groupOption01",
|
|
279
|
+
href: "/helloWorld",
|
|
280
|
+
children: "Option"
|
|
281
|
+
})
|
|
282
|
+
})
|
|
283
|
+
})
|
|
284
|
+
})));
|
|
236
285
|
const option = screen.getByLabelText('Option');
|
|
237
286
|
const expectedErrorMessage = 'Warning: Drilldown.Option with id "groupOption01" is in a selectable group, so it will ignore the "href" property.';
|
|
238
287
|
expect(consoleWarningMock).toHaveBeenCalledWith(expect.stringContaining(expectedErrorMessage), expect.any(String));
|
|
@@ -242,43 +291,52 @@ describe('<Drilldown.Option />', () => {
|
|
|
242
291
|
});
|
|
243
292
|
describe('as prop', () => {
|
|
244
293
|
it('should render option as `li` by default', async () => {
|
|
245
|
-
render(_Drilldown10 || (_Drilldown10 =
|
|
246
|
-
rootPageId: "page0"
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
294
|
+
render(_Drilldown10 || (_Drilldown10 = _jsx(Drilldown, {
|
|
295
|
+
rootPageId: "page0",
|
|
296
|
+
children: _jsx(Drilldown.Page, {
|
|
297
|
+
id: "page0",
|
|
298
|
+
children: _jsx(Drilldown.Option, {
|
|
299
|
+
id: "option1",
|
|
300
|
+
children: "Option"
|
|
301
|
+
})
|
|
302
|
+
})
|
|
303
|
+
})));
|
|
252
304
|
const option = screen.getByLabelText('Option');
|
|
253
305
|
const wrapper = option.parentElement;
|
|
254
306
|
expect(option).toHaveAttribute('id', 'option1');
|
|
255
307
|
expect(wrapper === null || wrapper === void 0 ? void 0 : wrapper.tagName).toBe('LI');
|
|
256
308
|
});
|
|
257
309
|
it('should force option to be `li` while the parent is "ul" or "ol"', async () => {
|
|
258
|
-
render(_Drilldown11 || (_Drilldown11 =
|
|
310
|
+
render(_Drilldown11 || (_Drilldown11 = _jsx(Drilldown, {
|
|
259
311
|
rootPageId: "page0",
|
|
260
|
-
as: "ol"
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
312
|
+
as: "ol",
|
|
313
|
+
children: _jsx(Drilldown.Page, {
|
|
314
|
+
id: "page0",
|
|
315
|
+
children: _jsx(Drilldown.Option, {
|
|
316
|
+
id: "option1",
|
|
317
|
+
as: "div",
|
|
318
|
+
children: "Option"
|
|
319
|
+
})
|
|
320
|
+
})
|
|
321
|
+
})));
|
|
267
322
|
const option = screen.getByLabelText('Option');
|
|
268
323
|
const wrapper = option.parentElement;
|
|
269
324
|
expect(option).toHaveAttribute('id', 'option1');
|
|
270
325
|
expect(wrapper === null || wrapper === void 0 ? void 0 : wrapper.tagName).toBe('LI');
|
|
271
326
|
});
|
|
272
327
|
it('should render option as specified html element, when the parent in non-list element', async () => {
|
|
273
|
-
render(_Drilldown12 || (_Drilldown12 =
|
|
328
|
+
render(_Drilldown12 || (_Drilldown12 = _jsx(Drilldown, {
|
|
274
329
|
rootPageId: "page0",
|
|
275
|
-
as: "div"
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
330
|
+
as: "div",
|
|
331
|
+
children: _jsx(Drilldown.Page, {
|
|
332
|
+
id: "page0",
|
|
333
|
+
children: _jsx(Drilldown.Option, {
|
|
334
|
+
id: "option1",
|
|
335
|
+
as: "div",
|
|
336
|
+
children: "Option"
|
|
337
|
+
})
|
|
338
|
+
})
|
|
339
|
+
})));
|
|
282
340
|
const option = screen.getByLabelText('Option');
|
|
283
341
|
const wrapper = option.parentElement;
|
|
284
342
|
expect(option).toHaveAttribute('id', 'option1');
|
|
@@ -287,39 +345,48 @@ describe('<Drilldown.Option />', () => {
|
|
|
287
345
|
});
|
|
288
346
|
describe('role prop', () => {
|
|
289
347
|
it('should be "menuitem" by default', async () => {
|
|
290
|
-
render(_Drilldown13 || (_Drilldown13 =
|
|
291
|
-
rootPageId: "page0"
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
348
|
+
render(_Drilldown13 || (_Drilldown13 = _jsx(Drilldown, {
|
|
349
|
+
rootPageId: "page0",
|
|
350
|
+
children: _jsx(Drilldown.Page, {
|
|
351
|
+
id: "page0",
|
|
352
|
+
children: _jsx(Drilldown.Option, {
|
|
353
|
+
id: "option1",
|
|
354
|
+
children: "Option"
|
|
355
|
+
})
|
|
356
|
+
})
|
|
357
|
+
})));
|
|
297
358
|
const option = screen.getByLabelText('Option');
|
|
298
359
|
expect(option).toHaveAttribute('role', 'menuitem');
|
|
299
360
|
});
|
|
300
361
|
it('should be applied on prop', async () => {
|
|
301
|
-
render(_Drilldown14 || (_Drilldown14 =
|
|
302
|
-
rootPageId: "page0"
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
362
|
+
render(_Drilldown14 || (_Drilldown14 = _jsx(Drilldown, {
|
|
363
|
+
rootPageId: "page0",
|
|
364
|
+
children: _jsx(Drilldown.Page, {
|
|
365
|
+
id: "page0",
|
|
366
|
+
children: _jsx(Drilldown.Option, {
|
|
367
|
+
id: "option1",
|
|
368
|
+
role: "presentation",
|
|
369
|
+
children: "Option"
|
|
370
|
+
})
|
|
371
|
+
})
|
|
372
|
+
})));
|
|
309
373
|
const option = screen.getByLabelText('Option');
|
|
310
374
|
expect(option).toHaveAttribute('role', 'presentation');
|
|
311
375
|
});
|
|
312
376
|
});
|
|
313
377
|
describe('renderLabelInfo prop', () => {
|
|
314
378
|
it('should display tag next to the label', async () => {
|
|
315
|
-
const _render3 = render(_Drilldown15 || (_Drilldown15 =
|
|
316
|
-
rootPageId: "page0"
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
379
|
+
const _render3 = render(_Drilldown15 || (_Drilldown15 = _jsx(Drilldown, {
|
|
380
|
+
rootPageId: "page0",
|
|
381
|
+
children: _jsx(Drilldown.Page, {
|
|
382
|
+
id: "page0",
|
|
383
|
+
children: _jsx(Drilldown.Option, {
|
|
384
|
+
id: "option1",
|
|
385
|
+
renderLabelInfo: "Info",
|
|
386
|
+
children: "Option"
|
|
387
|
+
})
|
|
388
|
+
})
|
|
389
|
+
}))),
|
|
323
390
|
container = _render3.container;
|
|
324
391
|
const tag = container.querySelector('[class$="optionLabelInfo"]');
|
|
325
392
|
expect(tag).toBeInTheDocument();
|
|
@@ -327,14 +394,17 @@ describe('<Drilldown.Option />', () => {
|
|
|
327
394
|
});
|
|
328
395
|
it('as function should have option props as params', async () => {
|
|
329
396
|
const infoFunction = vi.fn(() => 'Info');
|
|
330
|
-
render(
|
|
331
|
-
rootPageId: "page0"
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
397
|
+
render(_jsx(Drilldown, {
|
|
398
|
+
rootPageId: "page0",
|
|
399
|
+
children: _jsx(Drilldown.Page, {
|
|
400
|
+
id: "page0",
|
|
401
|
+
children: _jsx(Drilldown.Option, {
|
|
402
|
+
id: "option1",
|
|
403
|
+
renderLabelInfo: infoFunction,
|
|
404
|
+
children: "Option"
|
|
405
|
+
})
|
|
406
|
+
})
|
|
407
|
+
}));
|
|
338
408
|
expect(infoFunction).toHaveBeenCalledWith({
|
|
339
409
|
variant: 'default',
|
|
340
410
|
vAlign: 'start',
|
|
@@ -346,29 +416,35 @@ describe('<Drilldown.Option />', () => {
|
|
|
346
416
|
});
|
|
347
417
|
describe('renderBeforeLabel prop', () => {
|
|
348
418
|
it('should display icon before the label', async () => {
|
|
349
|
-
const _render4 = render(_Drilldown16 || (_Drilldown16 =
|
|
350
|
-
rootPageId: "page0"
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
419
|
+
const _render4 = render(_Drilldown16 || (_Drilldown16 = _jsx(Drilldown, {
|
|
420
|
+
rootPageId: "page0",
|
|
421
|
+
children: _jsx(Drilldown.Page, {
|
|
422
|
+
id: "page0",
|
|
423
|
+
children: _jsx(Drilldown.Option, {
|
|
424
|
+
id: "option1",
|
|
425
|
+
renderBeforeLabel: _jsx(IconCheckSolid, {}),
|
|
426
|
+
children: "Option"
|
|
427
|
+
})
|
|
428
|
+
})
|
|
429
|
+
}))),
|
|
357
430
|
container = _render4.container;
|
|
358
431
|
const icon = container.querySelector('svg');
|
|
359
432
|
expect(icon).toBeInTheDocument();
|
|
360
433
|
expect(icon).toHaveAttribute('name', 'IconCheck');
|
|
361
434
|
});
|
|
362
435
|
it('as function should have option props as params', async () => {
|
|
363
|
-
const beforeLabelFunction = vi.fn(() => _IconCheckSolid || (_IconCheckSolid =
|
|
364
|
-
render(
|
|
365
|
-
rootPageId: "page0"
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
436
|
+
const beforeLabelFunction = vi.fn(() => _IconCheckSolid || (_IconCheckSolid = _jsx(IconCheckSolid, {})));
|
|
437
|
+
render(_jsx(Drilldown, {
|
|
438
|
+
rootPageId: "page0",
|
|
439
|
+
children: _jsx(Drilldown.Page, {
|
|
440
|
+
id: "page0",
|
|
441
|
+
children: _jsx(Drilldown.Option, {
|
|
442
|
+
id: "option1",
|
|
443
|
+
renderBeforeLabel: beforeLabelFunction,
|
|
444
|
+
children: "Option"
|
|
445
|
+
})
|
|
446
|
+
})
|
|
447
|
+
}));
|
|
372
448
|
expect(beforeLabelFunction).toHaveBeenCalledWith(expect.objectContaining({
|
|
373
449
|
variant: 'default',
|
|
374
450
|
vAlign: 'start',
|
|
@@ -378,46 +454,56 @@ describe('<Drilldown.Option />', () => {
|
|
|
378
454
|
}), expect.any(Object));
|
|
379
455
|
});
|
|
380
456
|
it('should throw warning if it is in selectable group', async () => {
|
|
381
|
-
render(_Drilldown17 || (_Drilldown17 =
|
|
382
|
-
rootPageId: "page0"
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
457
|
+
render(_Drilldown17 || (_Drilldown17 = _jsx(Drilldown, {
|
|
458
|
+
rootPageId: "page0",
|
|
459
|
+
children: _jsx(Drilldown.Page, {
|
|
460
|
+
id: "page0",
|
|
461
|
+
children: _jsx(Drilldown.Group, {
|
|
462
|
+
id: "group1",
|
|
463
|
+
selectableType: "multiple",
|
|
464
|
+
children: _jsx(Drilldown.Option, {
|
|
465
|
+
id: "groupOption1",
|
|
466
|
+
renderBeforeLabel: "Before",
|
|
467
|
+
children: "Option"
|
|
468
|
+
})
|
|
469
|
+
})
|
|
470
|
+
})
|
|
471
|
+
})));
|
|
392
472
|
const expectedErrorMessage = 'Warning: The prop "renderBeforeLabel" is reserved on item with id: "groupOption1". When this option is a selectable member of a Drilldown.Group, selection indicator will render before the label.';
|
|
393
473
|
expect(consoleWarningMock).toHaveBeenCalledWith(expect.stringContaining(expectedErrorMessage), expect.any(String));
|
|
394
474
|
});
|
|
395
475
|
});
|
|
396
476
|
describe('renderAfterLabel prop', () => {
|
|
397
477
|
it('should display icon before the label', async () => {
|
|
398
|
-
const _render5 = render(_Drilldown18 || (_Drilldown18 =
|
|
399
|
-
rootPageId: "page0"
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
478
|
+
const _render5 = render(_Drilldown18 || (_Drilldown18 = _jsx(Drilldown, {
|
|
479
|
+
rootPageId: "page0",
|
|
480
|
+
children: _jsx(Drilldown.Page, {
|
|
481
|
+
id: "page0",
|
|
482
|
+
children: _jsx(Drilldown.Option, {
|
|
483
|
+
id: "option1",
|
|
484
|
+
renderAfterLabel: _jsx(IconCheckSolid, {}),
|
|
485
|
+
children: "Option"
|
|
486
|
+
})
|
|
487
|
+
})
|
|
488
|
+
}))),
|
|
406
489
|
container = _render5.container;
|
|
407
490
|
const icon = container.querySelector('svg');
|
|
408
491
|
expect(icon).toBeInTheDocument();
|
|
409
492
|
expect(icon).toHaveAttribute('name', 'IconCheck');
|
|
410
493
|
});
|
|
411
494
|
it('as function should have option props as params', async () => {
|
|
412
|
-
const beforeLabelFunction = vi.fn(() => _IconCheckSolid2 || (_IconCheckSolid2 =
|
|
413
|
-
render(
|
|
414
|
-
rootPageId: "page0"
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
495
|
+
const beforeLabelFunction = vi.fn(() => _IconCheckSolid2 || (_IconCheckSolid2 = _jsx(IconCheckSolid, {})));
|
|
496
|
+
render(_jsx(Drilldown, {
|
|
497
|
+
rootPageId: "page0",
|
|
498
|
+
children: _jsx(Drilldown.Page, {
|
|
499
|
+
id: "page0",
|
|
500
|
+
children: _jsx(Drilldown.Option, {
|
|
501
|
+
id: "option1",
|
|
502
|
+
renderAfterLabel: beforeLabelFunction,
|
|
503
|
+
children: "Option"
|
|
504
|
+
})
|
|
505
|
+
})
|
|
506
|
+
}));
|
|
421
507
|
expect(beforeLabelFunction).toHaveBeenCalledWith(expect.objectContaining({
|
|
422
508
|
variant: 'default',
|
|
423
509
|
vAlign: 'start',
|
|
@@ -427,56 +513,68 @@ describe('<Drilldown.Option />', () => {
|
|
|
427
513
|
}), expect.any(Object));
|
|
428
514
|
});
|
|
429
515
|
it('should throw warning if it has subPageId', async () => {
|
|
430
|
-
render(_Drilldown19 || (_Drilldown19 =
|
|
431
|
-
rootPageId: "page0"
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
516
|
+
render(_Drilldown19 || (_Drilldown19 = _jsx(Drilldown, {
|
|
517
|
+
rootPageId: "page0",
|
|
518
|
+
children: _jsx(Drilldown.Page, {
|
|
519
|
+
id: "page0",
|
|
520
|
+
children: _jsx(Drilldown.Option, {
|
|
521
|
+
id: "option1",
|
|
522
|
+
subPageId: "page1",
|
|
523
|
+
renderAfterLabel: "after",
|
|
524
|
+
children: "Option"
|
|
525
|
+
})
|
|
526
|
+
})
|
|
527
|
+
})));
|
|
439
528
|
const expectedErrorMessage = 'Warning: The prop "renderAfterLabel" is reserved on item with id: "option1". When it has "subPageId" provided, a navigation arrow will render after the label.';
|
|
440
529
|
expect(consoleWarningMock).toHaveBeenCalledWith(expect.stringContaining(expectedErrorMessage), expect.any(String));
|
|
441
530
|
});
|
|
442
531
|
});
|
|
443
532
|
describe('description prop', () => {
|
|
444
533
|
it('should display description under the option', async () => {
|
|
445
|
-
render(_Drilldown20 || (_Drilldown20 =
|
|
446
|
-
rootPageId: "page0"
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
534
|
+
render(_Drilldown20 || (_Drilldown20 = _jsx(Drilldown, {
|
|
535
|
+
rootPageId: "page0",
|
|
536
|
+
children: _jsx(Drilldown.Page, {
|
|
537
|
+
id: "page0",
|
|
538
|
+
children: _jsx(Drilldown.Option, {
|
|
539
|
+
id: "option1",
|
|
540
|
+
description: "This is a description.",
|
|
541
|
+
children: "Option"
|
|
542
|
+
})
|
|
543
|
+
})
|
|
544
|
+
})));
|
|
453
545
|
const description = screen.getByText('This is a description.');
|
|
454
546
|
expect(description).toBeInTheDocument();
|
|
455
547
|
});
|
|
456
548
|
it('as a function should display description under the option', async () => {
|
|
457
|
-
render(
|
|
458
|
-
rootPageId: "page0"
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
549
|
+
render(_jsx(Drilldown, {
|
|
550
|
+
rootPageId: "page0",
|
|
551
|
+
children: _jsx(Drilldown.Page, {
|
|
552
|
+
id: "page0",
|
|
553
|
+
children: _jsx(Drilldown.Option, {
|
|
554
|
+
id: "option1",
|
|
555
|
+
description: () => 'This is a description.',
|
|
556
|
+
children: "Option"
|
|
557
|
+
})
|
|
558
|
+
})
|
|
559
|
+
}));
|
|
465
560
|
const description = screen.getByText('This is a description.');
|
|
466
561
|
expect(description).toBeInTheDocument();
|
|
467
562
|
});
|
|
468
563
|
});
|
|
469
564
|
describe('descriptionRole prop', () => {
|
|
470
565
|
it('should set the role of description', async () => {
|
|
471
|
-
render(_Drilldown21 || (_Drilldown21 =
|
|
472
|
-
rootPageId: "page0"
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
566
|
+
render(_Drilldown21 || (_Drilldown21 = _jsx(Drilldown, {
|
|
567
|
+
rootPageId: "page0",
|
|
568
|
+
children: _jsx(Drilldown.Page, {
|
|
569
|
+
id: "page0",
|
|
570
|
+
children: _jsx(Drilldown.Option, {
|
|
571
|
+
id: "option1",
|
|
572
|
+
description: "This is a description.",
|
|
573
|
+
descriptionRole: "button",
|
|
574
|
+
children: "Option"
|
|
575
|
+
})
|
|
576
|
+
})
|
|
577
|
+
})));
|
|
480
578
|
const description = screen.getByText('This is a description.');
|
|
481
579
|
expect(description).toHaveAttribute('role', 'button');
|
|
482
580
|
});
|
|
@@ -484,14 +582,17 @@ describe('<Drilldown.Option />', () => {
|
|
|
484
582
|
describe('onOptionClick callback', () => {
|
|
485
583
|
it('should fire on click with correct params', async () => {
|
|
486
584
|
const onOptionClick = vi.fn();
|
|
487
|
-
render(
|
|
488
|
-
rootPageId: "page0"
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
585
|
+
render(_jsx(Drilldown, {
|
|
586
|
+
rootPageId: "page0",
|
|
587
|
+
children: _jsx(Drilldown.Page, {
|
|
588
|
+
id: "page0",
|
|
589
|
+
children: _jsx(Drilldown.Option, {
|
|
590
|
+
id: "option1",
|
|
591
|
+
onOptionClick: onOptionClick,
|
|
592
|
+
children: "Option"
|
|
593
|
+
})
|
|
594
|
+
})
|
|
595
|
+
}));
|
|
495
596
|
const option = screen.getByText('Option');
|
|
496
597
|
await userEvent.click(option);
|
|
497
598
|
await waitFor(() => {
|
|
@@ -506,18 +607,21 @@ describe('<Drilldown.Option />', () => {
|
|
|
506
607
|
});
|
|
507
608
|
});
|
|
508
609
|
it('should provide goToPreviousPage method that throws a warning, if there is no previous page', async () => {
|
|
509
|
-
render(
|
|
510
|
-
rootPageId: "page0"
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
610
|
+
render(_jsx(Drilldown, {
|
|
611
|
+
rootPageId: "page0",
|
|
612
|
+
children: _jsx(Drilldown.Page, {
|
|
613
|
+
id: "page0",
|
|
614
|
+
children: _jsx(Drilldown.Option, {
|
|
615
|
+
id: "option01",
|
|
616
|
+
onOptionClick: (_e, {
|
|
617
|
+
goToPreviousPage
|
|
618
|
+
}) => {
|
|
619
|
+
goToPreviousPage();
|
|
620
|
+
},
|
|
621
|
+
children: "Option"
|
|
622
|
+
})
|
|
623
|
+
})
|
|
624
|
+
}));
|
|
521
625
|
const option = screen.getByText('Option');
|
|
522
626
|
await userEvent.click(option);
|
|
523
627
|
await waitFor(() => {
|
|
@@ -527,18 +631,21 @@ describe('<Drilldown.Option />', () => {
|
|
|
527
631
|
});
|
|
528
632
|
describe('provide goToPage method', () => {
|
|
529
633
|
it("should throws warning if page doesn't exist", async () => {
|
|
530
|
-
render(
|
|
531
|
-
rootPageId: "page0"
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
634
|
+
render(_jsx(Drilldown, {
|
|
635
|
+
rootPageId: "page0",
|
|
636
|
+
children: _jsx(Drilldown.Page, {
|
|
637
|
+
id: "page0",
|
|
638
|
+
children: _jsx(Drilldown.Option, {
|
|
639
|
+
id: "option01",
|
|
640
|
+
onOptionClick: (_e, {
|
|
641
|
+
goToPage
|
|
642
|
+
}) => {
|
|
643
|
+
goToPage('page1');
|
|
644
|
+
},
|
|
645
|
+
children: "Option"
|
|
646
|
+
})
|
|
647
|
+
})
|
|
648
|
+
}));
|
|
542
649
|
const option = screen.getByText('Option');
|
|
543
650
|
await userEvent.click(option);
|
|
544
651
|
await waitFor(() => {
|
|
@@ -547,19 +654,22 @@ describe('<Drilldown.Option />', () => {
|
|
|
547
654
|
});
|
|
548
655
|
});
|
|
549
656
|
it('should throws warning if if no page id is provided', async () => {
|
|
550
|
-
render(
|
|
551
|
-
rootPageId: "page0"
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
657
|
+
render(_jsx(Drilldown, {
|
|
658
|
+
rootPageId: "page0",
|
|
659
|
+
children: _jsx(Drilldown.Page, {
|
|
660
|
+
id: "page0",
|
|
661
|
+
children: _jsx(Drilldown.Option, {
|
|
662
|
+
id: "option01",
|
|
663
|
+
onOptionClick: (_e, {
|
|
664
|
+
goToPage
|
|
665
|
+
}) => {
|
|
666
|
+
// @ts-expect-error we want this to fail
|
|
667
|
+
goToPage();
|
|
668
|
+
},
|
|
669
|
+
children: "Option"
|
|
670
|
+
})
|
|
671
|
+
})
|
|
672
|
+
}));
|
|
563
673
|
const option = screen.getByText('Option');
|
|
564
674
|
await userEvent.click(option);
|
|
565
675
|
await waitFor(() => {
|
|
@@ -568,21 +678,24 @@ describe('<Drilldown.Option />', () => {
|
|
|
568
678
|
});
|
|
569
679
|
});
|
|
570
680
|
it('should throws warning if parameter is not string', async () => {
|
|
571
|
-
render(
|
|
572
|
-
rootPageId: "page0"
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
681
|
+
render(_jsx(Drilldown, {
|
|
682
|
+
rootPageId: "page0",
|
|
683
|
+
children: _jsx(Drilldown.Page, {
|
|
684
|
+
id: "page0",
|
|
685
|
+
children: _jsx(Drilldown.Option, {
|
|
686
|
+
id: "option01",
|
|
687
|
+
onOptionClick: (_e, {
|
|
688
|
+
goToPage
|
|
689
|
+
}) => {
|
|
690
|
+
// @ts-expect-error we want this to fail
|
|
691
|
+
goToPage({
|
|
692
|
+
page: 'page1'
|
|
693
|
+
});
|
|
694
|
+
},
|
|
695
|
+
children: "Option"
|
|
696
|
+
})
|
|
697
|
+
})
|
|
698
|
+
}));
|
|
586
699
|
const option = screen.getByText('Option');
|
|
587
700
|
await userEvent.click(option);
|
|
588
701
|
await waitFor(() => {
|