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