@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,18 +1,15 @@
|
|
|
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 _index = require("../index.js");
|
|
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
|
var ltrText = 'This is some fine latin text.',
|
|
14
|
-
rtlText = 'العربية - العراق'
|
|
15
|
-
contentSelector = ".".concat(_MarqueeModule["default"].text);
|
|
12
|
+
rtlText = 'العربية - العراق';
|
|
16
13
|
describe('Marquee', function () {
|
|
17
14
|
beforeEach(function () {
|
|
18
15
|
global.Element.prototype.getBoundingClientRect = jest.fn(function () {
|
|
@@ -27,116 +24,165 @@ describe('Marquee', function () {
|
|
|
27
24
|
});
|
|
28
25
|
});
|
|
29
26
|
test('should determine the correct directionality of latin text on initial render', function () {
|
|
30
|
-
|
|
27
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Marquee, {
|
|
31
28
|
children: ltrText
|
|
32
29
|
}));
|
|
30
|
+
|
|
31
|
+
var marquee = _react.screen.getByText(ltrText);
|
|
32
|
+
|
|
33
33
|
var expected = 'ltr';
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
expect(marquee).toHaveStyle({
|
|
35
|
+
'direction': expected
|
|
36
|
+
});
|
|
36
37
|
});
|
|
37
38
|
test('should determine the correct directionality of non-latin text on initial render', function () {
|
|
38
|
-
|
|
39
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Marquee, {
|
|
39
40
|
children: rtlText
|
|
40
41
|
}));
|
|
42
|
+
|
|
43
|
+
var marquee = _react.screen.getByText(rtlText);
|
|
44
|
+
|
|
41
45
|
var expected = 'rtl';
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
expect(marquee).toHaveStyle({
|
|
47
|
+
'direction': expected
|
|
48
|
+
});
|
|
44
49
|
});
|
|
45
50
|
test('should force the directionality text if forceDirection is specified', function () {
|
|
46
|
-
|
|
51
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Marquee, {
|
|
47
52
|
forceDirection: "ltr",
|
|
48
53
|
children: rtlText
|
|
49
54
|
}));
|
|
55
|
+
|
|
56
|
+
var marquee = _react.screen.getByText(rtlText);
|
|
57
|
+
|
|
50
58
|
var expected = 'ltr';
|
|
51
|
-
|
|
52
|
-
|
|
59
|
+
expect(marquee).toHaveStyle({
|
|
60
|
+
'direction': expected
|
|
61
|
+
});
|
|
53
62
|
});
|
|
54
63
|
test('should switch directionality when the text content changes after initial render', function () {
|
|
55
|
-
var
|
|
64
|
+
var _render = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Marquee, {
|
|
56
65
|
children: ltrText
|
|
57
|
-
}))
|
|
58
|
-
|
|
66
|
+
})),
|
|
67
|
+
rerender = _render.rerender;
|
|
68
|
+
|
|
69
|
+
var marquee = _react.screen.getByText(ltrText);
|
|
70
|
+
|
|
71
|
+
rerender( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Marquee, {
|
|
59
72
|
children: rtlText
|
|
60
|
-
});
|
|
61
|
-
subject.update();
|
|
73
|
+
}));
|
|
62
74
|
var expected = 'rtl';
|
|
63
|
-
|
|
64
|
-
|
|
75
|
+
expect(marquee).toHaveStyle({
|
|
76
|
+
'direction': expected
|
|
77
|
+
});
|
|
65
78
|
});
|
|
66
79
|
test('should not switch directionality when the text content changes after initial render and the forceDirection property was already set', function () {
|
|
67
|
-
var
|
|
80
|
+
var _render2 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Marquee, {
|
|
68
81
|
forceDirection: "ltr",
|
|
69
82
|
children: ltrText
|
|
70
|
-
}))
|
|
71
|
-
|
|
83
|
+
})),
|
|
84
|
+
rerender = _render2.rerender;
|
|
85
|
+
|
|
86
|
+
var marquee = _react.screen.getByText(ltrText);
|
|
87
|
+
|
|
88
|
+
rerender( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Marquee, {
|
|
89
|
+
forceDirection: "ltr",
|
|
72
90
|
children: rtlText
|
|
73
|
-
});
|
|
74
|
-
subject.update();
|
|
91
|
+
}));
|
|
75
92
|
var expected = 'ltr';
|
|
76
|
-
|
|
77
|
-
|
|
93
|
+
expect(marquee).toHaveStyle({
|
|
94
|
+
'direction': expected
|
|
95
|
+
});
|
|
78
96
|
});
|
|
79
97
|
test('should override direction to RTL when forceDirection is set and locale is LTR', function () {
|
|
80
|
-
|
|
98
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Marquee, {
|
|
99
|
+
"data-testid": "marquee",
|
|
81
100
|
forceDirection: "rtl",
|
|
82
101
|
locale: "ltr"
|
|
83
102
|
}));
|
|
103
|
+
|
|
104
|
+
var marquee = _react.screen.getByTestId('marquee').children.item(0).children.item(0);
|
|
105
|
+
|
|
84
106
|
var expected = 'rtl';
|
|
85
|
-
|
|
86
|
-
|
|
107
|
+
expect(marquee).toHaveStyle({
|
|
108
|
+
'direction': expected
|
|
109
|
+
});
|
|
87
110
|
});
|
|
88
111
|
test('should override direction to LTR when forceDirection is set and locale is RTL', function () {
|
|
89
|
-
|
|
112
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Marquee, {
|
|
113
|
+
"data-testid": "marquee",
|
|
90
114
|
forceDirection: "ltr",
|
|
91
115
|
locale: "rtl"
|
|
92
116
|
}));
|
|
117
|
+
|
|
118
|
+
var marquee = _react.screen.getByTestId('marquee').children.item(0).children.item(0);
|
|
119
|
+
|
|
93
120
|
var expected = 'ltr';
|
|
94
|
-
|
|
95
|
-
|
|
121
|
+
expect(marquee).toHaveStyle({
|
|
122
|
+
'direction': expected
|
|
123
|
+
});
|
|
96
124
|
});
|
|
97
125
|
test('should have direction of RTL when forceDirection is RTL and locale is RTL', function () {
|
|
98
|
-
|
|
126
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Marquee, {
|
|
127
|
+
"data-testid": "marquee",
|
|
99
128
|
forceDirection: "rtl",
|
|
100
129
|
locale: "rtl"
|
|
101
130
|
}));
|
|
131
|
+
|
|
132
|
+
var marquee = _react.screen.getByTestId('marquee').children.item(0).children.item(0);
|
|
133
|
+
|
|
102
134
|
var expected = 'rtl';
|
|
103
|
-
|
|
104
|
-
|
|
135
|
+
expect(marquee).toHaveStyle({
|
|
136
|
+
'direction': expected
|
|
137
|
+
});
|
|
105
138
|
});
|
|
106
139
|
test('should have direction of LTR when forceDirection is LTR and locale is LTR', function () {
|
|
107
|
-
|
|
140
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Marquee, {
|
|
141
|
+
"data-testid": "marquee",
|
|
108
142
|
forceDirection: "ltr",
|
|
109
143
|
locale: "ltr"
|
|
110
144
|
}));
|
|
145
|
+
|
|
146
|
+
var marquee = _react.screen.getByTestId('marquee').children.item(0).children.item(0);
|
|
147
|
+
|
|
111
148
|
var expected = 'ltr';
|
|
112
|
-
|
|
113
|
-
|
|
149
|
+
expect(marquee).toHaveStyle({
|
|
150
|
+
'direction': expected
|
|
151
|
+
});
|
|
114
152
|
});
|
|
115
153
|
test('should convert percentage values of marqueeSpacing to absolute values', function (done) {
|
|
116
|
-
|
|
117
|
-
|
|
154
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Marquee, {
|
|
155
|
+
"data-testid": "marquee",
|
|
118
156
|
marqueeOn: "render",
|
|
119
|
-
marqueeOnRenderDelay: 10
|
|
157
|
+
marqueeOnRenderDelay: 10,
|
|
158
|
+
marqueeSpacing: "60%"
|
|
120
159
|
}));
|
|
121
160
|
setTimeout(function () {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
var
|
|
125
|
-
|
|
161
|
+
var expected = '60';
|
|
162
|
+
|
|
163
|
+
var marquee = _react.screen.getByTestId('marquee').children.item(0).children.item(0);
|
|
164
|
+
|
|
165
|
+
expect(marquee).toHaveStyle({
|
|
166
|
+
'--ui-marquee-spacing': expected
|
|
167
|
+
});
|
|
126
168
|
done();
|
|
127
169
|
}, 100);
|
|
128
170
|
});
|
|
129
171
|
test('should pass absolute values of marqueeSpacing', function (done) {
|
|
130
|
-
|
|
131
|
-
|
|
172
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Marquee, {
|
|
173
|
+
"data-testid": "marquee",
|
|
132
174
|
marqueeOn: "render",
|
|
133
|
-
marqueeOnRenderDelay: 10
|
|
175
|
+
marqueeOnRenderDelay: 10,
|
|
176
|
+
marqueeSpacing: 80
|
|
134
177
|
}));
|
|
135
178
|
setTimeout(function () {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
var
|
|
139
|
-
|
|
179
|
+
var expected = '80';
|
|
180
|
+
|
|
181
|
+
var marquee = _react.screen.getByTestId('marquee').children.item(0).children.item(0);
|
|
182
|
+
|
|
183
|
+
expect(marquee).toHaveStyle({
|
|
184
|
+
'--ui-marquee-spacing': expected
|
|
185
|
+
});
|
|
140
186
|
done();
|
|
141
187
|
}, 100);
|
|
142
188
|
});
|
|
@@ -144,150 +190,209 @@ describe('Marquee', function () {
|
|
|
144
190
|
describe('MarqueeBase', function () {
|
|
145
191
|
// Computed Property Tests
|
|
146
192
|
test('should not include the animate class when animating is false', function () {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
193
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.MarqueeBase, {
|
|
194
|
+
"data-testid": "marquee"
|
|
195
|
+
}));
|
|
196
|
+
|
|
197
|
+
var marquee = _react.screen.getByTestId('marquee').children.item(0);
|
|
198
|
+
|
|
199
|
+
var expected = 'animate';
|
|
200
|
+
expect(marquee).not.toHaveClass(expected);
|
|
151
201
|
});
|
|
152
202
|
test('should include the animate class when animating is true', function () {
|
|
153
|
-
|
|
154
|
-
animating: true
|
|
203
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.MarqueeBase, {
|
|
204
|
+
animating: true,
|
|
205
|
+
"data-testid": "marquee"
|
|
155
206
|
}));
|
|
156
|
-
|
|
157
|
-
var
|
|
158
|
-
|
|
207
|
+
|
|
208
|
+
var marquee = _react.screen.getByTestId('marquee').children.item(0);
|
|
209
|
+
|
|
210
|
+
var expected = 'animate';
|
|
211
|
+
expect(marquee).toHaveClass(expected);
|
|
159
212
|
});
|
|
160
213
|
test('should not transition when animating is false', function () {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
214
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.MarqueeBase, {
|
|
215
|
+
"data-testid": "marquee"
|
|
216
|
+
}));
|
|
217
|
+
|
|
218
|
+
var marquee = _react.screen.getByTestId('marquee').children.item(0);
|
|
219
|
+
|
|
220
|
+
expect(marquee).not.toHaveStyle({
|
|
221
|
+
'transition-duration': 'NaNs'
|
|
222
|
+
});
|
|
164
223
|
});
|
|
165
224
|
test('should transition when animating is true', function () {
|
|
166
|
-
|
|
167
|
-
animating: true
|
|
225
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.MarqueeBase, {
|
|
226
|
+
animating: true,
|
|
227
|
+
"data-testid": "marquee"
|
|
168
228
|
}));
|
|
169
|
-
|
|
170
|
-
|
|
229
|
+
|
|
230
|
+
var marquee = _react.screen.getByTestId('marquee').children.item(0);
|
|
231
|
+
|
|
232
|
+
expect(marquee).toHaveStyle({
|
|
233
|
+
'transition-duration': 'NaNs'
|
|
234
|
+
});
|
|
171
235
|
});
|
|
172
236
|
test('should set RTL direction in LTR context when the text directionality is RTL', function () {
|
|
173
|
-
|
|
237
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.MarqueeBase, {
|
|
238
|
+
"data-testid": "marquee",
|
|
174
239
|
rtl: true
|
|
175
240
|
}), {
|
|
176
241
|
context: {
|
|
177
242
|
rtl: false
|
|
178
243
|
}
|
|
179
244
|
});
|
|
245
|
+
|
|
246
|
+
var marquee = _react.screen.getByTestId('marquee').children.item(0);
|
|
247
|
+
|
|
180
248
|
var expected = 'rtl';
|
|
181
|
-
|
|
182
|
-
|
|
249
|
+
expect(marquee).toHaveStyle({
|
|
250
|
+
'direction': expected
|
|
251
|
+
});
|
|
183
252
|
});
|
|
184
253
|
test('should set LTR direction in RTL when the text directionality is LTR', function () {
|
|
185
|
-
|
|
254
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.MarqueeBase, {
|
|
255
|
+
"data-testid": "marquee"
|
|
256
|
+
}), {
|
|
186
257
|
context: {
|
|
187
258
|
rtl: true
|
|
188
259
|
}
|
|
189
260
|
});
|
|
261
|
+
|
|
262
|
+
var marquee = _react.screen.getByTestId('marquee').children.item(0);
|
|
263
|
+
|
|
190
264
|
var expected = 'ltr';
|
|
191
|
-
|
|
192
|
-
|
|
265
|
+
expect(marquee).toHaveStyle({
|
|
266
|
+
'direction': expected
|
|
267
|
+
});
|
|
193
268
|
});
|
|
194
269
|
test('should transition from the right with LTR text (a negative translate value)', function () {
|
|
195
|
-
|
|
270
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.MarqueeBase, {
|
|
196
271
|
animating: true,
|
|
272
|
+
"data-testid": "marquee",
|
|
197
273
|
distance: 100
|
|
198
274
|
}));
|
|
199
|
-
|
|
200
|
-
|
|
275
|
+
|
|
276
|
+
var marquee = _react.screen.getByTestId('marquee').children.item(0);
|
|
277
|
+
|
|
278
|
+
var expected = 'translateX(-100px)';
|
|
279
|
+
expect(marquee).toHaveStyle({
|
|
280
|
+
'transform': expected
|
|
281
|
+
});
|
|
201
282
|
});
|
|
202
283
|
test('should transition from the left with RTL text (a positive translate value)', function () {
|
|
203
|
-
|
|
284
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.MarqueeBase, {
|
|
204
285
|
animating: true,
|
|
286
|
+
"data-testid": "marquee",
|
|
205
287
|
distance: 100,
|
|
206
288
|
rtl: true
|
|
207
289
|
}));
|
|
208
|
-
|
|
209
|
-
|
|
290
|
+
|
|
291
|
+
var marquee = _react.screen.getByTestId('marquee').children.item(0);
|
|
292
|
+
|
|
293
|
+
var expected = 'translateX(100px)';
|
|
294
|
+
expect(marquee).toHaveStyle({
|
|
295
|
+
'transform': expected
|
|
296
|
+
});
|
|
210
297
|
});
|
|
211
298
|
test('should duplicate from content when promoted and a non-zero distance', function () {
|
|
212
|
-
|
|
213
|
-
willAnimate: true,
|
|
299
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.MarqueeBase, {
|
|
214
300
|
distance: 100,
|
|
301
|
+
willAnimate: true,
|
|
215
302
|
children: "Text"
|
|
216
303
|
}));
|
|
217
|
-
|
|
218
|
-
|
|
304
|
+
|
|
305
|
+
var marquee = _react.screen.getByText('TextText');
|
|
306
|
+
|
|
307
|
+
expect(marquee).toBeInTheDocument();
|
|
219
308
|
});
|
|
220
309
|
test('should not duplicate from content when promoted and a zero distance', function () {
|
|
221
|
-
|
|
222
|
-
willAnimate: true,
|
|
310
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.MarqueeBase, {
|
|
223
311
|
distance: 0,
|
|
312
|
+
willAnimate: true,
|
|
224
313
|
children: "Text"
|
|
225
314
|
}));
|
|
226
|
-
|
|
227
|
-
|
|
315
|
+
|
|
316
|
+
var marquee = _react.screen.getByText('Text');
|
|
317
|
+
|
|
318
|
+
expect(marquee).toBeInTheDocument();
|
|
228
319
|
});
|
|
229
320
|
test('should not duplicate from content when not promoted and a non-zero distance', function () {
|
|
230
|
-
|
|
321
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.MarqueeBase, {
|
|
231
322
|
distance: 100,
|
|
232
323
|
children: "Text"
|
|
233
324
|
}));
|
|
234
|
-
|
|
235
|
-
|
|
325
|
+
|
|
326
|
+
var marquee = _react.screen.getByText('Text');
|
|
327
|
+
|
|
328
|
+
expect(marquee).toBeInTheDocument();
|
|
236
329
|
});
|
|
237
330
|
test('should add aria-label with content when promoted and a non-zero distance', function () {
|
|
238
331
|
var text = 'Text';
|
|
239
|
-
|
|
240
|
-
|
|
332
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.MarqueeBase, {
|
|
333
|
+
"data-testid": "marquee",
|
|
241
334
|
distance: 100,
|
|
335
|
+
willAnimate: true,
|
|
242
336
|
children: text
|
|
243
337
|
}));
|
|
338
|
+
|
|
339
|
+
var marquee = _react.screen.getByTestId('marquee');
|
|
340
|
+
|
|
244
341
|
var expected = text;
|
|
245
|
-
|
|
246
|
-
expect(actual).toBe(expected);
|
|
342
|
+
expect(marquee).toHaveAttribute('aria-label', expected);
|
|
247
343
|
});
|
|
248
344
|
test('should not override aria-label with content when promoted and a non-zero distance', function () {
|
|
249
345
|
var aria = 'Custom';
|
|
250
|
-
|
|
251
|
-
willAnimate: true,
|
|
252
|
-
distance: 100,
|
|
346
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.MarqueeBase, {
|
|
253
347
|
"aria-label": aria,
|
|
348
|
+
"data-testid": "marquee",
|
|
349
|
+
distance: 100,
|
|
350
|
+
willAnimate: true,
|
|
254
351
|
children: "Text"
|
|
255
352
|
}));
|
|
353
|
+
|
|
354
|
+
var marquee = _react.screen.getByTestId('marquee');
|
|
355
|
+
|
|
256
356
|
var expected = aria;
|
|
257
|
-
|
|
258
|
-
expect(actual).toBe(expected);
|
|
357
|
+
expect(marquee).toHaveAttribute('aria-label', expected);
|
|
259
358
|
});
|
|
260
359
|
test('should concatenate string children when promoted and a non-zero distance', function () {
|
|
261
|
-
|
|
262
|
-
|
|
360
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_index.MarqueeBase, {
|
|
361
|
+
"data-testid": "marquee",
|
|
263
362
|
distance: 100,
|
|
363
|
+
willAnimate: true,
|
|
264
364
|
children: ["This is ", 'A', " test"]
|
|
265
365
|
}));
|
|
366
|
+
|
|
367
|
+
var marquee = _react.screen.getByTestId('marquee');
|
|
368
|
+
|
|
266
369
|
var expected = 'This is A test';
|
|
267
|
-
|
|
268
|
-
expect(actual).toBe(expected);
|
|
370
|
+
expect(marquee).toHaveAttribute('aria-label', expected);
|
|
269
371
|
});
|
|
270
372
|
test('should not concatenate non-string children when promoted and a non-zero distance', function () {
|
|
271
|
-
|
|
272
|
-
|
|
373
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_index.MarqueeBase, {
|
|
374
|
+
"data-testid": "marquee",
|
|
273
375
|
distance: 100,
|
|
376
|
+
willAnimate: true,
|
|
274
377
|
children: ["Test", /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
275
378
|
children: "Hello"
|
|
276
379
|
}), "World"]
|
|
277
380
|
}));
|
|
381
|
+
|
|
382
|
+
var marquee = _react.screen.getByTestId('marquee');
|
|
383
|
+
|
|
278
384
|
var expected = 'Test World';
|
|
279
|
-
|
|
280
|
-
expect(actual).toBe(expected);
|
|
385
|
+
expect(marquee).toHaveAttribute('aria-label', expected);
|
|
281
386
|
});
|
|
282
387
|
test('should not throw exception for null children when promoted and a non-zero distance - ENYO-6362', function () {
|
|
283
|
-
var
|
|
284
|
-
return (0,
|
|
285
|
-
willAnimate: true,
|
|
388
|
+
var renderSubject = function renderSubject() {
|
|
389
|
+
return (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.MarqueeBase, {
|
|
286
390
|
distance: 100,
|
|
391
|
+
willAnimate: true,
|
|
287
392
|
children: null
|
|
288
393
|
}));
|
|
289
394
|
};
|
|
290
395
|
|
|
291
|
-
expect(
|
|
396
|
+
expect(renderSubject).not.toThrow();
|
|
292
397
|
});
|
|
293
398
|
});
|
package/Media/Media.js
CHANGED
|
@@ -185,9 +185,7 @@ var Media = /*#__PURE__*/function (_ReactComponent) {
|
|
|
185
185
|
};
|
|
186
186
|
|
|
187
187
|
_this.handleEvent = function (ev) {
|
|
188
|
-
(0, _handle.
|
|
189
|
-
type: 'onUpdate'
|
|
190
|
-
}, _this.props); // fetch the forward() we generated earlier, using the event type as a key to find the real event name.
|
|
188
|
+
(0, _handle.forwardCustom)('onUpdate')(null, _this.props); // fetch the forward() we generated earlier, using the event type as a key to find the real event name.
|
|
191
189
|
|
|
192
190
|
var fwd = _this.handledMediaForwards[handledMediaEventsMap[ev.type]];
|
|
193
191
|
|