@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
|
@@ -23,12 +23,12 @@ var _Drilldown, _Drilldown2, _Drilldown$Option, _Drilldown$Option2, _Drilldown3,
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import React from 'react';
|
|
27
26
|
import { render, screen, waitFor } from '@testing-library/react';
|
|
28
27
|
import { vi } from 'vitest';
|
|
29
28
|
import userEvent from '@testing-library/user-event';
|
|
30
29
|
import '@testing-library/jest-dom';
|
|
31
30
|
import { Drilldown } from '../../index';
|
|
31
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
32
32
|
describe('<Drilldown.Page />', () => {
|
|
33
33
|
let consoleWarningMock;
|
|
34
34
|
let consoleErrorMock;
|
|
@@ -42,26 +42,32 @@ describe('<Drilldown.Page />', () => {
|
|
|
42
42
|
consoleErrorMock.mockRestore();
|
|
43
43
|
});
|
|
44
44
|
it("shouldn't render non-DrilldownPage children", async () => {
|
|
45
|
-
render(_Drilldown || (_Drilldown =
|
|
46
|
-
rootPageId: "page0"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
render(_Drilldown || (_Drilldown = _jsx(Drilldown, {
|
|
46
|
+
rootPageId: "page0",
|
|
47
|
+
children: _jsx(Drilldown.Page, {
|
|
48
|
+
id: "page0",
|
|
49
|
+
children: _jsx("div", {
|
|
50
|
+
id: "testDiv",
|
|
51
|
+
children: "Div"
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
})));
|
|
52
55
|
const nonPageChild = screen.queryByText('DIV');
|
|
53
56
|
expect(nonPageChild).not.toBeInTheDocument();
|
|
54
57
|
});
|
|
55
58
|
describe('header title', () => {
|
|
56
59
|
it('should be displayed in the header', async () => {
|
|
57
|
-
const _render = render(_Drilldown2 || (_Drilldown2 =
|
|
58
|
-
rootPageId: "page0"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
const _render = render(_Drilldown2 || (_Drilldown2 = _jsx(Drilldown, {
|
|
61
|
+
rootPageId: "page0",
|
|
62
|
+
children: _jsx(Drilldown.Page, {
|
|
63
|
+
id: "page0",
|
|
64
|
+
renderTitle: "HeaderTitleString",
|
|
65
|
+
children: _jsx(Drilldown.Option, {
|
|
66
|
+
id: "option1",
|
|
67
|
+
children: "Option"
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
}))),
|
|
65
71
|
container = _render.container;
|
|
66
72
|
const titleContainer = container.querySelector('[id^="DrilldownHeader-Title-Label_"]');
|
|
67
73
|
const title = screen.queryByText('HeaderTitleString');
|
|
@@ -69,26 +75,32 @@ describe('<Drilldown.Page />', () => {
|
|
|
69
75
|
expect(title).toBeInTheDocument();
|
|
70
76
|
});
|
|
71
77
|
it('should be displayed when function is passed', async () => {
|
|
72
|
-
render(
|
|
73
|
-
rootPageId: "page0"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
render(_jsx(Drilldown, {
|
|
79
|
+
rootPageId: "page0",
|
|
80
|
+
children: _jsx(Drilldown.Page, {
|
|
81
|
+
id: "page0",
|
|
82
|
+
renderTitle: () => 'HeaderTitleFunction',
|
|
83
|
+
children: _Drilldown$Option || (_Drilldown$Option = _jsx(Drilldown.Option, {
|
|
84
|
+
id: "option1",
|
|
85
|
+
children: "Option"
|
|
86
|
+
}))
|
|
87
|
+
})
|
|
88
|
+
}));
|
|
80
89
|
const title = screen.queryByText('HeaderTitleFunction');
|
|
81
90
|
expect(title).toBeInTheDocument();
|
|
82
91
|
});
|
|
83
92
|
it("shouldn't be displayed when function has no return value", async () => {
|
|
84
|
-
const _render2 = render(
|
|
85
|
-
rootPageId: "page0"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
const _render2 = render(_jsx(Drilldown, {
|
|
94
|
+
rootPageId: "page0",
|
|
95
|
+
children: _jsx(Drilldown.Page, {
|
|
96
|
+
id: "page0",
|
|
97
|
+
renderTitle: () => null,
|
|
98
|
+
children: _Drilldown$Option2 || (_Drilldown$Option2 = _jsx(Drilldown.Option, {
|
|
99
|
+
id: "option1",
|
|
100
|
+
children: "Option"
|
|
101
|
+
}))
|
|
102
|
+
})
|
|
103
|
+
})),
|
|
92
104
|
container = _render2.container;
|
|
93
105
|
const title = container.querySelector('[id^="DrilldownHeader-Title-Label_"]');
|
|
94
106
|
const listItem = container.querySelector('li');
|
|
@@ -98,38 +110,47 @@ describe('<Drilldown.Page />', () => {
|
|
|
98
110
|
});
|
|
99
111
|
describe('header action label', () => {
|
|
100
112
|
it('should be displayed in the header', async () => {
|
|
101
|
-
render(_Drilldown3 || (_Drilldown3 =
|
|
102
|
-
rootPageId: "page0"
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
113
|
+
render(_Drilldown3 || (_Drilldown3 = _jsx(Drilldown, {
|
|
114
|
+
rootPageId: "page0",
|
|
115
|
+
children: _jsx(Drilldown.Page, {
|
|
116
|
+
id: "page0",
|
|
117
|
+
renderActionLabel: "HeaderActionLabelString",
|
|
118
|
+
children: _jsx(Drilldown.Option, {
|
|
119
|
+
id: "option1",
|
|
120
|
+
children: "Option"
|
|
121
|
+
})
|
|
122
|
+
})
|
|
123
|
+
})));
|
|
109
124
|
const actionLabel = screen.queryByText('HeaderActionLabelString');
|
|
110
125
|
expect(actionLabel).toBeInTheDocument();
|
|
111
126
|
});
|
|
112
127
|
it('should be displayed when function is passed', async () => {
|
|
113
|
-
render(
|
|
114
|
-
rootPageId: "page0"
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
128
|
+
render(_jsx(Drilldown, {
|
|
129
|
+
rootPageId: "page0",
|
|
130
|
+
children: _jsx(Drilldown.Page, {
|
|
131
|
+
id: "page0",
|
|
132
|
+
renderActionLabel: () => 'HeaderActionLabelFunction',
|
|
133
|
+
children: _Drilldown$Option3 || (_Drilldown$Option3 = _jsx(Drilldown.Option, {
|
|
134
|
+
id: "option1",
|
|
135
|
+
children: "Option"
|
|
136
|
+
}))
|
|
137
|
+
})
|
|
138
|
+
}));
|
|
121
139
|
const actionLabel = screen.queryByText('HeaderActionLabelFunction');
|
|
122
140
|
expect(actionLabel).toBeInTheDocument();
|
|
123
141
|
});
|
|
124
142
|
it("shouldn't be displayed when function has no return value", async () => {
|
|
125
|
-
const _render3 = render(
|
|
126
|
-
rootPageId: "page0"
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
143
|
+
const _render3 = render(_jsx(Drilldown, {
|
|
144
|
+
rootPageId: "page0",
|
|
145
|
+
children: _jsx(Drilldown.Page, {
|
|
146
|
+
id: "page0",
|
|
147
|
+
renderActionLabel: () => null,
|
|
148
|
+
children: _Drilldown$Option4 || (_Drilldown$Option4 = _jsx(Drilldown.Option, {
|
|
149
|
+
id: "option1",
|
|
150
|
+
children: "Option"
|
|
151
|
+
}))
|
|
152
|
+
})
|
|
153
|
+
})),
|
|
133
154
|
container = _render3.container;
|
|
134
155
|
const listItem = container.querySelector('li');
|
|
135
156
|
const title = container.querySelector('[id^="DrilldownHeader-Title-Label_"]');
|
|
@@ -138,15 +159,18 @@ describe('<Drilldown.Page />', () => {
|
|
|
138
159
|
});
|
|
139
160
|
it('should fire header action callback', async () => {
|
|
140
161
|
const actionCallback = vi.fn();
|
|
141
|
-
render(
|
|
142
|
-
rootPageId: "page0"
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
162
|
+
render(_jsx(Drilldown, {
|
|
163
|
+
rootPageId: "page0",
|
|
164
|
+
children: _jsx(Drilldown.Page, {
|
|
165
|
+
id: "page0",
|
|
166
|
+
renderActionLabel: "ActionWithCallback",
|
|
167
|
+
onHeaderActionClicked: actionCallback,
|
|
168
|
+
children: _Drilldown$Option5 || (_Drilldown$Option5 = _jsx(Drilldown.Option, {
|
|
169
|
+
id: "option1",
|
|
170
|
+
children: "Option"
|
|
171
|
+
}))
|
|
172
|
+
})
|
|
173
|
+
}));
|
|
150
174
|
const actionLabel = screen.getByText('ActionWithCallback');
|
|
151
175
|
await userEvent.click(actionLabel);
|
|
152
176
|
await waitFor(() => {
|
|
@@ -156,31 +180,39 @@ describe('<Drilldown.Page />', () => {
|
|
|
156
180
|
});
|
|
157
181
|
describe('header back navigation', () => {
|
|
158
182
|
it('should not be displayed on root page', async () => {
|
|
159
|
-
render(_Drilldown4 || (_Drilldown4 =
|
|
160
|
-
rootPageId: "page0"
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
183
|
+
render(_Drilldown4 || (_Drilldown4 = _jsx(Drilldown, {
|
|
184
|
+
rootPageId: "page0",
|
|
185
|
+
children: _jsx(Drilldown.Page, {
|
|
186
|
+
id: "page0",
|
|
187
|
+
renderBackButtonLabel: "HeaderBackString",
|
|
188
|
+
children: _jsx(Drilldown.Option, {
|
|
189
|
+
id: "option1",
|
|
190
|
+
children: "Option"
|
|
191
|
+
})
|
|
192
|
+
})
|
|
193
|
+
})));
|
|
167
194
|
const label = screen.queryByText('HeaderBackString');
|
|
168
195
|
expect(label).not.toBeInTheDocument();
|
|
169
196
|
});
|
|
170
197
|
it('should be displayed on subpages', async () => {
|
|
171
|
-
render(_Drilldown5 || (_Drilldown5 =
|
|
172
|
-
rootPageId: "page0"
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
198
|
+
render(_Drilldown5 || (_Drilldown5 = _jsxs(Drilldown, {
|
|
199
|
+
rootPageId: "page0",
|
|
200
|
+
children: [_jsx(Drilldown.Page, {
|
|
201
|
+
id: "page0",
|
|
202
|
+
children: _jsx(Drilldown.Option, {
|
|
203
|
+
id: "option1",
|
|
204
|
+
subPageId: "page2",
|
|
205
|
+
children: "Option"
|
|
206
|
+
})
|
|
207
|
+
}), _jsx(Drilldown.Page, {
|
|
208
|
+
id: "page2",
|
|
209
|
+
renderBackButtonLabel: "HeaderBackString",
|
|
210
|
+
children: _jsx(Drilldown.Option, {
|
|
211
|
+
id: "option2",
|
|
212
|
+
children: "Option"
|
|
213
|
+
})
|
|
214
|
+
})]
|
|
215
|
+
})));
|
|
184
216
|
const option = screen.getByText('Option');
|
|
185
217
|
await userEvent.click(option);
|
|
186
218
|
await waitFor(() => {
|
|
@@ -190,20 +222,25 @@ describe('<Drilldown.Page />', () => {
|
|
|
190
222
|
});
|
|
191
223
|
it('should be displayed when function is passed, and can use former page title', async () => {
|
|
192
224
|
const pageTitle = 'Page Title';
|
|
193
|
-
render(
|
|
194
|
-
rootPageId: "page0"
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
225
|
+
render(_jsxs(Drilldown, {
|
|
226
|
+
rootPageId: "page0",
|
|
227
|
+
children: [_jsx(Drilldown.Page, {
|
|
228
|
+
id: "page0",
|
|
229
|
+
renderTitle: pageTitle,
|
|
230
|
+
children: _Drilldown$Option6 || (_Drilldown$Option6 = _jsx(Drilldown.Option, {
|
|
231
|
+
id: "option1",
|
|
232
|
+
subPageId: "page2",
|
|
233
|
+
children: "Option"
|
|
234
|
+
}))
|
|
235
|
+
}), _jsx(Drilldown.Page, {
|
|
236
|
+
id: "page2",
|
|
237
|
+
renderBackButtonLabel: prevPageTitle => `Back to ${prevPageTitle}`,
|
|
238
|
+
children: _Drilldown$Option7 || (_Drilldown$Option7 = _jsx(Drilldown.Option, {
|
|
239
|
+
id: "option2",
|
|
240
|
+
children: "Option"
|
|
241
|
+
}))
|
|
242
|
+
})]
|
|
243
|
+
}));
|
|
207
244
|
const option = screen.getByText('Option');
|
|
208
245
|
await userEvent.click(option);
|
|
209
246
|
await waitFor(() => {
|
|
@@ -214,40 +251,49 @@ describe('<Drilldown.Page />', () => {
|
|
|
214
251
|
});
|
|
215
252
|
describe('header separator', () => {
|
|
216
253
|
it('should not be displayed, if no item is on the header', async () => {
|
|
217
|
-
const _render4 = render(_Drilldown6 || (_Drilldown6 =
|
|
218
|
-
rootPageId: "page0"
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
254
|
+
const _render4 = render(_Drilldown6 || (_Drilldown6 = _jsx(Drilldown, {
|
|
255
|
+
rootPageId: "page0",
|
|
256
|
+
children: _jsx(Drilldown.Page, {
|
|
257
|
+
id: "page0",
|
|
258
|
+
children: _jsx(Drilldown.Option, {
|
|
259
|
+
id: "option1",
|
|
260
|
+
children: "Option"
|
|
261
|
+
})
|
|
262
|
+
})
|
|
263
|
+
}))),
|
|
224
264
|
container = _render4.container;
|
|
225
265
|
const separator = container.querySelector('[id^="DrilldownHeader-Separator_"]');
|
|
226
266
|
expect(separator).not.toBeInTheDocument();
|
|
227
267
|
});
|
|
228
268
|
it('should be displayed, if there are items in the header', async () => {
|
|
229
|
-
const _render5 = render(_Drilldown7 || (_Drilldown7 =
|
|
230
|
-
rootPageId: "page0"
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
269
|
+
const _render5 = render(_Drilldown7 || (_Drilldown7 = _jsx(Drilldown, {
|
|
270
|
+
rootPageId: "page0",
|
|
271
|
+
children: _jsx(Drilldown.Page, {
|
|
272
|
+
id: "page0",
|
|
273
|
+
renderTitle: "Title",
|
|
274
|
+
children: _jsx(Drilldown.Option, {
|
|
275
|
+
id: "option1",
|
|
276
|
+
children: "Option"
|
|
277
|
+
})
|
|
278
|
+
})
|
|
279
|
+
}))),
|
|
237
280
|
container = _render5.container;
|
|
238
281
|
const separator = container.querySelector('[id^="DrilldownHeader-Separator_"]');
|
|
239
282
|
expect(separator).toBeInTheDocument();
|
|
240
283
|
});
|
|
241
284
|
it('should not be displayed, if withoutHeaderSeparator is set', async () => {
|
|
242
|
-
const _render6 = render(_Drilldown8 || (_Drilldown8 =
|
|
243
|
-
rootPageId: "page0"
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
285
|
+
const _render6 = render(_Drilldown8 || (_Drilldown8 = _jsx(Drilldown, {
|
|
286
|
+
rootPageId: "page0",
|
|
287
|
+
children: _jsx(Drilldown.Page, {
|
|
288
|
+
id: "page0",
|
|
289
|
+
renderTitle: "Title",
|
|
290
|
+
withoutHeaderSeparator: true,
|
|
291
|
+
children: _jsx(Drilldown.Option, {
|
|
292
|
+
id: "option1",
|
|
293
|
+
children: "Option"
|
|
294
|
+
})
|
|
295
|
+
})
|
|
296
|
+
}))),
|
|
251
297
|
container = _render6.container;
|
|
252
298
|
const separator = container.querySelector('[id^="DrilldownHeader-Separator_"]');
|
|
253
299
|
expect(separator).not.toBeInTheDocument();
|
|
@@ -255,35 +301,43 @@ describe('<Drilldown.Page />', () => {
|
|
|
255
301
|
});
|
|
256
302
|
describe('disabled prop', () => {
|
|
257
303
|
it('should make all options disabled', async () => {
|
|
258
|
-
render(_Drilldown9 || (_Drilldown9 =
|
|
259
|
-
rootPageId: "page0"
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
304
|
+
render(_Drilldown9 || (_Drilldown9 = _jsx(Drilldown, {
|
|
305
|
+
rootPageId: "page0",
|
|
306
|
+
children: _jsx(Drilldown.Page, {
|
|
307
|
+
id: "page0",
|
|
308
|
+
renderActionLabel: "Action Label",
|
|
309
|
+
disabled: true,
|
|
310
|
+
children: _jsx(Drilldown.Option, {
|
|
311
|
+
id: "option1",
|
|
312
|
+
children: "Option"
|
|
313
|
+
})
|
|
314
|
+
})
|
|
315
|
+
})));
|
|
267
316
|
const allOptions = screen.getAllByRole('menuitem');
|
|
268
317
|
allOptions.forEach(option => {
|
|
269
318
|
expect(option).toHaveAttribute('aria-disabled', 'true');
|
|
270
319
|
});
|
|
271
320
|
});
|
|
272
321
|
it("shouldn't make header Back options disabled", async () => {
|
|
273
|
-
render(_Drilldown10 || (_Drilldown10 =
|
|
274
|
-
rootPageId: "page0"
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
322
|
+
render(_Drilldown10 || (_Drilldown10 = _jsxs(Drilldown, {
|
|
323
|
+
rootPageId: "page0",
|
|
324
|
+
children: [_jsx(Drilldown.Page, {
|
|
325
|
+
id: "page0",
|
|
326
|
+
children: _jsx(Drilldown.Option, {
|
|
327
|
+
id: "option1",
|
|
328
|
+
subPageId: "page2",
|
|
329
|
+
children: "Option1"
|
|
330
|
+
})
|
|
331
|
+
}), _jsx(Drilldown.Page, {
|
|
332
|
+
id: "page2",
|
|
333
|
+
disabled: true,
|
|
334
|
+
renderBackButtonLabel: "HeaderBackString",
|
|
335
|
+
children: _jsx(Drilldown.Option, {
|
|
336
|
+
id: "option2",
|
|
337
|
+
children: "Option2"
|
|
338
|
+
})
|
|
339
|
+
})]
|
|
340
|
+
})));
|
|
287
341
|
const subPageOption = screen.getByText('Option1');
|
|
288
342
|
await userEvent.click(subPageOption);
|
|
289
343
|
await waitFor(() => {
|
|
@@ -23,33 +23,38 @@ var _Drilldown, _Drilldown2;
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import React from 'react';
|
|
27
26
|
import { render, screen } from '@testing-library/react';
|
|
28
27
|
import '@testing-library/jest-dom';
|
|
29
28
|
import { Drilldown } from '../../index';
|
|
29
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
30
30
|
describe('<Drilldown.Separator />', () => {
|
|
31
31
|
it('should render', async () => {
|
|
32
|
-
render(_Drilldown || (_Drilldown =
|
|
33
|
-
rootPageId: "page0"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
render(_Drilldown || (_Drilldown = _jsx(Drilldown, {
|
|
33
|
+
rootPageId: "page0",
|
|
34
|
+
children: _jsx(Drilldown.Page, {
|
|
35
|
+
id: "page0",
|
|
36
|
+
children: _jsx(Drilldown.Separator, {
|
|
37
|
+
id: "sep1",
|
|
38
|
+
"data-testid": "separator1"
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
})));
|
|
40
42
|
const separator = screen.getByTestId('separator1');
|
|
41
43
|
expect(separator).toBeVisible();
|
|
42
44
|
expect(separator.getAttribute('class')).toContain('-separator');
|
|
43
45
|
});
|
|
44
46
|
it('should not render children', async () => {
|
|
45
|
-
render(_Drilldown2 || (_Drilldown2 =
|
|
46
|
-
rootPageId: "page0"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
render(_Drilldown2 || (_Drilldown2 = _jsx(Drilldown, {
|
|
48
|
+
rootPageId: "page0",
|
|
49
|
+
children: _jsx(Drilldown.Page, {
|
|
50
|
+
id: "page0",
|
|
51
|
+
children: _jsx(Drilldown.Separator, {
|
|
52
|
+
id: "sep1",
|
|
53
|
+
"data-testid": "separator1",
|
|
54
|
+
children: "Children"
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
})));
|
|
53
58
|
const separatorChild = screen.queryByText('Children');
|
|
54
59
|
expect(separatorChild).not.toBeInTheDocument();
|
|
55
60
|
});
|