@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, _Drilldown$Option, _Drilldown2, _Drilldown$Option2, _Drilldown3, _Drilldown4, _Drilldown5, _Drilldown6, _Drilldown7, _Drilldown8, _Drilldown9, _Drilldown10, _Drilldown11, _Drilldown12, _Drilldown13, _Drilldown14, _Drilldown15, _Drilldown16, _Drilldown$Option3, _Drilldown$Option4, _Drilldown$Option5, _Drilldown$Option6, _Drilldown$Option7, _Drilldown$Option8, _Drilldown$Option9, _Drilldown$Option10, _Drilldown$Option11, _Drilldown$Option12, _Drilldown$Option13, _Drilldown$Option14, _Drilldown$Option15, _Drilldown$Option16, _Drilldown$Option17;
|
|
11
11
|
/*
|
|
12
12
|
* The MIT License (MIT)
|
|
@@ -48,147 +48,184 @@ describe('<Drilldown.Group />', () => {
|
|
|
48
48
|
const Example = ({
|
|
49
49
|
opts
|
|
50
50
|
}) => {
|
|
51
|
-
return
|
|
52
|
-
rootPageId: "page0"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
51
|
+
return (0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
52
|
+
rootPageId: "page0",
|
|
53
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
54
|
+
id: "page0",
|
|
55
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Group, {
|
|
56
|
+
id: "group0",
|
|
57
|
+
selectableType: "single",
|
|
58
|
+
children: opts.map(opt => {
|
|
59
|
+
return (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
60
|
+
value: opt,
|
|
61
|
+
name: opt,
|
|
62
|
+
id: opt,
|
|
63
|
+
defaultSelected: opt === 'three',
|
|
64
|
+
"data-testid": opt,
|
|
65
|
+
children: opt
|
|
66
|
+
}, opt);
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
});
|
|
68
71
|
};
|
|
69
|
-
(0,
|
|
72
|
+
(0, _react.render)((0, _jsxRuntime.jsx)(Example, {
|
|
70
73
|
opts: options
|
|
71
74
|
}));
|
|
72
|
-
const selectedOption =
|
|
75
|
+
const selectedOption = _react.screen.getByTestId('three');
|
|
73
76
|
expect(selectedOption).toHaveAttribute('aria-checked', 'true');
|
|
74
77
|
await _userEvent.default.click(selectedOption);
|
|
75
|
-
await (0,
|
|
76
|
-
const updatedSelectedOption =
|
|
78
|
+
await (0, _react.waitFor)(() => {
|
|
79
|
+
const updatedSelectedOption = _react.screen.getByTestId('three');
|
|
77
80
|
expect(updatedSelectedOption).toHaveAttribute('aria-checked', 'true');
|
|
78
81
|
});
|
|
79
82
|
});
|
|
80
83
|
it("shouldn't render non-DrilldownGroup children", async () => {
|
|
81
|
-
(0,
|
|
82
|
-
rootPageId: "page0"
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
84
|
+
(0, _react.render)(_Drilldown || (_Drilldown = (0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
85
|
+
rootPageId: "page0",
|
|
86
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
87
|
+
id: "page0",
|
|
88
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Group, {
|
|
89
|
+
id: "group0",
|
|
90
|
+
children: (0, _jsxRuntime.jsx)("div", {
|
|
91
|
+
"data-testid": "testDiv",
|
|
92
|
+
children: "Div"
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
})));
|
|
97
|
+
const nonGroupChild = _react.screen.queryByTestId('testDiv');
|
|
98
|
+
const childText = _react.screen.queryByText('Div');
|
|
92
99
|
expect(nonGroupChild).not.toBeInTheDocument();
|
|
93
100
|
expect(childText).not.toBeInTheDocument();
|
|
94
101
|
});
|
|
95
102
|
it('elementRef should return ref to the group', async () => {
|
|
96
103
|
const elementRef = _vitest.vi.fn();
|
|
97
|
-
const _render = (0,
|
|
98
|
-
rootPageId: "page0"
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
const _render = (0, _react.render)((0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
105
|
+
rootPageId: "page0",
|
|
106
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
107
|
+
id: "page0",
|
|
108
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Group, {
|
|
109
|
+
id: "group0",
|
|
110
|
+
elementRef: elementRef,
|
|
111
|
+
children: _Drilldown$Option || (_Drilldown$Option = (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
112
|
+
id: "groupOption01",
|
|
113
|
+
children: "Option"
|
|
114
|
+
}))
|
|
115
|
+
})
|
|
116
|
+
})
|
|
117
|
+
})),
|
|
107
118
|
container = _render.container;
|
|
108
119
|
const group = container.querySelector('#group0');
|
|
109
120
|
expect(elementRef).toHaveBeenCalledWith(group);
|
|
110
121
|
});
|
|
111
122
|
describe('renderGroupTitle', () => {
|
|
112
123
|
it('should display', async () => {
|
|
113
|
-
(0,
|
|
114
|
-
rootPageId: "page0"
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
+
(0, _react.render)(_Drilldown2 || (_Drilldown2 = (0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
125
|
+
rootPageId: "page0",
|
|
126
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
127
|
+
id: "page0",
|
|
128
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Group, {
|
|
129
|
+
id: "group0",
|
|
130
|
+
renderGroupTitle: "Group Title",
|
|
131
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
132
|
+
id: "groupOption01",
|
|
133
|
+
children: "Option"
|
|
134
|
+
})
|
|
135
|
+
})
|
|
136
|
+
})
|
|
137
|
+
})));
|
|
138
|
+
const title = _react.screen.getByText('Group Title');
|
|
124
139
|
expect(title).toBeInTheDocument();
|
|
125
140
|
});
|
|
126
141
|
it('should display, if function is provided', async () => {
|
|
127
|
-
(0,
|
|
128
|
-
rootPageId: "page0"
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
142
|
+
(0, _react.render)((0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
143
|
+
rootPageId: "page0",
|
|
144
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
145
|
+
id: "page0",
|
|
146
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Group, {
|
|
147
|
+
id: "group0",
|
|
148
|
+
renderGroupTitle: () => 'Group Title',
|
|
149
|
+
children: _Drilldown$Option2 || (_Drilldown$Option2 = (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
150
|
+
id: "groupOption01",
|
|
151
|
+
children: "Option"
|
|
152
|
+
}))
|
|
153
|
+
})
|
|
154
|
+
})
|
|
155
|
+
}));
|
|
156
|
+
const title = _react.screen.getByText('Group Title');
|
|
138
157
|
expect(title).toBeInTheDocument();
|
|
139
158
|
});
|
|
140
159
|
});
|
|
141
160
|
describe('separators', () => {
|
|
142
161
|
it("shouldn't display, when group is first and/or last item", async () => {
|
|
143
|
-
const _render2 = (0,
|
|
144
|
-
rootPageId: "page0"
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
162
|
+
const _render2 = (0, _react.render)(_Drilldown3 || (_Drilldown3 = (0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
163
|
+
rootPageId: "page0",
|
|
164
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
165
|
+
id: "page0",
|
|
166
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Group, {
|
|
167
|
+
id: "group0",
|
|
168
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
169
|
+
id: "groupOption01",
|
|
170
|
+
children: "Option"
|
|
171
|
+
})
|
|
172
|
+
})
|
|
173
|
+
})
|
|
174
|
+
}))),
|
|
152
175
|
container = _render2.container;
|
|
153
176
|
const separators = container.querySelectorAll('[class$="-separator"]');
|
|
154
177
|
expect(separators.length).toBe(0);
|
|
155
178
|
});
|
|
156
179
|
it('should display by default, if group is between other items', async () => {
|
|
157
|
-
const _render3 = (0,
|
|
158
|
-
rootPageId: "page0"
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
180
|
+
const _render3 = (0, _react.render)(_Drilldown4 || (_Drilldown4 = (0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
181
|
+
rootPageId: "page0",
|
|
182
|
+
children: (0, _jsxRuntime.jsxs)(_index.Drilldown.Page, {
|
|
183
|
+
id: "page0",
|
|
184
|
+
children: [(0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
185
|
+
id: "option1",
|
|
186
|
+
children: "Option"
|
|
187
|
+
}), (0, _jsxRuntime.jsx)(_index.Drilldown.Group, {
|
|
188
|
+
id: "group0",
|
|
189
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
190
|
+
id: "groupOption01",
|
|
191
|
+
children: "Option"
|
|
192
|
+
})
|
|
193
|
+
}), (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
194
|
+
id: "option2",
|
|
195
|
+
children: "Option"
|
|
196
|
+
})]
|
|
197
|
+
})
|
|
198
|
+
}))),
|
|
170
199
|
container = _render3.container;
|
|
171
200
|
const separators = container.querySelectorAll('[class$="-separator"]');
|
|
172
201
|
expect(separators.length).toBe(2);
|
|
173
202
|
});
|
|
174
203
|
it("shouldn't display extra separator between groups", async () => {
|
|
175
|
-
const _render4 = (0,
|
|
176
|
-
rootPageId: "page0"
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
204
|
+
const _render4 = (0, _react.render)(_Drilldown5 || (_Drilldown5 = (0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
205
|
+
rootPageId: "page0",
|
|
206
|
+
children: (0, _jsxRuntime.jsxs)(_index.Drilldown.Page, {
|
|
207
|
+
id: "page0",
|
|
208
|
+
children: [(0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
209
|
+
id: "option1",
|
|
210
|
+
children: "Option"
|
|
211
|
+
}), (0, _jsxRuntime.jsx)(_index.Drilldown.Group, {
|
|
212
|
+
id: "group0",
|
|
213
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
214
|
+
id: "groupOption01",
|
|
215
|
+
children: "Option"
|
|
216
|
+
})
|
|
217
|
+
}), (0, _jsxRuntime.jsx)(_index.Drilldown.Group, {
|
|
218
|
+
id: "group1",
|
|
219
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
220
|
+
id: "groupOption11",
|
|
221
|
+
children: "Option"
|
|
222
|
+
})
|
|
223
|
+
}), (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
224
|
+
id: "option2",
|
|
225
|
+
children: "Option"
|
|
226
|
+
})]
|
|
227
|
+
})
|
|
228
|
+
}))),
|
|
192
229
|
container = _render4.container;
|
|
193
230
|
const separators = container.querySelectorAll('[class$="-separator"]');
|
|
194
231
|
expect(separators.length).toBe(3);
|
|
@@ -196,22 +233,29 @@ describe('<Drilldown.Group />', () => {
|
|
|
196
233
|
});
|
|
197
234
|
describe('disabled prop', () => {
|
|
198
235
|
it('should disable all items in the group', async () => {
|
|
199
|
-
const _render5 = (0,
|
|
200
|
-
rootPageId: "page0"
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
236
|
+
const _render5 = (0, _react.render)(_Drilldown6 || (_Drilldown6 = (0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
237
|
+
rootPageId: "page0",
|
|
238
|
+
children: (0, _jsxRuntime.jsxs)(_index.Drilldown.Page, {
|
|
239
|
+
id: "page0",
|
|
240
|
+
children: [(0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
241
|
+
id: "option1",
|
|
242
|
+
children: "Option"
|
|
243
|
+
}), (0, _jsxRuntime.jsxs)(_index.Drilldown.Group, {
|
|
244
|
+
id: "group0",
|
|
245
|
+
disabled: true,
|
|
246
|
+
children: [(0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
247
|
+
id: "groupOption01",
|
|
248
|
+
children: "Option"
|
|
249
|
+
}), (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
250
|
+
id: "groupOption02",
|
|
251
|
+
children: "Option"
|
|
252
|
+
})]
|
|
253
|
+
}), (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
254
|
+
id: "option2",
|
|
255
|
+
children: "Option"
|
|
256
|
+
})]
|
|
257
|
+
})
|
|
258
|
+
}))),
|
|
215
259
|
container = _render5.container;
|
|
216
260
|
const disabledOption_1 = container.querySelector('#groupOption01');
|
|
217
261
|
const disabledOption_2 = container.querySelector('#groupOption02');
|
|
@@ -225,34 +269,44 @@ describe('<Drilldown.Group />', () => {
|
|
|
225
269
|
});
|
|
226
270
|
describe('role prop', () => {
|
|
227
271
|
it('should be "group" by default', async () => {
|
|
228
|
-
const _render6 = (0,
|
|
229
|
-
rootPageId: "page0"
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
272
|
+
const _render6 = (0, _react.render)(_Drilldown7 || (_Drilldown7 = (0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
273
|
+
rootPageId: "page0",
|
|
274
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
275
|
+
id: "page0",
|
|
276
|
+
children: (0, _jsxRuntime.jsxs)(_index.Drilldown.Group, {
|
|
277
|
+
id: "group0",
|
|
278
|
+
children: [(0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
279
|
+
id: "groupOption01",
|
|
280
|
+
children: "Option"
|
|
281
|
+
}), (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
282
|
+
id: "groupOption02",
|
|
283
|
+
children: "Option"
|
|
284
|
+
})]
|
|
285
|
+
})
|
|
286
|
+
})
|
|
287
|
+
}))),
|
|
239
288
|
container = _render6.container;
|
|
240
289
|
const group = container.querySelector('#group0');
|
|
241
290
|
expect(group).toHaveAttribute('role', 'group');
|
|
242
291
|
});
|
|
243
292
|
it('should render the group with passed role', async () => {
|
|
244
|
-
const _render7 = (0,
|
|
245
|
-
rootPageId: "page0"
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
293
|
+
const _render7 = (0, _react.render)(_Drilldown8 || (_Drilldown8 = (0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
294
|
+
rootPageId: "page0",
|
|
295
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
296
|
+
id: "page0",
|
|
297
|
+
children: (0, _jsxRuntime.jsxs)(_index.Drilldown.Group, {
|
|
298
|
+
id: "group0",
|
|
299
|
+
role: "menu",
|
|
300
|
+
children: [(0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
301
|
+
id: "groupOption01",
|
|
302
|
+
children: "Option"
|
|
303
|
+
}), (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
304
|
+
id: "groupOption02",
|
|
305
|
+
children: "Option"
|
|
306
|
+
})]
|
|
307
|
+
})
|
|
308
|
+
})
|
|
309
|
+
}))),
|
|
256
310
|
container = _render7.container;
|
|
257
311
|
const group = container.querySelector('#group0');
|
|
258
312
|
expect(group).toHaveAttribute('role', 'menu');
|
|
@@ -260,17 +314,22 @@ describe('<Drilldown.Group />', () => {
|
|
|
260
314
|
});
|
|
261
315
|
describe('as prop', () => {
|
|
262
316
|
it('should inherit Drilldown\'s "ul" by default', async () => {
|
|
263
|
-
const _render8 = (0,
|
|
264
|
-
rootPageId: "page0"
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
317
|
+
const _render8 = (0, _react.render)(_Drilldown9 || (_Drilldown9 = (0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
318
|
+
rootPageId: "page0",
|
|
319
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
320
|
+
id: "page0",
|
|
321
|
+
children: (0, _jsxRuntime.jsxs)(_index.Drilldown.Group, {
|
|
322
|
+
id: "group0",
|
|
323
|
+
children: [(0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
324
|
+
id: "groupOption01",
|
|
325
|
+
children: "Option"
|
|
326
|
+
}), (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
327
|
+
id: "groupOption02",
|
|
328
|
+
children: "Option"
|
|
329
|
+
})]
|
|
330
|
+
})
|
|
331
|
+
})
|
|
332
|
+
}))),
|
|
274
333
|
container = _render8.container;
|
|
275
334
|
const drilldownContainer = container.querySelector('[id^=Selectable_][id$=-list]');
|
|
276
335
|
const group = container.querySelector('#group0');
|
|
@@ -278,18 +337,23 @@ describe('<Drilldown.Group />', () => {
|
|
|
278
337
|
expect(group.tagName).toBe('UL');
|
|
279
338
|
});
|
|
280
339
|
it('should inherit Drilldown\'s "as" prop', async () => {
|
|
281
|
-
const _render9 = (0,
|
|
340
|
+
const _render9 = (0, _react.render)(_Drilldown10 || (_Drilldown10 = (0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
282
341
|
rootPageId: "page0",
|
|
283
|
-
as: "ol"
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
342
|
+
as: "ol",
|
|
343
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
344
|
+
id: "page0",
|
|
345
|
+
children: (0, _jsxRuntime.jsxs)(_index.Drilldown.Group, {
|
|
346
|
+
id: "group0",
|
|
347
|
+
children: [(0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
348
|
+
id: "groupOption01",
|
|
349
|
+
children: "Option"
|
|
350
|
+
}), (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
351
|
+
id: "groupOption02",
|
|
352
|
+
children: "Option"
|
|
353
|
+
})]
|
|
354
|
+
})
|
|
355
|
+
})
|
|
356
|
+
}))),
|
|
293
357
|
container = _render9.container;
|
|
294
358
|
const drilldownContainer = container.querySelector('[id^=Selectable_][id$=-list]');
|
|
295
359
|
const group = container.querySelector('#group0');
|
|
@@ -297,18 +361,23 @@ describe('<Drilldown.Group />', () => {
|
|
|
297
361
|
expect(group.tagName).toBe('OL');
|
|
298
362
|
});
|
|
299
363
|
it('should render the group as other element', async () => {
|
|
300
|
-
const _render10 = (0,
|
|
301
|
-
rootPageId: "page0"
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
364
|
+
const _render10 = (0, _react.render)(_Drilldown11 || (_Drilldown11 = (0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
365
|
+
rootPageId: "page0",
|
|
366
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
367
|
+
id: "page0",
|
|
368
|
+
children: (0, _jsxRuntime.jsxs)(_index.Drilldown.Group, {
|
|
369
|
+
id: "group0",
|
|
370
|
+
as: "ol",
|
|
371
|
+
children: [(0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
372
|
+
id: "groupOption01",
|
|
373
|
+
children: "Option"
|
|
374
|
+
}), (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
375
|
+
id: "groupOption02",
|
|
376
|
+
children: "Option"
|
|
377
|
+
})]
|
|
378
|
+
})
|
|
379
|
+
})
|
|
380
|
+
}))),
|
|
312
381
|
container = _render10.container;
|
|
313
382
|
const drilldownContainer = container.querySelector('[id^=Selectable_][id$=-list]');
|
|
314
383
|
const group = container.querySelector('#group0');
|
|
@@ -318,15 +387,19 @@ describe('<Drilldown.Group />', () => {
|
|
|
318
387
|
});
|
|
319
388
|
describe('selectableType', () => {
|
|
320
389
|
it('if not set, should render role="menuitem" options without icon by default', async () => {
|
|
321
|
-
const _render11 = (0,
|
|
322
|
-
rootPageId: "page0"
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
390
|
+
const _render11 = (0, _react.render)(_Drilldown12 || (_Drilldown12 = (0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
391
|
+
rootPageId: "page0",
|
|
392
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
393
|
+
id: "page0",
|
|
394
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Group, {
|
|
395
|
+
id: "group0",
|
|
396
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
397
|
+
id: "groupOption01",
|
|
398
|
+
children: "Option"
|
|
399
|
+
})
|
|
400
|
+
})
|
|
401
|
+
})
|
|
402
|
+
}))),
|
|
330
403
|
container = _render11.container;
|
|
331
404
|
const icon = container.querySelector('svg[name="IconCheck"]');
|
|
332
405
|
const groupOption = container.querySelector('#groupOption01');
|
|
@@ -334,16 +407,20 @@ describe('<Drilldown.Group />', () => {
|
|
|
334
407
|
expect(groupOption).toHaveAttribute('role', 'menuitem');
|
|
335
408
|
});
|
|
336
409
|
it('value "single" should render role="menuitemradio" options with icon', async () => {
|
|
337
|
-
const _render12 = (0,
|
|
338
|
-
rootPageId: "page0"
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
410
|
+
const _render12 = (0, _react.render)(_Drilldown13 || (_Drilldown13 = (0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
411
|
+
rootPageId: "page0",
|
|
412
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
413
|
+
id: "page0",
|
|
414
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Group, {
|
|
415
|
+
id: "group0",
|
|
416
|
+
selectableType: "single",
|
|
417
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
418
|
+
id: "groupOption01",
|
|
419
|
+
children: "Option"
|
|
420
|
+
})
|
|
421
|
+
})
|
|
422
|
+
})
|
|
423
|
+
}))),
|
|
347
424
|
container = _render12.container;
|
|
348
425
|
const icon = container.querySelector('svg[name="IconCheck"]');
|
|
349
426
|
const groupOption = container.querySelector('#groupOption01');
|
|
@@ -351,16 +428,20 @@ describe('<Drilldown.Group />', () => {
|
|
|
351
428
|
expect(groupOption).toHaveAttribute('role', 'menuitemradio');
|
|
352
429
|
});
|
|
353
430
|
it('value "multiple" should render role="menuitemcheckbox" options with icon', async () => {
|
|
354
|
-
const _render13 = (0,
|
|
355
|
-
rootPageId: "page0"
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
431
|
+
const _render13 = (0, _react.render)(_Drilldown14 || (_Drilldown14 = (0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
432
|
+
rootPageId: "page0",
|
|
433
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
434
|
+
id: "page0",
|
|
435
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Group, {
|
|
436
|
+
id: "group0",
|
|
437
|
+
selectableType: "multiple",
|
|
438
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
439
|
+
id: "groupOption01",
|
|
440
|
+
children: "Option"
|
|
441
|
+
})
|
|
442
|
+
})
|
|
443
|
+
})
|
|
444
|
+
}))),
|
|
364
445
|
container = _render13.container;
|
|
365
446
|
const icon = container.querySelector('svg[name="IconCheck"]');
|
|
366
447
|
const groupOption = container.querySelector('#groupOption01');
|
|
@@ -371,47 +452,59 @@ describe('<Drilldown.Group />', () => {
|
|
|
371
452
|
describe('defaultSelected', () => {
|
|
372
453
|
describe('if not provided', () => {
|
|
373
454
|
it('all group options has to be unselected', async () => {
|
|
374
|
-
(0,
|
|
375
|
-
rootPageId: "page0"
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
455
|
+
(0, _react.render)(_Drilldown15 || (_Drilldown15 = (0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
456
|
+
rootPageId: "page0",
|
|
457
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
458
|
+
id: "page0",
|
|
459
|
+
children: (0, _jsxRuntime.jsxs)(_index.Drilldown.Group, {
|
|
460
|
+
id: "group0",
|
|
461
|
+
selectableType: "multiple",
|
|
462
|
+
children: [(0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
463
|
+
id: "groupOption01",
|
|
464
|
+
value: 1,
|
|
465
|
+
children: "Option"
|
|
466
|
+
}), (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
467
|
+
id: "groupOption02",
|
|
468
|
+
value: 2,
|
|
469
|
+
children: "Option"
|
|
470
|
+
}), (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
471
|
+
id: "groupOption03",
|
|
472
|
+
value: 3,
|
|
473
|
+
children: "Option"
|
|
474
|
+
})]
|
|
475
|
+
})
|
|
476
|
+
})
|
|
477
|
+
})));
|
|
478
|
+
const options = _react.screen.getAllByRole('menuitemcheckbox');
|
|
392
479
|
expect(options.length).toBe(3);
|
|
393
480
|
options.forEach(option => {
|
|
394
481
|
expect(option).toHaveAttribute('aria-checked', 'false');
|
|
395
482
|
});
|
|
396
483
|
});
|
|
397
484
|
it('all checkboxes should not be visible', async () => {
|
|
398
|
-
const _render14 = (0,
|
|
399
|
-
rootPageId: "page0"
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
485
|
+
const _render14 = (0, _react.render)(_Drilldown16 || (_Drilldown16 = (0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
486
|
+
rootPageId: "page0",
|
|
487
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
488
|
+
id: "page0",
|
|
489
|
+
children: (0, _jsxRuntime.jsxs)(_index.Drilldown.Group, {
|
|
490
|
+
id: "group0",
|
|
491
|
+
selectableType: "multiple",
|
|
492
|
+
children: [(0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
493
|
+
id: "groupOption01",
|
|
494
|
+
value: 1,
|
|
495
|
+
children: "Option"
|
|
496
|
+
}), (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
497
|
+
id: "groupOption02",
|
|
498
|
+
value: 2,
|
|
499
|
+
children: "Option"
|
|
500
|
+
}), (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
501
|
+
id: "groupOption03",
|
|
502
|
+
value: 3,
|
|
503
|
+
children: "Option"
|
|
504
|
+
})]
|
|
505
|
+
})
|
|
506
|
+
})
|
|
507
|
+
}))),
|
|
415
508
|
container = _render14.container;
|
|
416
509
|
const icons = container.querySelectorAll('svg[name="IconCheck"]');
|
|
417
510
|
expect(icons.length).toBe(3);
|
|
@@ -423,26 +516,32 @@ describe('<Drilldown.Group />', () => {
|
|
|
423
516
|
describe('if provided', () => {
|
|
424
517
|
it('all selected checkboxes should be visible', async () => {
|
|
425
518
|
const selectedValues = ['item1', 'item3'];
|
|
426
|
-
const _render15 = (0,
|
|
427
|
-
rootPageId: "page0"
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
519
|
+
const _render15 = (0, _react.render)((0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
520
|
+
rootPageId: "page0",
|
|
521
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
522
|
+
id: "page0",
|
|
523
|
+
children: (0, _jsxRuntime.jsxs)(_index.Drilldown.Group, {
|
|
524
|
+
id: "group0",
|
|
525
|
+
selectableType: "multiple",
|
|
526
|
+
defaultSelected: selectedValues,
|
|
527
|
+
children: [_Drilldown$Option3 || (_Drilldown$Option3 = (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
528
|
+
id: "groupOption01",
|
|
529
|
+
value: "item1",
|
|
530
|
+
children: "Option"
|
|
531
|
+
})), _Drilldown$Option4 || (_Drilldown$Option4 = (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
532
|
+
id: "groupOption02",
|
|
533
|
+
value: "item2",
|
|
534
|
+
children: "Option"
|
|
535
|
+
})), _Drilldown$Option5 || (_Drilldown$Option5 = (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
536
|
+
id: "groupOption03",
|
|
537
|
+
value: "item3",
|
|
538
|
+
children: "Option"
|
|
539
|
+
}))]
|
|
540
|
+
})
|
|
541
|
+
})
|
|
542
|
+
})),
|
|
444
543
|
container = _render15.container;
|
|
445
|
-
const options =
|
|
544
|
+
const options = _react.screen.getAllByRole('menuitemcheckbox');
|
|
446
545
|
const icons = container.querySelectorAll('svg');
|
|
447
546
|
expect(options[0]).toHaveAttribute('aria-checked', 'true');
|
|
448
547
|
expect(options[1]).toHaveAttribute('aria-checked', 'false');
|
|
@@ -453,27 +552,33 @@ describe('<Drilldown.Group />', () => {
|
|
|
453
552
|
});
|
|
454
553
|
it("should be overridden by the Option's own defaultSelected", async () => {
|
|
455
554
|
const selectedValues = ['item1', 'item3'];
|
|
456
|
-
(0,
|
|
457
|
-
rootPageId: "page0"
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
555
|
+
(0, _react.render)((0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
556
|
+
rootPageId: "page0",
|
|
557
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
558
|
+
id: "page0",
|
|
559
|
+
children: (0, _jsxRuntime.jsxs)(_index.Drilldown.Group, {
|
|
560
|
+
id: "group0",
|
|
561
|
+
selectableType: "multiple",
|
|
562
|
+
defaultSelected: selectedValues,
|
|
563
|
+
children: [_Drilldown$Option6 || (_Drilldown$Option6 = (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
564
|
+
id: "groupOption01",
|
|
565
|
+
value: "item1",
|
|
566
|
+
children: "Option"
|
|
567
|
+
})), _Drilldown$Option7 || (_Drilldown$Option7 = (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
568
|
+
id: "groupOption02",
|
|
569
|
+
value: "item2",
|
|
570
|
+
defaultSelected: true,
|
|
571
|
+
children: "Option"
|
|
572
|
+
})), _Drilldown$Option8 || (_Drilldown$Option8 = (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
573
|
+
id: "groupOption03",
|
|
574
|
+
value: "item3",
|
|
575
|
+
defaultSelected: false,
|
|
576
|
+
children: "Option"
|
|
577
|
+
}))]
|
|
578
|
+
})
|
|
579
|
+
})
|
|
580
|
+
}));
|
|
581
|
+
const options = _react.screen.getAllByRole('menuitemcheckbox');
|
|
477
582
|
expect(options[0]).toHaveAttribute('aria-checked', 'true'); // from the group,
|
|
478
583
|
expect(options[1]).toHaveAttribute('aria-checked', 'true'); // from own prop,
|
|
479
584
|
expect(options[2]).toHaveAttribute('aria-checked', 'false'); // override group's
|
|
@@ -481,50 +586,62 @@ describe('<Drilldown.Group />', () => {
|
|
|
481
586
|
describe('for "single" selectableType', () => {
|
|
482
587
|
it('the selected option should be checked', async () => {
|
|
483
588
|
const selectedValues = ['item2'];
|
|
484
|
-
(0,
|
|
485
|
-
rootPageId: "page0"
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
589
|
+
(0, _react.render)((0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
590
|
+
rootPageId: "page0",
|
|
591
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
592
|
+
id: "page0",
|
|
593
|
+
children: (0, _jsxRuntime.jsxs)(_index.Drilldown.Group, {
|
|
594
|
+
id: "group0",
|
|
595
|
+
selectableType: "single",
|
|
596
|
+
defaultSelected: selectedValues,
|
|
597
|
+
children: [_Drilldown$Option9 || (_Drilldown$Option9 = (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
598
|
+
id: "groupOption01",
|
|
599
|
+
value: "item1",
|
|
600
|
+
children: "Option"
|
|
601
|
+
})), _Drilldown$Option10 || (_Drilldown$Option10 = (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
602
|
+
id: "groupOption02",
|
|
603
|
+
value: "item2",
|
|
604
|
+
children: "Option"
|
|
605
|
+
})), _Drilldown$Option11 || (_Drilldown$Option11 = (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
606
|
+
id: "groupOption03",
|
|
607
|
+
value: "item3",
|
|
608
|
+
children: "Option"
|
|
609
|
+
}))]
|
|
610
|
+
})
|
|
611
|
+
})
|
|
612
|
+
}));
|
|
613
|
+
const options = _react.screen.getAllByRole('menuitemradio');
|
|
503
614
|
expect(options[0]).toHaveAttribute('aria-checked', 'false');
|
|
504
615
|
expect(options[1]).toHaveAttribute('aria-checked', 'true');
|
|
505
616
|
expect(options[2]).toHaveAttribute('aria-checked', 'false');
|
|
506
617
|
});
|
|
507
618
|
it("should throw error if multiple items are selected, and shouldn't select any item", async () => {
|
|
508
619
|
const selectedValues = ['item1', 'item3'];
|
|
509
|
-
(0,
|
|
510
|
-
rootPageId: "page0"
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
620
|
+
(0, _react.render)((0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
621
|
+
rootPageId: "page0",
|
|
622
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
623
|
+
id: "page0",
|
|
624
|
+
children: (0, _jsxRuntime.jsxs)(_index.Drilldown.Group, {
|
|
625
|
+
id: "group0",
|
|
626
|
+
selectableType: "single",
|
|
627
|
+
defaultSelected: selectedValues,
|
|
628
|
+
children: [_Drilldown$Option12 || (_Drilldown$Option12 = (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
629
|
+
id: "groupOption01",
|
|
630
|
+
value: "item1",
|
|
631
|
+
children: "Option"
|
|
632
|
+
})), _Drilldown$Option13 || (_Drilldown$Option13 = (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
633
|
+
id: "groupOption02",
|
|
634
|
+
value: "item2",
|
|
635
|
+
children: "Option"
|
|
636
|
+
})), _Drilldown$Option14 || (_Drilldown$Option14 = (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
637
|
+
id: "groupOption03",
|
|
638
|
+
value: "item3",
|
|
639
|
+
children: "Option"
|
|
640
|
+
}))]
|
|
641
|
+
})
|
|
642
|
+
})
|
|
643
|
+
}));
|
|
644
|
+
const options = _react.screen.getAllByRole('menuitemradio');
|
|
528
645
|
expect(options[0]).toHaveAttribute('aria-checked', 'false');
|
|
529
646
|
expect(options[1]).toHaveAttribute('aria-checked', 'false');
|
|
530
647
|
expect(options[2]).toHaveAttribute('aria-checked', 'false');
|
|
@@ -536,27 +653,33 @@ describe('<Drilldown.Group />', () => {
|
|
|
536
653
|
describe('selection', () => {
|
|
537
654
|
it('should fire "onSelect" callback', async () => {
|
|
538
655
|
const onSelect = _vitest.vi.fn();
|
|
539
|
-
(0,
|
|
540
|
-
rootPageId: "page0"
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
656
|
+
(0, _react.render)((0, _jsxRuntime.jsx)(_index.Drilldown, {
|
|
657
|
+
rootPageId: "page0",
|
|
658
|
+
children: (0, _jsxRuntime.jsx)(_index.Drilldown.Page, {
|
|
659
|
+
id: "page0",
|
|
660
|
+
children: (0, _jsxRuntime.jsxs)(_index.Drilldown.Group, {
|
|
661
|
+
id: "group0",
|
|
662
|
+
selectableType: "multiple",
|
|
663
|
+
onSelect: onSelect,
|
|
664
|
+
children: [_Drilldown$Option15 || (_Drilldown$Option15 = (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
665
|
+
id: "groupOption01",
|
|
666
|
+
value: "item1",
|
|
667
|
+
children: "Option 1"
|
|
668
|
+
})), _Drilldown$Option16 || (_Drilldown$Option16 = (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
669
|
+
id: "groupOption02",
|
|
670
|
+
value: "item2",
|
|
671
|
+
children: "Option 2"
|
|
672
|
+
})), _Drilldown$Option17 || (_Drilldown$Option17 = (0, _jsxRuntime.jsx)(_index.Drilldown.Option, {
|
|
673
|
+
id: "groupOption03",
|
|
674
|
+
value: "item3",
|
|
675
|
+
children: "Option 3"
|
|
676
|
+
}))]
|
|
677
|
+
})
|
|
678
|
+
})
|
|
679
|
+
}));
|
|
680
|
+
const option2 = _react.screen.getByText('Option 2');
|
|
558
681
|
await _userEvent.default.click(option2);
|
|
559
|
-
await (0,
|
|
682
|
+
await (0, _react.waitFor)(() => {
|
|
560
683
|
expect(onSelect).toHaveBeenCalledTimes(1);
|
|
561
684
|
const args = onSelect.mock.calls[0][1];
|
|
562
685
|
const event = onSelect.mock.calls[0][0];
|