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