@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
package/Layout/Layout.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ horizontally in the case of a vertical layout. `"start"` , `"center"` and
|
|
|
19
19
|
*/
|
|
20
20
|
align?: string;
|
|
21
21
|
/**
|
|
22
|
-
* Any valid
|
|
22
|
+
* Any valid [Node] that should be positioned in this `Cell` .
|
|
23
23
|
*/
|
|
24
24
|
children?: Any;
|
|
25
25
|
/**
|
|
@@ -40,14 +40,14 @@ as `componentRef` .
|
|
|
40
40
|
* A `shrink` able cell will contract to its minimum size, according to the dimensions of its
|
|
41
41
|
contents. This is used when you want the size of this Cell's content to influence the
|
|
42
42
|
dimensions of this cell. `shrink` will not allow the contents of the Layout to be pushed
|
|
43
|
-
beyond its boundaries (overflowing). See the
|
|
43
|
+
beyond its boundaries (overflowing). See the [size] property
|
|
44
44
|
for more details.
|
|
45
45
|
*/
|
|
46
46
|
shrink?: boolean;
|
|
47
47
|
/**
|
|
48
48
|
* Sets the desired size of the Cell using any valid CSS measurement value.
|
|
49
49
|
*
|
|
50
|
-
* When used in conjunction with
|
|
50
|
+
* When used in conjunction with [shrink] , the size will be
|
|
51
51
|
the maximum size, shrinking as necessary, to fit the content.
|
|
52
52
|
*
|
|
53
53
|
* E.g.
|
|
@@ -57,14 +57,14 @@ and will match your contents size if it's smaller
|
|
|
57
57
|
*
|
|
58
58
|
* This accepts any valid CSS measurement value string. If a numeric value is used, it will
|
|
59
59
|
be treated as a pixel value and converted to a
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
[relative unit] based on the rules of
|
|
61
|
+
[resolution independence] .
|
|
62
62
|
*/
|
|
63
63
|
size?: string | number;
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
* A stateless component that provides a space for your content in a
|
|
67
|
-
|
|
67
|
+
[Layout] , without applied.
|
|
68
68
|
*/
|
|
69
69
|
|
|
70
70
|
export class CellBase extends React.Component<
|
|
@@ -80,7 +80,7 @@ export interface LayoutBaseProps {
|
|
|
80
80
|
/**
|
|
81
81
|
* The alignment of children.
|
|
82
82
|
*
|
|
83
|
-
* Aligns the children
|
|
83
|
+
* Aligns the children [Cells] vertically in the case of a horizontal
|
|
84
84
|
layout or horizontally in the case of a vertical layout. `"start"` , `"center"` and
|
|
85
85
|
`"end"` are the most commonly used, although all values of `align-items` are supported.
|
|
86
86
|
`"start"` refers to the top in a horizontal layout, and left in a vertical LTR layout
|
|
@@ -93,7 +93,7 @@ separated by a space.
|
|
|
93
93
|
*/
|
|
94
94
|
align?: string;
|
|
95
95
|
/**
|
|
96
|
-
* Only
|
|
96
|
+
* Only [Cell] components are supported as children.
|
|
97
97
|
*/
|
|
98
98
|
children?: Cell | Cell[];
|
|
99
99
|
/**
|
|
@@ -114,7 +114,7 @@ instead of carving out the entire horizontal space for itself.
|
|
|
114
114
|
*/
|
|
115
115
|
inline?: boolean;
|
|
116
116
|
/**
|
|
117
|
-
* The orientation of the `Layout` , i.e. how the children
|
|
117
|
+
* The orientation of the `Layout` , i.e. how the children [Cells] are
|
|
118
118
|
positioned on the screen. Must be either `'horizontal'` or `'vertical'` .
|
|
119
119
|
*/
|
|
120
120
|
orientation?: string;
|
|
@@ -132,9 +132,9 @@ additional lines are placed above/before the preceding line instead of below/aft
|
|
|
132
132
|
/**
|
|
133
133
|
* A container for `Cell` s.
|
|
134
134
|
*
|
|
135
|
-
* A stateless component that acts as a containing area for
|
|
135
|
+
* A stateless component that acts as a containing area for [Cells] to be
|
|
136
136
|
positioned in a row or a column (horizontally or vertically, respectively. It supports an
|
|
137
|
-
|
|
137
|
+
[orientation] property for laying-out its contents
|
|
138
138
|
( `Cells` ) in an organized, readable way.
|
|
139
139
|
*
|
|
140
140
|
* Example:
|
|
@@ -163,7 +163,7 @@ export interface CellProps
|
|
|
163
163
|
extends Omit<Merge<CellBaseProps, CellDecoratorProps>, "componentRef"> {}
|
|
164
164
|
/**
|
|
165
165
|
* A stateless component that provides a space for your content in a
|
|
166
|
-
|
|
166
|
+
[Layout] .
|
|
167
167
|
*/
|
|
168
168
|
|
|
169
169
|
export class Cell extends React.Component<
|
|
@@ -183,9 +183,9 @@ export interface LayoutProps
|
|
|
183
183
|
/**
|
|
184
184
|
* A container for `Cell` s.
|
|
185
185
|
*
|
|
186
|
-
* A stateless component that acts as a containing area for
|
|
186
|
+
* A stateless component that acts as a containing area for [Cells] to be
|
|
187
187
|
positioned in a row or a column (horizontally or vertically, respectively. It supports an
|
|
188
|
-
|
|
188
|
+
[orientation] property for laying-out its contents
|
|
189
189
|
( `Cells` ) in an organized, readable way.
|
|
190
190
|
*
|
|
191
191
|
* Example:
|
|
@@ -214,7 +214,7 @@ export interface ColumnProps
|
|
|
214
214
|
extends Merge<LayoutProps, ui_ForwardRef_ForwardRefProps> {}
|
|
215
215
|
/**
|
|
216
216
|
* Shorthand for `<Layout orientation="vertical">` , which positions its
|
|
217
|
-
|
|
217
|
+
[Cells] vertically.
|
|
218
218
|
* ```
|
|
219
219
|
┌────┐
|
|
220
220
|
├────┤
|
|
@@ -232,7 +232,7 @@ export interface RowProps
|
|
|
232
232
|
extends Merge<LayoutProps, ui_ForwardRef_ForwardRefProps> {}
|
|
233
233
|
/**
|
|
234
234
|
* Shorthand for `<Layout orientation="horizontal">` , which positions its
|
|
235
|
-
|
|
235
|
+
[Cells] horizontally.
|
|
236
236
|
* ```
|
|
237
237
|
┌─┬─┬─┬─┐
|
|
238
238
|
│ │ │ │ │
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
require("@testing-library/jest-dom");
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _react = require("@testing-library/react");
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _Layout = _interopRequireWildcard(require("../Layout"));
|
|
8
8
|
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
10
|
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
-
|
|
13
11
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
14
12
|
|
|
15
13
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -40,27 +38,33 @@ describe('Layout Specs', function () {
|
|
|
40
38
|
resolved = _ref2[1];
|
|
41
39
|
|
|
42
40
|
test("should apply '".concat(resolved, "' style value given an align prop value of \"").concat(value, "\""), function () {
|
|
43
|
-
|
|
41
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout["default"], {
|
|
44
42
|
align: value,
|
|
45
43
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, {
|
|
46
44
|
children: "Body"
|
|
47
45
|
})
|
|
48
46
|
}));
|
|
47
|
+
|
|
48
|
+
var layout = _react.screen.getByText('Body').parentElement;
|
|
49
|
+
|
|
49
50
|
var expected = resolved;
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
expect(layout).toHaveStyle({
|
|
52
|
+
'align-items': expected
|
|
53
|
+
});
|
|
52
54
|
});
|
|
53
55
|
});
|
|
54
56
|
test('should apply a class for inline', function () {
|
|
55
|
-
|
|
57
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout["default"], {
|
|
56
58
|
inline: true,
|
|
57
59
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, {
|
|
58
60
|
children: "Body"
|
|
59
61
|
})
|
|
60
62
|
}));
|
|
61
|
-
|
|
62
|
-
var
|
|
63
|
-
|
|
63
|
+
|
|
64
|
+
var layout = _react.screen.getByText('Body').parentElement;
|
|
65
|
+
|
|
66
|
+
var expected = 'inline';
|
|
67
|
+
expect(layout).toHaveClass(expected);
|
|
64
68
|
}); // Tests for prop and className combinations
|
|
65
69
|
|
|
66
70
|
var propStyleCombination = [['orientation', ['horizontal', 'vertical']]];
|
|
@@ -73,14 +77,16 @@ describe('Layout Specs', function () {
|
|
|
73
77
|
test("should apply classes for ".concat(prop), function () {
|
|
74
78
|
var propValue = _defineProperty({}, prop, value);
|
|
75
79
|
|
|
76
|
-
|
|
80
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout["default"], _objectSpread(_objectSpread({}, propValue), {}, {
|
|
77
81
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, {
|
|
78
82
|
children: "Body"
|
|
79
83
|
})
|
|
80
84
|
})));
|
|
81
|
-
|
|
82
|
-
var
|
|
83
|
-
|
|
85
|
+
|
|
86
|
+
var layout = _react.screen.getByText('Body').parentElement;
|
|
87
|
+
|
|
88
|
+
var expected = value;
|
|
89
|
+
expect(layout).toHaveClass(expected);
|
|
84
90
|
});
|
|
85
91
|
});
|
|
86
92
|
}); // Test for boolean classes
|
|
@@ -90,12 +96,14 @@ describe('Layout Specs', function () {
|
|
|
90
96
|
test("should apply a class for ".concat(prop), function () {
|
|
91
97
|
var props = _defineProperty({}, prop, true);
|
|
92
98
|
|
|
93
|
-
|
|
99
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, _objectSpread(_objectSpread({}, props), {}, {
|
|
94
100
|
children: "Body"
|
|
95
101
|
})));
|
|
96
|
-
|
|
97
|
-
var
|
|
98
|
-
|
|
102
|
+
|
|
103
|
+
var layout = _react.screen.getByText('Body');
|
|
104
|
+
|
|
105
|
+
var expected = prop;
|
|
106
|
+
expect(layout).toHaveClass(expected);
|
|
99
107
|
});
|
|
100
108
|
});
|
|
101
109
|
var cellPropSize = [['size', ['100px', '50%', '5em']]];
|
|
@@ -108,20 +116,24 @@ describe('Layout Specs', function () {
|
|
|
108
116
|
test("should apply flexBasis styles the size prop value ".concat(value), function () {
|
|
109
117
|
var propValue = _defineProperty({}, prop, value);
|
|
110
118
|
|
|
111
|
-
|
|
119
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout["default"], {
|
|
112
120
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, _objectSpread(_objectSpread({}, propValue), {}, {
|
|
113
121
|
children: "Body"
|
|
114
122
|
}))
|
|
115
123
|
}));
|
|
124
|
+
|
|
125
|
+
var layoutCell = _react.screen.getByText('Body');
|
|
126
|
+
|
|
116
127
|
var expected = value;
|
|
117
|
-
|
|
118
|
-
|
|
128
|
+
expect(layoutCell).toHaveStyle({
|
|
129
|
+
'flex-basis': expected
|
|
130
|
+
});
|
|
119
131
|
});
|
|
120
132
|
});
|
|
121
133
|
});
|
|
122
134
|
test('should return a DOM node reference for `componentRef` on `Layout`', function () {
|
|
123
135
|
var ref = jest.fn();
|
|
124
|
-
(0,
|
|
136
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout["default"], {
|
|
125
137
|
ref: ref
|
|
126
138
|
}));
|
|
127
139
|
var expected = 'DIV';
|
|
@@ -130,7 +142,7 @@ describe('Layout Specs', function () {
|
|
|
130
142
|
});
|
|
131
143
|
test('should return a DOM node reference for `componentRef` on `Cell`', function () {
|
|
132
144
|
var ref = jest.fn();
|
|
133
|
-
(0,
|
|
145
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, {
|
|
134
146
|
ref: ref
|
|
135
147
|
}));
|
|
136
148
|
var expected = 'DIV';
|
package/Marquee/MarqueeBase.js
CHANGED
|
@@ -213,11 +213,7 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
213
213
|
root: root
|
|
214
214
|
}).observe(node);
|
|
215
215
|
},
|
|
216
|
-
onMarqueeComplete: (0, _handle.handle)((0, _handle.forProp)('animating', true), isEventSource, _handle.stop,
|
|
217
|
-
return (0, _handle.forward)('onMarqueeComplete', {
|
|
218
|
-
type: 'onMarqueeComplete'
|
|
219
|
-
}, props);
|
|
220
|
-
})
|
|
216
|
+
onMarqueeComplete: (0, _handle.handle)((0, _handle.forProp)('animating', true), isEventSource, _handle.stop, (0, _handle.forwardCustom)('onMarqueeComplete'))
|
|
221
217
|
},
|
|
222
218
|
computed: {
|
|
223
219
|
'aria-label': function ariaLabel(_ref2) {
|