@enact/ui 4.1.0 → 4.1.3
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/AnnounceDecorator/tests/Announce-specs.js +13 -5
- package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +9 -7
- package/AnnounceDecorator/tests/useAnnounce-specs.js +25 -17
- package/BodyText/BodyText.d.ts +1 -1
- package/BodyText/tests/BodyText-specs.js +49 -35
- package/Button/Button.d.ts +6 -6
- package/Button/tests/Button-specs.js +104 -3
- package/CHANGELOG.md +15 -0
- package/Cancelable/Cancelable.js +1 -1
- package/Cancelable/tests/Cancelable-specs.js +131 -70
- package/Changeable/tests/Changeable-specs.js +162 -110
- package/FloatingLayer/FloatingLayer.js +5 -17
- package/FloatingLayer/tests/FloatingLayer-specs.js +83 -8
- package/FloatingLayer/tests/Scrim-specs.js +20 -11
- package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +15 -9
- package/GridListImageItem/GridListImageItem.d.ts +1 -1
- package/Group/Group.d.ts +2 -2
- package/Group/tests/Group-specs.js +71 -41
- package/Heading/Heading.d.ts +2 -1
- package/Heading/tests/Heading-specs.js +27 -20
- package/Icon/Icon.d.ts +4 -4
- package/Icon/tests/Icon-specs.js +52 -31
- package/IconButton/IconButton.d.ts +4 -4
- package/IconButton/tests/IconButton-specs.js +2 -2
- package/Image/tests/Image-specs.js +39 -29
- package/ImageItem/tests/ImageItem-specs.js +71 -68
- package/Item/tests/Item-specs.js +59 -35
- package/LabeledIcon/LabeledIcon.d.ts +4 -4
- package/LabeledIcon/tests/LabeledIcon-specs.js +30 -19
- package/Layout/Layout.d.ts +16 -16
- package/Layout/tests/Layout-specs.js +37 -25
- package/Marquee/MarqueeBase.js +1 -5
- package/Marquee/tests/Marquee-specs.js +221 -116
- package/Media/Media.js +1 -3
- package/ProgressBar/tests/ProgressBar-specs.js +60 -42
- package/README.md +1 -1
- package/RadioDecorator/RadioDecorator.js +3 -5
- package/RadioDecorator/tests/RadioDecorator-specs.js +179 -65
- package/Repeater/Repeater.d.ts +2 -1
- package/Repeater/tests/Repeater-specs.js +86 -45
- package/Routable/Routable.d.ts +2 -2
- package/Routable/tests/Routable-specs.js +26 -17
- package/Routable/tests/Router-specs.js +65 -41
- package/Scrollable/Scrollable.js +2 -1
- package/Scrollable/ScrollableNative.js +2 -1
- package/Scroller/Scroller.d.ts +2 -2
- package/Scroller/ScrollerBasic.js +1 -1
- package/Scroller/UiScrollerBase.js +1 -1
- package/Skinnable/tests/Skinnable-specs.js +102 -54
- package/Skinnable/tests/useSkins-specs.js +37 -42
- package/Slider/Slider.d.ts +3 -3
- package/Slider/tests/Slider-specs.js +4 -4
- package/SlotItem/SlotItem.d.ts +2 -2
- package/SlotItem/tests/SlotItem-specs.js +4 -4
- package/Slottable/tests/Slottable-specs.js +67 -36
- package/Slottable/tests/useSlots-specs.js +68 -35
- package/Spinner/Spinner.d.ts +1 -1
- package/Spinner/tests/Spinner-specs.js +46 -31
- package/ToggleIcon/tests/ToggleIcon-specs.js +32 -20
- package/ToggleItem/ToggleItem.d.ts +13 -11
- package/ToggleItem/tests/ToggleItem-specs.js +51 -34
- package/Toggleable/Toggle.js +6 -6
- package/Toggleable/Toggleable.js +6 -12
- package/Toggleable/tests/Toggleable-specs.js +428 -324
- package/Touchable/Drag.js +13 -17
- package/Touchable/Flick.js +20 -16
- package/Touchable/Hold.js +14 -19
- package/Touchable/Touchable.d.ts +3 -3
- package/Touchable/tests/Touchable-specs.js +223 -109
- package/Touchable/tests/useTouch-specs.js +159 -84
- package/Transition/Transition.d.ts +29 -27
- package/Transition/Transition.js +5 -9
- package/Transition/tests/Transition-specs.js +135 -31
- package/ViewManager/TransitionGroup.js +6 -5
- package/ViewManager/View.js +1 -1
- package/ViewManager/ViewManager.d.ts +4 -4
- package/ViewManager/ViewManager.js +10 -10
- package/ViewManager/tests/View-specs.js +109 -81
- package/ViewManager/tests/ViewManager-specs.js +471 -185
- package/VirtualList/UiVirtualListBase.js +1 -1
- package/VirtualList/VirtualList.d.ts +11 -9
- package/VirtualList/VirtualListBasic.js +1 -1
- package/VirtualList/tests/VirtualList-specs.js +44 -31
- package/internal/IdProvider/tests/useId-specs.js +35 -18
- package/package.json +11 -11
- package/resolution/tests/ResolutionDecorator-specs.js +17 -8
- package/styles/mixins.less +14 -2
- package/useControlledState/tests/useControlledState-specs.js +67 -42
- package/useScroll/useScroll.js +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _react = require("react");
|
|
3
|
+
var _react = require("@testing-library/react");
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _react2 = require("react");
|
|
6
6
|
|
|
7
7
|
var _SlotItem = _interopRequireDefault(require("../SlotItem"));
|
|
8
8
|
|
|
@@ -12,13 +12,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
12
12
|
|
|
13
13
|
describe('SlotItem', function () {
|
|
14
14
|
test('should return a DOM node reference for `componentRef`', function () {
|
|
15
|
-
var component = /*#__PURE__*/(0,
|
|
15
|
+
var component = /*#__PURE__*/(0, _react2.forwardRef)(function (props, fn) {
|
|
16
16
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
17
17
|
ref: fn
|
|
18
18
|
});
|
|
19
19
|
});
|
|
20
20
|
var ref = jest.fn();
|
|
21
|
-
(0,
|
|
21
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_SlotItem["default"], {
|
|
22
22
|
ref: ref,
|
|
23
23
|
component: component
|
|
24
24
|
}));
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _enzyme = require("enzyme");
|
|
4
|
-
|
|
5
3
|
var _kind = _interopRequireDefault(require("@enact/core/kind"));
|
|
6
4
|
|
|
5
|
+
require("@testing-library/jest-dom");
|
|
6
|
+
|
|
7
|
+
var _react = require("@testing-library/react");
|
|
8
|
+
|
|
7
9
|
var _Slottable = _interopRequireDefault(require("../Slottable"));
|
|
8
10
|
|
|
9
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -20,10 +22,11 @@ describe('Slottable Specs', function () {
|
|
|
20
22
|
b = _ref.b,
|
|
21
23
|
c = _ref.c;
|
|
22
24
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
25
|
+
"data-testid": "slottable",
|
|
23
26
|
children: [c, b, a]
|
|
24
27
|
});
|
|
25
28
|
});
|
|
26
|
-
|
|
29
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
27
30
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
28
31
|
slot: "a",
|
|
29
32
|
children: "A"
|
|
@@ -35,9 +38,11 @@ describe('Slottable Specs', function () {
|
|
|
35
38
|
children: "C"
|
|
36
39
|
})]
|
|
37
40
|
}));
|
|
41
|
+
|
|
42
|
+
var actual = _react.screen.getByTestId('slottable');
|
|
43
|
+
|
|
38
44
|
var expected = 'CBA';
|
|
39
|
-
|
|
40
|
-
expect(actual).toBe(expected);
|
|
45
|
+
expect(actual.textContent).toBe(expected);
|
|
41
46
|
});
|
|
42
47
|
test('should distribute children with a \'type\' that matches a slot', function () {
|
|
43
48
|
var Component = (0, _Slottable["default"])({
|
|
@@ -48,10 +53,11 @@ describe('Slottable Specs', function () {
|
|
|
48
53
|
c = _ref2.c,
|
|
49
54
|
custom = _ref2.custom;
|
|
50
55
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
56
|
+
"data-testid": "slottable",
|
|
51
57
|
children: [c, b, a, custom]
|
|
52
58
|
});
|
|
53
59
|
});
|
|
54
|
-
|
|
60
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
55
61
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
56
62
|
slot: "a",
|
|
57
63
|
children: "A"
|
|
@@ -65,9 +71,11 @@ describe('Slottable Specs', function () {
|
|
|
65
71
|
children: "C"
|
|
66
72
|
})]
|
|
67
73
|
}));
|
|
74
|
+
|
|
75
|
+
var actual = _react.screen.getByTestId('slottable');
|
|
76
|
+
|
|
68
77
|
var expected = 'CBAD';
|
|
69
|
-
|
|
70
|
-
expect(actual).toBe(expected);
|
|
78
|
+
expect(actual.textContent).toBe(expected);
|
|
71
79
|
});
|
|
72
80
|
test('should distribute children whose \'type\' has a \'defaultSlot\' property that matches a slot', function () {
|
|
73
81
|
var Custom = (0, _kind["default"])({
|
|
@@ -87,10 +95,11 @@ describe('Slottable Specs', function () {
|
|
|
87
95
|
b = _ref4.b,
|
|
88
96
|
c = _ref4.c;
|
|
89
97
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
98
|
+
"data-testid": "slottable",
|
|
90
99
|
children: [c, b, a]
|
|
91
100
|
});
|
|
92
101
|
});
|
|
93
|
-
|
|
102
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
94
103
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
95
104
|
slot: "a",
|
|
96
105
|
children: "A"
|
|
@@ -102,8 +111,10 @@ describe('Slottable Specs', function () {
|
|
|
102
111
|
})]
|
|
103
112
|
}));
|
|
104
113
|
var expected = 'CBA';
|
|
105
|
-
|
|
106
|
-
|
|
114
|
+
|
|
115
|
+
var actual = _react.screen.getByTestId('slottable');
|
|
116
|
+
|
|
117
|
+
expect(actual.textContent).toBe(expected);
|
|
107
118
|
});
|
|
108
119
|
test('should distribute children with no \'slot\' property to Slottable\'s \'children\'', function () {
|
|
109
120
|
var Component = (0, _Slottable["default"])({
|
|
@@ -113,10 +124,11 @@ describe('Slottable Specs', function () {
|
|
|
113
124
|
b = _ref5.b,
|
|
114
125
|
children = _ref5.children;
|
|
115
126
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
127
|
+
"data-testid": "slottable",
|
|
116
128
|
children: [children, b, a]
|
|
117
129
|
});
|
|
118
130
|
});
|
|
119
|
-
|
|
131
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
120
132
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
121
133
|
slot: "a",
|
|
122
134
|
children: "A"
|
|
@@ -128,8 +140,10 @@ describe('Slottable Specs', function () {
|
|
|
128
140
|
})]
|
|
129
141
|
}));
|
|
130
142
|
var expected = 'CBA';
|
|
131
|
-
|
|
132
|
-
|
|
143
|
+
|
|
144
|
+
var actual = _react.screen.getByTestId('slottable');
|
|
145
|
+
|
|
146
|
+
expect(actual.textContent).toBe(expected);
|
|
133
147
|
});
|
|
134
148
|
test('should not distribute children with an invalid \'slot\' property', function () {
|
|
135
149
|
// Modify the console spy to silence error output with
|
|
@@ -142,10 +156,11 @@ describe('Slottable Specs', function () {
|
|
|
142
156
|
b = _ref6.b,
|
|
143
157
|
c = _ref6.c;
|
|
144
158
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
159
|
+
"data-testid": "slottable",
|
|
145
160
|
children: [c, b, a]
|
|
146
161
|
});
|
|
147
162
|
});
|
|
148
|
-
|
|
163
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
149
164
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
150
165
|
slot: "a",
|
|
151
166
|
children: "A"
|
|
@@ -158,8 +173,10 @@ describe('Slottable Specs', function () {
|
|
|
158
173
|
})]
|
|
159
174
|
}));
|
|
160
175
|
var expected = 'BA';
|
|
161
|
-
|
|
162
|
-
|
|
176
|
+
|
|
177
|
+
var actual = _react.screen.getByTestId('slottable');
|
|
178
|
+
|
|
179
|
+
expect(actual.textContent).toBe(expected); // Check to make sure that we only get the one expected error
|
|
163
180
|
|
|
164
181
|
var actualErrorsLength = console.error.mock.calls.length;
|
|
165
182
|
var expectedErrorLength = 1;
|
|
@@ -178,10 +195,11 @@ describe('Slottable Specs', function () {
|
|
|
178
195
|
custom = _ref7.custom;
|
|
179
196
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
180
197
|
className: "root-div",
|
|
198
|
+
"data-testid": "slottable",
|
|
181
199
|
children: [c, b, a, custom]
|
|
182
200
|
});
|
|
183
201
|
});
|
|
184
|
-
|
|
202
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
185
203
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
186
204
|
slot: "a",
|
|
187
205
|
title: "Div A"
|
|
@@ -196,11 +214,15 @@ describe('Slottable Specs', function () {
|
|
|
196
214
|
})]
|
|
197
215
|
}));
|
|
198
216
|
var expected = 'CBD';
|
|
199
|
-
|
|
200
|
-
|
|
217
|
+
|
|
218
|
+
var actual = _react.screen.getByTestId('slottable');
|
|
219
|
+
|
|
220
|
+
expect(actual.textContent).toBe(expected);
|
|
201
221
|
var expectedTitle = 'Div A';
|
|
202
|
-
|
|
203
|
-
|
|
222
|
+
|
|
223
|
+
var actualChild = _react.screen.getByTestId('slottable').children[2];
|
|
224
|
+
|
|
225
|
+
expect(actualChild).toHaveAttribute('title', expectedTitle);
|
|
204
226
|
});
|
|
205
227
|
test('should preserve values in \'slot\' property', function () {
|
|
206
228
|
// This suppresses the unique key warning that this implementation creates. Also, we can't
|
|
@@ -211,10 +233,11 @@ describe('Slottable Specs', function () {
|
|
|
211
233
|
}, function (_ref8) {
|
|
212
234
|
var a = _ref8.a;
|
|
213
235
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
236
|
+
"data-testid": "slottable",
|
|
214
237
|
children: a
|
|
215
238
|
});
|
|
216
239
|
});
|
|
217
|
-
|
|
240
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
218
241
|
a: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
219
242
|
children: "X"
|
|
220
243
|
}, "X"),
|
|
@@ -224,8 +247,10 @@ describe('Slottable Specs', function () {
|
|
|
224
247
|
}, "A")
|
|
225
248
|
}));
|
|
226
249
|
var expected = 'XA';
|
|
227
|
-
|
|
228
|
-
|
|
250
|
+
|
|
251
|
+
var actual = _react.screen.getByTestId('slottable');
|
|
252
|
+
|
|
253
|
+
expect(actual.textContent).toBe(expected);
|
|
229
254
|
});
|
|
230
255
|
test('should add values to existing array in \'slot\' property', function () {
|
|
231
256
|
var Component = (0, _Slottable["default"])({
|
|
@@ -233,12 +258,13 @@ describe('Slottable Specs', function () {
|
|
|
233
258
|
}, function (_ref9) {
|
|
234
259
|
var a = _ref9.a;
|
|
235
260
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
261
|
+
"data-testid": "slottable",
|
|
236
262
|
children: a
|
|
237
263
|
});
|
|
238
264
|
});
|
|
239
265
|
/* eslint-disable jsx-a11y/anchor-is-valid */
|
|
240
266
|
|
|
241
|
-
|
|
267
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
242
268
|
a: ['a', 'b'],
|
|
243
269
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
244
270
|
children: "c"
|
|
@@ -246,15 +272,16 @@ describe('Slottable Specs', function () {
|
|
|
246
272
|
}));
|
|
247
273
|
/* eslint-enable jsx-a11y/anchor-is-valid */
|
|
248
274
|
|
|
249
|
-
var
|
|
250
|
-
|
|
251
|
-
expect(actual).
|
|
275
|
+
var actual = _react.screen.getByTestId('slottable');
|
|
276
|
+
|
|
277
|
+
expect(actual).toHaveTextContent('abc');
|
|
252
278
|
});
|
|
253
279
|
test('should distribute multiple children with the same slot into the same slot', function () {
|
|
254
280
|
function ComponentBase(_ref10) {
|
|
255
281
|
var a = _ref10.a;
|
|
256
282
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
257
283
|
className: "root-div",
|
|
284
|
+
"data-testid": "slottable",
|
|
258
285
|
children: a
|
|
259
286
|
});
|
|
260
287
|
}
|
|
@@ -262,7 +289,7 @@ describe('Slottable Specs', function () {
|
|
|
262
289
|
var Component = (0, _Slottable["default"])({
|
|
263
290
|
slots: ['a']
|
|
264
291
|
}, ComponentBase);
|
|
265
|
-
|
|
292
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
266
293
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
267
294
|
slot: "a",
|
|
268
295
|
children: "A"
|
|
@@ -275,13 +302,16 @@ describe('Slottable Specs', function () {
|
|
|
275
302
|
})]
|
|
276
303
|
}));
|
|
277
304
|
var expected = 'AAA';
|
|
278
|
-
|
|
279
|
-
|
|
305
|
+
|
|
306
|
+
var actual = _react.screen.getByTestId('slottable');
|
|
307
|
+
|
|
308
|
+
expect(actual.textContent).toBe(expected);
|
|
280
309
|
});
|
|
281
310
|
test('should allow downstream component to have default value for unset slot', function () {
|
|
282
311
|
function ComponentBase(_ref11) {
|
|
283
312
|
var a = _ref11.a;
|
|
284
313
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
314
|
+
"data-testid": "slottable",
|
|
285
315
|
children: a
|
|
286
316
|
});
|
|
287
317
|
}
|
|
@@ -292,9 +322,10 @@ describe('Slottable Specs', function () {
|
|
|
292
322
|
var Component = (0, _Slottable["default"])({
|
|
293
323
|
slots: ['a']
|
|
294
324
|
}, ComponentBase);
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
var actual =
|
|
298
|
-
|
|
325
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {}));
|
|
326
|
+
|
|
327
|
+
var actual = _react.screen.getByTestId('slottable');
|
|
328
|
+
|
|
329
|
+
expect(actual).toHaveTextContent('Default A');
|
|
299
330
|
});
|
|
300
331
|
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
require("@testing-library/jest-dom");
|
|
4
|
+
|
|
5
|
+
var _react = require("@testing-library/react");
|
|
4
6
|
|
|
5
7
|
var _useSlots = _interopRequireDefault(require("../useSlots"));
|
|
6
8
|
|
|
@@ -23,11 +25,12 @@ describe('useSlots', function () {
|
|
|
23
25
|
children: children
|
|
24
26
|
});
|
|
25
27
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
28
|
+
"data-testid": "useSlots",
|
|
26
29
|
children: [slots.c, slots.b, slots.a]
|
|
27
30
|
});
|
|
28
31
|
}
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
31
34
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
32
35
|
slot: "a",
|
|
33
36
|
children: "A"
|
|
@@ -40,8 +43,10 @@ describe('useSlots', function () {
|
|
|
40
43
|
})]
|
|
41
44
|
}));
|
|
42
45
|
var expected = 'CBA';
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
|
|
47
|
+
var actual = _react.screen.getByTestId('useSlots');
|
|
48
|
+
|
|
49
|
+
expect(actual.textContent).toBe(expected);
|
|
45
50
|
});
|
|
46
51
|
test('should have no children when all have been distributed', function () {
|
|
47
52
|
function Component(_ref2) {
|
|
@@ -56,11 +61,12 @@ describe('useSlots', function () {
|
|
|
56
61
|
children: children
|
|
57
62
|
});
|
|
58
63
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
64
|
+
"data-testid": "useSlots",
|
|
59
65
|
children: slots.children
|
|
60
66
|
});
|
|
61
67
|
}
|
|
62
68
|
|
|
63
|
-
|
|
69
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
64
70
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
65
71
|
slot: "a",
|
|
66
72
|
children: "A"
|
|
@@ -73,8 +79,10 @@ describe('useSlots', function () {
|
|
|
73
79
|
})]
|
|
74
80
|
}));
|
|
75
81
|
var expected = '';
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
|
|
83
|
+
var actual = _react.screen.getByTestId('useSlots');
|
|
84
|
+
|
|
85
|
+
expect(actual).toHaveTextContent(expected);
|
|
78
86
|
});
|
|
79
87
|
test('should distribute children with a \'type\' that matches a slot', function () {
|
|
80
88
|
function Component(_ref3) {
|
|
@@ -91,11 +99,12 @@ describe('useSlots', function () {
|
|
|
91
99
|
custom: custom
|
|
92
100
|
});
|
|
93
101
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
102
|
+
"data-testid": "useSlots",
|
|
94
103
|
children: [slots.c, slots.b, slots.a, slots.custom]
|
|
95
104
|
});
|
|
96
105
|
}
|
|
97
106
|
|
|
98
|
-
|
|
107
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
99
108
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
100
109
|
slot: "a",
|
|
101
110
|
children: "A"
|
|
@@ -110,8 +119,10 @@ describe('useSlots', function () {
|
|
|
110
119
|
})]
|
|
111
120
|
}));
|
|
112
121
|
var expected = 'CBAD';
|
|
113
|
-
|
|
114
|
-
|
|
122
|
+
|
|
123
|
+
var actual = _react.screen.getByTestId('useSlots');
|
|
124
|
+
|
|
125
|
+
expect(actual.textContent).toBe(expected);
|
|
115
126
|
});
|
|
116
127
|
test('should distribute children whose \'type\' has a \'defaultSlot\' property that matches a slot', function () {
|
|
117
128
|
function Custom(props) {
|
|
@@ -134,11 +145,12 @@ describe('useSlots', function () {
|
|
|
134
145
|
children: children
|
|
135
146
|
});
|
|
136
147
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
148
|
+
"data-testid": "useSlots",
|
|
137
149
|
children: [slots.c, slots.b, slots.a]
|
|
138
150
|
});
|
|
139
151
|
}
|
|
140
152
|
|
|
141
|
-
|
|
153
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
142
154
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
143
155
|
slot: "a",
|
|
144
156
|
children: "A"
|
|
@@ -150,8 +162,10 @@ describe('useSlots', function () {
|
|
|
150
162
|
})]
|
|
151
163
|
}));
|
|
152
164
|
var expected = 'CBA';
|
|
153
|
-
|
|
154
|
-
|
|
165
|
+
|
|
166
|
+
var actual = _react.screen.getByTestId('useSlots');
|
|
167
|
+
|
|
168
|
+
expect(actual.textContent).toBe(expected);
|
|
155
169
|
});
|
|
156
170
|
test('should distribute children with no \'slot\' property to Slottable\'s \'children\'', function () {
|
|
157
171
|
function Component(_ref5) {
|
|
@@ -164,11 +178,12 @@ describe('useSlots', function () {
|
|
|
164
178
|
children: children
|
|
165
179
|
});
|
|
166
180
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
181
|
+
"data-testid": "useSlots",
|
|
167
182
|
children: [slots.children, slots.b, slots.a]
|
|
168
183
|
});
|
|
169
184
|
}
|
|
170
185
|
|
|
171
|
-
|
|
186
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
172
187
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
173
188
|
slot: "a",
|
|
174
189
|
children: "A"
|
|
@@ -180,8 +195,10 @@ describe('useSlots', function () {
|
|
|
180
195
|
})]
|
|
181
196
|
}));
|
|
182
197
|
var expected = 'CBA';
|
|
183
|
-
|
|
184
|
-
|
|
198
|
+
|
|
199
|
+
var actual = _react.screen.getByTestId('useSlots');
|
|
200
|
+
|
|
201
|
+
expect(actual.textContent).toBe(expected);
|
|
185
202
|
});
|
|
186
203
|
test('should not distribute children with an invalid \'slot\' property', function () {
|
|
187
204
|
// Modify the console spy to silence error output with
|
|
@@ -198,11 +215,12 @@ describe('useSlots', function () {
|
|
|
198
215
|
children: children
|
|
199
216
|
});
|
|
200
217
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
218
|
+
"data-testid": "useSlots",
|
|
201
219
|
children: [slots.c, slots.b, slots.a]
|
|
202
220
|
});
|
|
203
221
|
}
|
|
204
222
|
|
|
205
|
-
|
|
223
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
206
224
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
207
225
|
slot: "a",
|
|
208
226
|
children: "A"
|
|
@@ -215,8 +233,11 @@ describe('useSlots', function () {
|
|
|
215
233
|
})]
|
|
216
234
|
}));
|
|
217
235
|
var expected = 'BA';
|
|
218
|
-
|
|
219
|
-
|
|
236
|
+
|
|
237
|
+
var actual = _react.screen.getByTestId('useSlots');
|
|
238
|
+
|
|
239
|
+
expect(actual.textContent).toBe(expected);
|
|
240
|
+
expect(actual.textContent).toHaveLength(2); // Check to make sure that we only get the one expected error
|
|
220
241
|
|
|
221
242
|
var actualErrorsLength = console.error.mock.calls.length;
|
|
222
243
|
var expectedErrorLength = 1;
|
|
@@ -241,11 +262,12 @@ describe('useSlots', function () {
|
|
|
241
262
|
});
|
|
242
263
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
243
264
|
className: "root-div",
|
|
265
|
+
"data-testid": "useSlots",
|
|
244
266
|
children: [slots.c, slots.b, slots.a, slots.custom]
|
|
245
267
|
});
|
|
246
268
|
}
|
|
247
269
|
|
|
248
|
-
|
|
270
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
249
271
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
250
272
|
slot: "a",
|
|
251
273
|
title: "Div A"
|
|
@@ -260,11 +282,15 @@ describe('useSlots', function () {
|
|
|
260
282
|
})]
|
|
261
283
|
}));
|
|
262
284
|
var expected = 'CBD';
|
|
263
|
-
|
|
264
|
-
|
|
285
|
+
|
|
286
|
+
var actual = _react.screen.getByTestId('useSlots');
|
|
287
|
+
|
|
288
|
+
expect(actual.textContent).toBe(expected);
|
|
265
289
|
var expectedTitle = 'Div A';
|
|
266
|
-
|
|
267
|
-
|
|
290
|
+
|
|
291
|
+
var actualChild = _react.screen.getByTestId('useSlots').children[2];
|
|
292
|
+
|
|
293
|
+
expect(actualChild).toHaveAttribute('title', expectedTitle);
|
|
268
294
|
});
|
|
269
295
|
test('should distribute multiple children with the same slot into the same slot', function () {
|
|
270
296
|
function Component(_ref8) {
|
|
@@ -275,11 +301,12 @@ describe('useSlots', function () {
|
|
|
275
301
|
children: children
|
|
276
302
|
});
|
|
277
303
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
304
|
+
"data-testid": "useSlots",
|
|
278
305
|
children: slots.a
|
|
279
306
|
});
|
|
280
307
|
}
|
|
281
308
|
|
|
282
|
-
|
|
309
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
283
310
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
284
311
|
slot: "a",
|
|
285
312
|
children: "A"
|
|
@@ -292,8 +319,10 @@ describe('useSlots', function () {
|
|
|
292
319
|
})]
|
|
293
320
|
}));
|
|
294
321
|
var expected = 'AAA';
|
|
295
|
-
|
|
296
|
-
|
|
322
|
+
|
|
323
|
+
var actual = _react.screen.getByTestId('useSlots');
|
|
324
|
+
|
|
325
|
+
expect(actual.textContent).toBe(expected);
|
|
297
326
|
});
|
|
298
327
|
test('should override prop with slot value', function () {
|
|
299
328
|
function Component(_ref9) {
|
|
@@ -304,20 +333,22 @@ describe('useSlots', function () {
|
|
|
304
333
|
children: children
|
|
305
334
|
});
|
|
306
335
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
336
|
+
"data-testid": "useSlots",
|
|
307
337
|
children: slots.a
|
|
308
338
|
});
|
|
309
339
|
}
|
|
310
340
|
|
|
311
|
-
|
|
341
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
312
342
|
a: "B",
|
|
313
343
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
314
344
|
slot: "a",
|
|
315
345
|
children: "A"
|
|
316
346
|
})
|
|
317
347
|
}));
|
|
318
|
-
|
|
319
|
-
var actual =
|
|
320
|
-
|
|
348
|
+
|
|
349
|
+
var actual = _react.screen.getByTestId('useSlots');
|
|
350
|
+
|
|
351
|
+
expect(actual).toHaveTextContent('A');
|
|
321
352
|
});
|
|
322
353
|
test('should fallback to prop when slot is omitted', function () {
|
|
323
354
|
function Component(_ref10) {
|
|
@@ -328,15 +359,17 @@ describe('useSlots', function () {
|
|
|
328
359
|
children: children
|
|
329
360
|
});
|
|
330
361
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
362
|
+
"data-testid": "useSlots",
|
|
331
363
|
children: slots.a
|
|
332
364
|
});
|
|
333
365
|
}
|
|
334
366
|
|
|
335
|
-
|
|
367
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
336
368
|
a: "B"
|
|
337
369
|
}));
|
|
338
|
-
|
|
339
|
-
var actual =
|
|
340
|
-
|
|
370
|
+
|
|
371
|
+
var actual = _react.screen.getByTestId('useSlots');
|
|
372
|
+
|
|
373
|
+
expect(actual).toHaveTextContent('B');
|
|
341
374
|
});
|
|
342
375
|
});
|
package/Spinner/Spinner.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ changes the rendering tree and where this is used.
|
|
|
26
26
|
* * 'container' blocks up to the nearest ancestor with absolute or relative positioning
|
|
27
27
|
*
|
|
28
28
|
* When `blockClickOn` is either `'screen'` or `'container'` , a translucent scrim can be added
|
|
29
|
-
by setting
|
|
29
|
+
by setting [scrim] prop to `true` .
|
|
30
30
|
*/
|
|
31
31
|
blockClickOn?: string | any;
|
|
32
32
|
/**
|