@enact/ui 4.1.2 → 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 +4 -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 +1 -0
- package/Scrollable/ScrollableNative.js +1 -0
- package/Scroller/Scroller.d.ts +2 -2
- 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/VirtualList.d.ts +11 -9
- 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
|
@@ -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 _Skinnable = _interopRequireDefault(require("../Skinnable"));
|
|
6
8
|
|
|
@@ -17,16 +19,16 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
17
19
|
describe('Skinnable Specs', function () {
|
|
18
20
|
test('should do nothing when nothing is specified', function () {
|
|
19
21
|
var config = {};
|
|
22
|
+
var data;
|
|
20
23
|
|
|
21
24
|
var Component = function Component(props) {
|
|
25
|
+
data = props;
|
|
22
26
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread({}, props));
|
|
23
27
|
};
|
|
24
28
|
|
|
25
29
|
var SkinnableComponent = (0, _Skinnable["default"])(config, Component);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var actual = Object.keys(subject.find('div').props()).length;
|
|
29
|
-
expect(actual).toEqual(expected);
|
|
30
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableComponent, {}));
|
|
31
|
+
expect(data).toMatchObject({});
|
|
30
32
|
});
|
|
31
33
|
test('should add a default skin class when no skin prop is specified', function () {
|
|
32
34
|
var config = {
|
|
@@ -42,10 +44,14 @@ describe('Skinnable Specs', function () {
|
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
var SkinnableComponent = (0, _Skinnable["default"])(config, Component);
|
|
45
|
-
|
|
47
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableComponent, {
|
|
48
|
+
"data-testid": "skinnableComponent"
|
|
49
|
+
}));
|
|
46
50
|
var expected = 'darkSkin';
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
|
|
52
|
+
var component = _react.screen.getByTestId('skinnableComponent');
|
|
53
|
+
|
|
54
|
+
expect(component).toHaveClass(expected);
|
|
49
55
|
});
|
|
50
56
|
test('should add the preferred skin class when the skin prop is specified', function () {
|
|
51
57
|
var config = {
|
|
@@ -61,12 +67,15 @@ describe('Skinnable Specs', function () {
|
|
|
61
67
|
};
|
|
62
68
|
|
|
63
69
|
var SkinnableComponent = (0, _Skinnable["default"])(config, Component);
|
|
64
|
-
|
|
70
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableComponent, {
|
|
71
|
+
"data-testid": "skinnableComponent",
|
|
65
72
|
skin: "light"
|
|
66
73
|
}));
|
|
67
74
|
var expected = 'lightSkin';
|
|
68
|
-
|
|
69
|
-
|
|
75
|
+
|
|
76
|
+
var component = _react.screen.getByTestId('skinnableComponent');
|
|
77
|
+
|
|
78
|
+
expect(component).toHaveClass(expected);
|
|
70
79
|
});
|
|
71
80
|
test('should ignore the preferred skin prop if it\'s not one of the available skins', function () {
|
|
72
81
|
var config = {
|
|
@@ -76,18 +85,19 @@ describe('Skinnable Specs', function () {
|
|
|
76
85
|
light: 'lightSkin'
|
|
77
86
|
}
|
|
78
87
|
};
|
|
88
|
+
var data;
|
|
79
89
|
|
|
80
90
|
var Component = function Component(props) {
|
|
91
|
+
data = props;
|
|
81
92
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread({}, props));
|
|
82
93
|
};
|
|
83
94
|
|
|
84
95
|
var SkinnableComponent = (0, _Skinnable["default"])(config, Component);
|
|
85
|
-
|
|
96
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableComponent, {
|
|
97
|
+
"data-testid": "skinnableComponent",
|
|
86
98
|
skin: "potato"
|
|
87
99
|
}));
|
|
88
|
-
|
|
89
|
-
var actual = subject.find('div').prop('className');
|
|
90
|
-
expect(actual).toEqual(expected);
|
|
100
|
+
expect(data).toMatchObject({});
|
|
91
101
|
});
|
|
92
102
|
test('should ignore the preferred skin prop if it\'s not one of the available skins and not interfere with the className prop', function () {
|
|
93
103
|
var config = {
|
|
@@ -103,13 +113,16 @@ describe('Skinnable Specs', function () {
|
|
|
103
113
|
};
|
|
104
114
|
|
|
105
115
|
var SkinnableComponent = (0, _Skinnable["default"])(config, Component);
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
116
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableComponent, {
|
|
117
|
+
className: "cheatingComponent",
|
|
118
|
+
"data-testid": "skinnableComponent",
|
|
119
|
+
skin: "potato"
|
|
109
120
|
}));
|
|
110
121
|
var expected = 'cheatingComponent';
|
|
111
|
-
|
|
112
|
-
|
|
122
|
+
|
|
123
|
+
var component = _react.screen.getByTestId('skinnableComponent');
|
|
124
|
+
|
|
125
|
+
expect(component).toHaveClass(expected);
|
|
113
126
|
});
|
|
114
127
|
test('should ignore the skinVariants prop if there are no defined allowedVariants', function () {
|
|
115
128
|
var config = {
|
|
@@ -125,12 +138,15 @@ describe('Skinnable Specs', function () {
|
|
|
125
138
|
};
|
|
126
139
|
|
|
127
140
|
var SkinnableComponent = (0, _Skinnable["default"])(config, Component);
|
|
128
|
-
|
|
141
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableComponent, {
|
|
142
|
+
"data-testid": "skinnableComponent",
|
|
129
143
|
skinVariants: "potato"
|
|
130
144
|
}));
|
|
131
145
|
var expected = 'darkSkin';
|
|
132
|
-
|
|
133
|
-
|
|
146
|
+
|
|
147
|
+
var component = _react.screen.getByTestId('skinnableComponent');
|
|
148
|
+
|
|
149
|
+
expect(component).toHaveClass(expected);
|
|
134
150
|
});
|
|
135
151
|
test('should only apply allowed variants assigned by the skinVariants prop', function () {
|
|
136
152
|
var config = {
|
|
@@ -147,12 +163,15 @@ describe('Skinnable Specs', function () {
|
|
|
147
163
|
};
|
|
148
164
|
|
|
149
165
|
var SkinnableComponent = (0, _Skinnable["default"])(config, Component);
|
|
150
|
-
|
|
166
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableComponent, {
|
|
167
|
+
"data-testid": "skinnableComponent",
|
|
151
168
|
skinVariants: "normal potato unicase"
|
|
152
169
|
}));
|
|
153
170
|
var expected = 'darkSkin normal unicase';
|
|
154
|
-
|
|
155
|
-
|
|
171
|
+
|
|
172
|
+
var component = _react.screen.getByTestId('skinnableComponent');
|
|
173
|
+
|
|
174
|
+
expect(component).toHaveClass(expected);
|
|
156
175
|
});
|
|
157
176
|
test('should apply default variants even if the skinVariants prop is explicitly empty', function () {
|
|
158
177
|
var config = {
|
|
@@ -170,12 +189,15 @@ describe('Skinnable Specs', function () {
|
|
|
170
189
|
};
|
|
171
190
|
|
|
172
191
|
var SkinnableComponent = (0, _Skinnable["default"])(config, Component);
|
|
173
|
-
|
|
192
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableComponent, {
|
|
193
|
+
"data-testid": "skinnableComponent",
|
|
174
194
|
skinVariants: ""
|
|
175
195
|
}));
|
|
176
196
|
var expected = 'darkSkin normal';
|
|
177
|
-
|
|
178
|
-
|
|
197
|
+
|
|
198
|
+
var component = _react.screen.getByTestId('skinnableComponent');
|
|
199
|
+
|
|
200
|
+
expect(component).toHaveClass(expected);
|
|
179
201
|
});
|
|
180
202
|
test('should apply default variants and the skinVariants if both are defined', function () {
|
|
181
203
|
var config = {
|
|
@@ -193,12 +215,15 @@ describe('Skinnable Specs', function () {
|
|
|
193
215
|
};
|
|
194
216
|
|
|
195
217
|
var SkinnableComponent = (0, _Skinnable["default"])(config, Component);
|
|
196
|
-
|
|
218
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableComponent, {
|
|
219
|
+
"data-testid": "skinnableComponent",
|
|
197
220
|
skinVariants: "unicase"
|
|
198
221
|
}));
|
|
199
222
|
var expected = 'darkSkin normal unicase';
|
|
200
|
-
|
|
201
|
-
|
|
223
|
+
|
|
224
|
+
var component = _react.screen.getByTestId('skinnableComponent');
|
|
225
|
+
|
|
226
|
+
expect(component).toHaveClass(expected);
|
|
202
227
|
});
|
|
203
228
|
test('should apply variants supplied via an array or a string in the same way', function () {
|
|
204
229
|
var config = {
|
|
@@ -216,13 +241,21 @@ describe('Skinnable Specs', function () {
|
|
|
216
241
|
};
|
|
217
242
|
|
|
218
243
|
var SkinnableComponent = (0, _Skinnable["default"])(config, Component);
|
|
219
|
-
|
|
244
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableComponent, {
|
|
245
|
+
"data-testid": "skinnableComponent1",
|
|
220
246
|
skinVariants: "normal unicase"
|
|
221
247
|
}));
|
|
222
|
-
|
|
248
|
+
|
|
249
|
+
var component1ClassNames = _react.screen.getByTestId('skinnableComponent1').className;
|
|
250
|
+
|
|
251
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableComponent, {
|
|
252
|
+
"data-testid": "skinnableComponent2",
|
|
223
253
|
skinVariants: ['normal', 'unicase']
|
|
224
254
|
}));
|
|
225
|
-
|
|
255
|
+
|
|
256
|
+
var component2ClassNames = _react.screen.getByTestId('skinnableComponent2').className;
|
|
257
|
+
|
|
258
|
+
expect(component1ClassNames).toEqual(component2ClassNames);
|
|
226
259
|
});
|
|
227
260
|
test('should allow opting out of the default variants if an object is supplied to skinVariants with false as variant-key values', function () {
|
|
228
261
|
var config = {
|
|
@@ -240,15 +273,18 @@ describe('Skinnable Specs', function () {
|
|
|
240
273
|
};
|
|
241
274
|
|
|
242
275
|
var SkinnableComponent = (0, _Skinnable["default"])(config, Component);
|
|
243
|
-
|
|
276
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableComponent, {
|
|
277
|
+
"data-testid": "skinnableComponent",
|
|
244
278
|
skinVariants: {
|
|
245
279
|
normal: false,
|
|
246
280
|
unicase: true
|
|
247
281
|
}
|
|
248
282
|
}));
|
|
249
283
|
var expected = 'darkSkin unicase';
|
|
250
|
-
|
|
251
|
-
|
|
284
|
+
|
|
285
|
+
var component = _react.screen.getByTestId('skinnableComponent');
|
|
286
|
+
|
|
287
|
+
expect(component).toHaveClass(expected);
|
|
252
288
|
});
|
|
253
289
|
test('should ignore variants, sent by an object, equaling null, undefined, or empty string', function () {
|
|
254
290
|
var config = {
|
|
@@ -266,7 +302,8 @@ describe('Skinnable Specs', function () {
|
|
|
266
302
|
};
|
|
267
303
|
|
|
268
304
|
var SkinnableComponent = (0, _Skinnable["default"])(config, Component);
|
|
269
|
-
|
|
305
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableComponent, {
|
|
306
|
+
"data-testid": "skinnableComponent",
|
|
270
307
|
skinVariants: {
|
|
271
308
|
normal: null,
|
|
272
309
|
smallCaps: void 0,
|
|
@@ -274,8 +311,10 @@ describe('Skinnable Specs', function () {
|
|
|
274
311
|
}
|
|
275
312
|
}));
|
|
276
313
|
var expected = 'darkSkin normal';
|
|
277
|
-
|
|
278
|
-
|
|
314
|
+
|
|
315
|
+
var component = _react.screen.getByTestId('skinnableComponent');
|
|
316
|
+
|
|
317
|
+
expect(component).toHaveClass(expected);
|
|
279
318
|
});
|
|
280
319
|
test('should apply parent variants', function () {
|
|
281
320
|
var config = {
|
|
@@ -294,15 +333,18 @@ describe('Skinnable Specs', function () {
|
|
|
294
333
|
|
|
295
334
|
var SkinnableParent = (0, _Skinnable["default"])(config, Component);
|
|
296
335
|
var SkinnableChild = (0, _Skinnable["default"])(config, Component);
|
|
297
|
-
|
|
336
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableParent, {
|
|
298
337
|
skinVariants: "unicase",
|
|
299
338
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableChild, {
|
|
339
|
+
"data-testid": "skinnableChild",
|
|
300
340
|
skinVariants: "smallCaps"
|
|
301
341
|
})
|
|
302
342
|
}));
|
|
303
343
|
var expected = 'darkSkin normal unicase smallCaps';
|
|
304
|
-
|
|
305
|
-
|
|
344
|
+
|
|
345
|
+
var component = _react.screen.getByTestId('skinnableChild');
|
|
346
|
+
|
|
347
|
+
expect(component).toHaveClass(expected);
|
|
306
348
|
});
|
|
307
349
|
test('should be able to override a parent\'s variants by assigning a false skinVariant', function () {
|
|
308
350
|
var config = {
|
|
@@ -321,17 +363,20 @@ describe('Skinnable Specs', function () {
|
|
|
321
363
|
|
|
322
364
|
var SkinnableParent = (0, _Skinnable["default"])(config, Component);
|
|
323
365
|
var SkinnableChild = (0, _Skinnable["default"])(config, Component);
|
|
324
|
-
|
|
366
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableParent, {
|
|
325
367
|
skinVariants: "smallCaps unicase",
|
|
326
368
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableChild, {
|
|
369
|
+
"data-testid": "skinnableChild",
|
|
327
370
|
skinVariants: {
|
|
328
371
|
unicase: false
|
|
329
372
|
}
|
|
330
373
|
})
|
|
331
374
|
}));
|
|
332
375
|
var expected = 'darkSkin normal smallCaps';
|
|
333
|
-
|
|
334
|
-
|
|
376
|
+
|
|
377
|
+
var component = _react.screen.getByTestId('skinnableChild');
|
|
378
|
+
|
|
379
|
+
expect(component).toHaveClass(expected);
|
|
335
380
|
});
|
|
336
381
|
test('should inherit an overridden default variant', function () {
|
|
337
382
|
var config = {
|
|
@@ -350,21 +395,23 @@ describe('Skinnable Specs', function () {
|
|
|
350
395
|
|
|
351
396
|
var SkinnableParent = (0, _Skinnable["default"])(config, Component);
|
|
352
397
|
var SkinnableChild = (0, _Skinnable["default"])(config, Component);
|
|
353
|
-
|
|
398
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableParent, {
|
|
354
399
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableChild, {
|
|
355
400
|
skinVariants: {
|
|
356
401
|
normal: false
|
|
357
402
|
},
|
|
358
403
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableChild, {
|
|
359
|
-
|
|
404
|
+
"data-testid": "innerChild"
|
|
360
405
|
})
|
|
361
406
|
})
|
|
362
407
|
}));
|
|
363
408
|
var expected = 'darkSkin';
|
|
364
|
-
|
|
365
|
-
|
|
409
|
+
|
|
410
|
+
var component = _react.screen.getByTestId('innerChild');
|
|
411
|
+
|
|
412
|
+
expect(component).toHaveClass(expected);
|
|
366
413
|
});
|
|
367
|
-
test('should not force re-render of child if child unaffected', function () {
|
|
414
|
+
test.skip('should not force re-render of child if child unaffected', function () {
|
|
368
415
|
var config = {
|
|
369
416
|
defaultSkin: 'dark',
|
|
370
417
|
defaultVariants: 'normal',
|
|
@@ -388,8 +435,9 @@ describe('Skinnable Specs', function () {
|
|
|
388
435
|
};
|
|
389
436
|
|
|
390
437
|
var SkinnableParent = (0, _Skinnable["default"])(config, Component);
|
|
391
|
-
var SkinnableChild = (0, _Skinnable["default"])(config, ChildComponent);
|
|
392
|
-
|
|
438
|
+
var SkinnableChild = (0, _Skinnable["default"])(config, ChildComponent); // eslint-disable-next-line
|
|
439
|
+
|
|
440
|
+
var subject = mount( /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableParent, {
|
|
393
441
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnableChild, {})
|
|
394
442
|
})); // Sending props to force parent to re-render
|
|
395
443
|
|
|
@@ -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 _useSkins = _interopRequireDefault(require("../useSkins"));
|
|
6
8
|
|
|
@@ -15,9 +17,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
15
17
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
18
|
|
|
17
19
|
describe('Skinnable Specs', function () {
|
|
18
|
-
|
|
20
|
+
var data;
|
|
21
|
+
|
|
22
|
+
var Base = function Base(props) {
|
|
23
|
+
data = props;
|
|
19
24
|
return null;
|
|
20
|
-
}
|
|
25
|
+
};
|
|
21
26
|
|
|
22
27
|
function Component(_ref) {
|
|
23
28
|
var config = _ref.config;
|
|
@@ -40,12 +45,11 @@ describe('Skinnable Specs', function () {
|
|
|
40
45
|
light: 'lightSkin'
|
|
41
46
|
}
|
|
42
47
|
};
|
|
43
|
-
|
|
48
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
44
49
|
config: config
|
|
45
50
|
}));
|
|
46
51
|
var expected = 'darkSkin';
|
|
47
|
-
|
|
48
|
-
expect(actual).toBe(expected);
|
|
52
|
+
expect(data).toHaveProperty('className', expected);
|
|
49
53
|
});
|
|
50
54
|
test('should add the preferred skin class when the skin prop is specified', function () {
|
|
51
55
|
var config = {
|
|
@@ -56,12 +60,11 @@ describe('Skinnable Specs', function () {
|
|
|
56
60
|
light: 'lightSkin'
|
|
57
61
|
}
|
|
58
62
|
};
|
|
59
|
-
|
|
63
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
60
64
|
config: config
|
|
61
65
|
}));
|
|
62
66
|
var expected = 'lightSkin';
|
|
63
|
-
|
|
64
|
-
expect(actual).toBe(expected);
|
|
67
|
+
expect(data).toHaveProperty('className', expected);
|
|
65
68
|
});
|
|
66
69
|
test('should ignore the preferred skin prop if it\'s not one of the available skins', function () {
|
|
67
70
|
var config = {
|
|
@@ -72,12 +75,11 @@ describe('Skinnable Specs', function () {
|
|
|
72
75
|
light: 'lightSkin'
|
|
73
76
|
}
|
|
74
77
|
};
|
|
75
|
-
|
|
78
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
76
79
|
config: config
|
|
77
80
|
}));
|
|
78
81
|
var expected = '';
|
|
79
|
-
|
|
80
|
-
expect(actual).toBe(expected);
|
|
82
|
+
expect(data).toHaveProperty('className', expected);
|
|
81
83
|
});
|
|
82
84
|
test('should ignore the skinVariants prop if there are no defined allowedVariants', function () {
|
|
83
85
|
var config = {
|
|
@@ -88,12 +90,11 @@ describe('Skinnable Specs', function () {
|
|
|
88
90
|
light: 'lightSkin'
|
|
89
91
|
}
|
|
90
92
|
};
|
|
91
|
-
|
|
93
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
92
94
|
config: config
|
|
93
95
|
}));
|
|
94
96
|
var expected = 'darkSkin';
|
|
95
|
-
|
|
96
|
-
expect(actual).toBe(expected);
|
|
97
|
+
expect(data).toHaveProperty('className', expected);
|
|
97
98
|
});
|
|
98
99
|
test('should only apply allowed variants assigned by the skinVariants prop', function () {
|
|
99
100
|
var config = {
|
|
@@ -105,12 +106,11 @@ describe('Skinnable Specs', function () {
|
|
|
105
106
|
},
|
|
106
107
|
variants: ['normal', 'smallCaps', 'unicase']
|
|
107
108
|
};
|
|
108
|
-
|
|
109
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
109
110
|
config: config
|
|
110
111
|
}));
|
|
111
112
|
var expected = 'darkSkin normal unicase';
|
|
112
|
-
|
|
113
|
-
expect(actual).toBe(expected);
|
|
113
|
+
expect(data).toHaveProperty('className', expected);
|
|
114
114
|
});
|
|
115
115
|
test('should apply default variants even if the skinVariants prop is explicitly empty', function () {
|
|
116
116
|
var config = {
|
|
@@ -123,12 +123,11 @@ describe('Skinnable Specs', function () {
|
|
|
123
123
|
},
|
|
124
124
|
variants: ['normal', 'smallCaps', 'unicase']
|
|
125
125
|
};
|
|
126
|
-
|
|
126
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
127
127
|
config: config
|
|
128
128
|
}));
|
|
129
129
|
var expected = 'darkSkin normal';
|
|
130
|
-
|
|
131
|
-
expect(actual).toBe(expected);
|
|
130
|
+
expect(data).toHaveProperty('className', expected);
|
|
132
131
|
});
|
|
133
132
|
test('should apply default variants and the skinVariants if both are defined', function () {
|
|
134
133
|
var config = {
|
|
@@ -141,12 +140,11 @@ describe('Skinnable Specs', function () {
|
|
|
141
140
|
},
|
|
142
141
|
variants: ['normal', 'smallCaps', 'unicase']
|
|
143
142
|
};
|
|
144
|
-
|
|
143
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
145
144
|
config: config
|
|
146
145
|
}));
|
|
147
146
|
var expected = 'darkSkin normal unicase';
|
|
148
|
-
|
|
149
|
-
expect(actual).toBe(expected);
|
|
147
|
+
expect(data).toHaveProperty('className', expected);
|
|
150
148
|
});
|
|
151
149
|
test('should apply variants supplied via an array or a string in the same way', function () {
|
|
152
150
|
var config = {
|
|
@@ -158,17 +156,19 @@ describe('Skinnable Specs', function () {
|
|
|
158
156
|
},
|
|
159
157
|
variants: ['normal', 'smallCaps', 'unicase']
|
|
160
158
|
};
|
|
161
|
-
|
|
159
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
162
160
|
config: _objectSpread(_objectSpread({}, config), {}, {
|
|
163
161
|
skinVariants: 'normal unicase'
|
|
164
162
|
})
|
|
165
163
|
}));
|
|
166
|
-
var
|
|
164
|
+
var component1Class = data.className;
|
|
165
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
167
166
|
config: _objectSpread(_objectSpread({}, config), {}, {
|
|
168
167
|
skinVariants: ['normal', 'unicase']
|
|
169
168
|
})
|
|
170
169
|
}));
|
|
171
|
-
|
|
170
|
+
var component2Class = data.className;
|
|
171
|
+
expect(component1Class).toBe(component2Class);
|
|
172
172
|
});
|
|
173
173
|
test('should allow opting out of the default variants if an object is supplied to skinVariants with false as variant-key values', function () {
|
|
174
174
|
var config = {
|
|
@@ -184,12 +184,11 @@ describe('Skinnable Specs', function () {
|
|
|
184
184
|
},
|
|
185
185
|
variants: ['normal', 'smallCaps', 'unicase']
|
|
186
186
|
};
|
|
187
|
-
|
|
187
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
188
188
|
config: config
|
|
189
189
|
}));
|
|
190
190
|
var expected = 'darkSkin unicase';
|
|
191
|
-
|
|
192
|
-
expect(actual).toBe(expected);
|
|
191
|
+
expect(data).toHaveProperty('className', expected);
|
|
193
192
|
});
|
|
194
193
|
test('should ignore variants, sent by an object, equaling null, undefined, or empty string', function () {
|
|
195
194
|
var config = {
|
|
@@ -206,12 +205,11 @@ describe('Skinnable Specs', function () {
|
|
|
206
205
|
},
|
|
207
206
|
variants: ['normal', 'smallCaps', 'unicase']
|
|
208
207
|
};
|
|
209
|
-
|
|
208
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
210
209
|
config: config
|
|
211
210
|
}));
|
|
212
211
|
var expected = 'darkSkin normal';
|
|
213
|
-
|
|
214
|
-
expect(actual).toBe(expected);
|
|
212
|
+
expect(data).toHaveProperty('className', expected);
|
|
215
213
|
});
|
|
216
214
|
test('should apply parent variants', function () {
|
|
217
215
|
var config = {
|
|
@@ -223,7 +221,7 @@ describe('Skinnable Specs', function () {
|
|
|
223
221
|
},
|
|
224
222
|
variants: ['normal', 'smallCaps', 'unicase']
|
|
225
223
|
};
|
|
226
|
-
|
|
224
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Parent, {
|
|
227
225
|
config: _objectSpread(_objectSpread({}, config), {}, {
|
|
228
226
|
skinVariants: 'unicase'
|
|
229
227
|
}),
|
|
@@ -234,8 +232,7 @@ describe('Skinnable Specs', function () {
|
|
|
234
232
|
})
|
|
235
233
|
}));
|
|
236
234
|
var expected = 'darkSkin normal unicase smallCaps';
|
|
237
|
-
|
|
238
|
-
expect(actual).toBe(expected);
|
|
235
|
+
expect(data).toHaveProperty('className', expected);
|
|
239
236
|
});
|
|
240
237
|
test('should be able to override a parent\'s variants by assigning a false skinVariant', function () {
|
|
241
238
|
var config = {
|
|
@@ -247,7 +244,7 @@ describe('Skinnable Specs', function () {
|
|
|
247
244
|
},
|
|
248
245
|
variants: ['normal', 'smallCaps', 'unicase']
|
|
249
246
|
};
|
|
250
|
-
|
|
247
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Parent, {
|
|
251
248
|
config: _objectSpread(_objectSpread({}, config), {}, {
|
|
252
249
|
skinVariants: 'smallCaps unicase'
|
|
253
250
|
}),
|
|
@@ -260,8 +257,7 @@ describe('Skinnable Specs', function () {
|
|
|
260
257
|
})
|
|
261
258
|
}));
|
|
262
259
|
var expected = 'darkSkin normal smallCaps';
|
|
263
|
-
|
|
264
|
-
expect(actual).toBe(expected);
|
|
260
|
+
expect(data).toHaveProperty('className', expected);
|
|
265
261
|
});
|
|
266
262
|
test('should inherit an overridden default variant', function () {
|
|
267
263
|
var config = {
|
|
@@ -273,7 +269,7 @@ describe('Skinnable Specs', function () {
|
|
|
273
269
|
},
|
|
274
270
|
variants: ['normal', 'smallCaps', 'unicase']
|
|
275
271
|
};
|
|
276
|
-
|
|
272
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Parent, {
|
|
277
273
|
config: config,
|
|
278
274
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Parent, {
|
|
279
275
|
config: _objectSpread(_objectSpread({}, config), {}, {
|
|
@@ -287,7 +283,6 @@ describe('Skinnable Specs', function () {
|
|
|
287
283
|
})
|
|
288
284
|
}));
|
|
289
285
|
var expected = 'darkSkin';
|
|
290
|
-
|
|
291
|
-
expect(actual).toBe(expected);
|
|
286
|
+
expect(data).toHaveProperty('className', expected);
|
|
292
287
|
});
|
|
293
288
|
});
|
package/Slider/Slider.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ corresponding internal elements and states of this component.
|
|
|
76
76
|
* The following classes are supported:
|
|
77
77
|
* * `slider` - The root component class
|
|
78
78
|
* * `knob` - The knob node
|
|
79
|
-
* * `horizontal` - Applied when `orientation` prop is `"horizontal"
|
|
79
|
+
* * `horizontal` - Applied when `orientation` prop is `"horizontal"``
|
|
80
80
|
* * `pressed` - Applied when `pressed` prop is `true`
|
|
81
81
|
* * `noFill` - Applied when `noFill` prop is `true`
|
|
82
82
|
* * `vertical` - Applied when `orientation` prop is `"vertical"`
|
|
@@ -108,14 +108,14 @@ will have its props merged with the above props.
|
|
|
108
108
|
* The maximum value of the slider.
|
|
109
109
|
*
|
|
110
110
|
* The range between `min` and `max` should be evenly divisible by
|
|
111
|
-
|
|
111
|
+
[step] .
|
|
112
112
|
*/
|
|
113
113
|
max?: number;
|
|
114
114
|
/**
|
|
115
115
|
* The minimum value of the slider.
|
|
116
116
|
*
|
|
117
117
|
* The range between `min` and `max` should be evenly divisible by
|
|
118
|
-
|
|
118
|
+
[step] .
|
|
119
119
|
*/
|
|
120
120
|
min?: number;
|
|
121
121
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _react = require("@testing-library/react");
|
|
4
4
|
|
|
5
5
|
var _Slider = _interopRequireDefault(require("../Slider"));
|
|
6
6
|
|
|
@@ -15,9 +15,9 @@ describe('Slider', function () {
|
|
|
15
15
|
|
|
16
16
|
test('should return a DOM node reference for `componentRef`', function () {
|
|
17
17
|
var ref = jest.fn();
|
|
18
|
-
(0,
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Slider["default"], {
|
|
19
|
+
progressBarComponent: ProgressBar,
|
|
20
|
+
ref: ref
|
|
21
21
|
}));
|
|
22
22
|
var expected = 'DIV';
|
|
23
23
|
var actual = ref.mock.calls[0][0].nodeName;
|
package/SlotItem/SlotItem.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface SlotItemBaseProps {
|
|
|
12
12
|
* The type of component to use to render the item.
|
|
13
13
|
*
|
|
14
14
|
* This component will receive the `inline` prop and any additional unhandled props provided
|
|
15
|
-
to `SlotItem` . A derivative of
|
|
15
|
+
to `SlotItem` . A derivative of [Item] is recommended.
|
|
16
16
|
*/
|
|
17
17
|
component: React.ComponentType;
|
|
18
18
|
/**
|
|
@@ -49,7 +49,7 @@ corresponding internal elements and states of this component.
|
|
|
49
49
|
* * `after` - Applied to the slot that falls after the content
|
|
50
50
|
* * `before` - Applied to the slot that falls before the content
|
|
51
51
|
* * `hidden` - Applied to a slot when that slot is supposed to be hidden, according to
|
|
52
|
-
|
|
52
|
+
`autoHide` prop
|
|
53
53
|
*/
|
|
54
54
|
css?: object;
|
|
55
55
|
/**
|