@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.
Files changed (89) hide show
  1. package/AnnounceDecorator/tests/Announce-specs.js +13 -5
  2. package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +9 -7
  3. package/AnnounceDecorator/tests/useAnnounce-specs.js +25 -17
  4. package/BodyText/BodyText.d.ts +1 -1
  5. package/BodyText/tests/BodyText-specs.js +49 -35
  6. package/Button/Button.d.ts +6 -6
  7. package/Button/tests/Button-specs.js +104 -3
  8. package/CHANGELOG.md +15 -0
  9. package/Cancelable/Cancelable.js +1 -1
  10. package/Cancelable/tests/Cancelable-specs.js +131 -70
  11. package/Changeable/tests/Changeable-specs.js +162 -110
  12. package/FloatingLayer/FloatingLayer.js +5 -17
  13. package/FloatingLayer/tests/FloatingLayer-specs.js +83 -8
  14. package/FloatingLayer/tests/Scrim-specs.js +20 -11
  15. package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +15 -9
  16. package/GridListImageItem/GridListImageItem.d.ts +1 -1
  17. package/Group/Group.d.ts +2 -2
  18. package/Group/tests/Group-specs.js +71 -41
  19. package/Heading/Heading.d.ts +2 -1
  20. package/Heading/tests/Heading-specs.js +27 -20
  21. package/Icon/Icon.d.ts +4 -4
  22. package/Icon/tests/Icon-specs.js +52 -31
  23. package/IconButton/IconButton.d.ts +4 -4
  24. package/IconButton/tests/IconButton-specs.js +2 -2
  25. package/Image/tests/Image-specs.js +39 -29
  26. package/ImageItem/tests/ImageItem-specs.js +71 -68
  27. package/Item/tests/Item-specs.js +59 -35
  28. package/LabeledIcon/LabeledIcon.d.ts +4 -4
  29. package/LabeledIcon/tests/LabeledIcon-specs.js +30 -19
  30. package/Layout/Layout.d.ts +16 -16
  31. package/Layout/tests/Layout-specs.js +37 -25
  32. package/Marquee/MarqueeBase.js +1 -5
  33. package/Marquee/tests/Marquee-specs.js +221 -116
  34. package/Media/Media.js +1 -3
  35. package/ProgressBar/tests/ProgressBar-specs.js +60 -42
  36. package/README.md +1 -1
  37. package/RadioDecorator/RadioDecorator.js +3 -5
  38. package/RadioDecorator/tests/RadioDecorator-specs.js +179 -65
  39. package/Repeater/Repeater.d.ts +2 -1
  40. package/Repeater/tests/Repeater-specs.js +86 -45
  41. package/Routable/Routable.d.ts +2 -2
  42. package/Routable/tests/Routable-specs.js +26 -17
  43. package/Routable/tests/Router-specs.js +65 -41
  44. package/Scrollable/Scrollable.js +2 -1
  45. package/Scrollable/ScrollableNative.js +2 -1
  46. package/Scroller/Scroller.d.ts +2 -2
  47. package/Scroller/ScrollerBasic.js +1 -1
  48. package/Scroller/UiScrollerBase.js +1 -1
  49. package/Skinnable/tests/Skinnable-specs.js +102 -54
  50. package/Skinnable/tests/useSkins-specs.js +37 -42
  51. package/Slider/Slider.d.ts +3 -3
  52. package/Slider/tests/Slider-specs.js +4 -4
  53. package/SlotItem/SlotItem.d.ts +2 -2
  54. package/SlotItem/tests/SlotItem-specs.js +4 -4
  55. package/Slottable/tests/Slottable-specs.js +67 -36
  56. package/Slottable/tests/useSlots-specs.js +68 -35
  57. package/Spinner/Spinner.d.ts +1 -1
  58. package/Spinner/tests/Spinner-specs.js +46 -31
  59. package/ToggleIcon/tests/ToggleIcon-specs.js +32 -20
  60. package/ToggleItem/ToggleItem.d.ts +13 -11
  61. package/ToggleItem/tests/ToggleItem-specs.js +51 -34
  62. package/Toggleable/Toggle.js +6 -6
  63. package/Toggleable/Toggleable.js +6 -12
  64. package/Toggleable/tests/Toggleable-specs.js +428 -324
  65. package/Touchable/Drag.js +13 -17
  66. package/Touchable/Flick.js +20 -16
  67. package/Touchable/Hold.js +14 -19
  68. package/Touchable/Touchable.d.ts +3 -3
  69. package/Touchable/tests/Touchable-specs.js +223 -109
  70. package/Touchable/tests/useTouch-specs.js +159 -84
  71. package/Transition/Transition.d.ts +29 -27
  72. package/Transition/Transition.js +5 -9
  73. package/Transition/tests/Transition-specs.js +135 -31
  74. package/ViewManager/TransitionGroup.js +6 -5
  75. package/ViewManager/View.js +1 -1
  76. package/ViewManager/ViewManager.d.ts +4 -4
  77. package/ViewManager/ViewManager.js +10 -10
  78. package/ViewManager/tests/View-specs.js +109 -81
  79. package/ViewManager/tests/ViewManager-specs.js +471 -185
  80. package/VirtualList/UiVirtualListBase.js +1 -1
  81. package/VirtualList/VirtualList.d.ts +11 -9
  82. package/VirtualList/VirtualListBasic.js +1 -1
  83. package/VirtualList/tests/VirtualList-specs.js +44 -31
  84. package/internal/IdProvider/tests/useId-specs.js +35 -18
  85. package/package.json +11 -11
  86. package/resolution/tests/ResolutionDecorator-specs.js +17 -8
  87. package/styles/mixins.less +14 -2
  88. package/useControlledState/tests/useControlledState-specs.js +67 -42
  89. package/useScroll/useScroll.js +2 -2
@@ -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 Node that should be positioned in this `Cell` .
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 size property
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 shrink , the size will be
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
- relative unit based on the rules of
61
- resolution independence .
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
- Layout , without applied.
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 Cells vertically in the case of a horizontal
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 Cell components are supported as children.
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 Cells are
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 Cells to be
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
- orientation property for laying-out its contents
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
- Layout .
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 Cells to be
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
- orientation property for laying-out its contents
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
- Cells vertically.
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
- Cells horizontally.
235
+ [Cells] horizontally.
236
236
  * ```
237
237
  ┌─┬─┬─┬─┐
238
238
  │ │ │ │ │
@@ -1,15 +1,13 @@
1
1
  "use strict";
2
2
 
3
- var _enzyme = require("enzyme");
3
+ require("@testing-library/jest-dom");
4
4
 
5
- var _Layout = _interopRequireWildcard(require("../Layout"));
5
+ var _react = require("@testing-library/react");
6
6
 
7
- var _LayoutModule = _interopRequireDefault(require("../Layout.module.css"));
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
- var wrapped = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout["default"], {
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
- var actual = wrapped.find(".".concat(_LayoutModule["default"].layout)).prop('style').alignItems;
51
- expect(actual).toContain(expected);
51
+ expect(layout).toHaveStyle({
52
+ 'align-items': expected
53
+ });
52
54
  });
53
55
  });
54
56
  test('should apply a class for inline', function () {
55
- var wrapped = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout["default"], {
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
- var expected = true;
62
- var actual = wrapped.find(".".concat(_LayoutModule["default"].layout)).hasClass(_LayoutModule["default"].inline);
63
- expect(actual).toBe(expected);
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
- var wrapped = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout["default"], _objectSpread(_objectSpread({}, propValue), {}, {
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
- var expected = true;
82
- var actual = wrapped.find(".".concat(_LayoutModule["default"].layout)).hasClass(_LayoutModule["default"][value]);
83
- expect(actual).toBe(expected);
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
- var wrapped = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, _objectSpread(_objectSpread({}, props), {}, {
99
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, _objectSpread(_objectSpread({}, props), {}, {
94
100
  children: "Body"
95
101
  })));
96
- var expected = true;
97
- var actual = wrapped.find(".".concat(_LayoutModule["default"].cell)).hasClass(_LayoutModule["default"][prop]);
98
- expect(actual).toBe(expected);
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
- var wrapped = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout["default"], {
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
- var actual = wrapped.find(".".concat(_LayoutModule["default"].cell)).prop('style').flexBasis;
118
- expect(actual).toContain(expected);
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, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout["default"], {
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, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, {
145
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, {
134
146
  ref: ref
135
147
  }));
136
148
  var expected = 'DIV';
@@ -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, function (ev, props) {
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) {