@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,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
var _useTouch = _interopRequireDefault(require("../useTouch"));
|
|
3
|
+
var _react = require("@testing-library/react");
|
|
6
4
|
|
|
7
5
|
var _config = require("../config");
|
|
8
6
|
|
|
7
|
+
var _useTouch = _interopRequireDefault(require("../useTouch"));
|
|
8
|
+
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
10
|
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -21,14 +21,19 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
21
21
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
22
22
|
|
|
23
23
|
describe('useTouch', function () {
|
|
24
|
-
var
|
|
25
|
-
|
|
24
|
+
var data;
|
|
25
|
+
|
|
26
|
+
var DivComponent = function DivComponent(props) {
|
|
27
|
+
data = props;
|
|
28
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
29
|
+
"data-testid": "component"
|
|
30
|
+
});
|
|
26
31
|
};
|
|
27
32
|
|
|
28
33
|
var TouchableComponent = function TouchableComponent(_ref) {
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
rest = _objectWithoutProperties(_ref, ["
|
|
34
|
+
var activeProp = _ref.activeProp,
|
|
35
|
+
id = _ref.id,
|
|
36
|
+
rest = _objectWithoutProperties(_ref, ["activeProp", "id"]);
|
|
32
37
|
|
|
33
38
|
var hook = (0, _useTouch["default"])(_objectSpread({
|
|
34
39
|
getActive: !!activeProp
|
|
@@ -48,13 +53,11 @@ describe('useTouch', function () {
|
|
|
48
53
|
beforeEach(_config.resetDefaultConfig);
|
|
49
54
|
afterEach(_config.resetDefaultConfig);
|
|
50
55
|
test('should return active state when activeProp is configured', function () {
|
|
51
|
-
|
|
56
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
|
|
52
57
|
activeProp: "active"
|
|
53
58
|
}));
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
-
var actual = ('active' in wrapped.props());
|
|
57
|
-
expect(actual).toBe(expected);
|
|
59
|
+
var expected = data.active;
|
|
60
|
+
expect(expected).toBeDefined();
|
|
58
61
|
});
|
|
59
62
|
test('should merge configurations', function () {
|
|
60
63
|
(0, _config.configure)({
|
|
@@ -108,83 +111,116 @@ describe('useTouch', function () {
|
|
|
108
111
|
describe('#onDown', function () {
|
|
109
112
|
test('should invoke onDown handle on mouse down', function () {
|
|
110
113
|
var handler = jest.fn();
|
|
111
|
-
|
|
114
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
|
|
112
115
|
activeProp: "active",
|
|
113
116
|
onDown: handler
|
|
114
117
|
}));
|
|
115
|
-
|
|
118
|
+
|
|
119
|
+
var component = _react.screen.getByTestId('component');
|
|
120
|
+
|
|
121
|
+
_react.fireEvent.mouseDown(component, {});
|
|
122
|
+
|
|
116
123
|
var expected = 1;
|
|
117
|
-
|
|
118
|
-
expect(actual).toBe(expected);
|
|
124
|
+
expect(handler).toHaveBeenCalledTimes(expected);
|
|
119
125
|
});
|
|
120
126
|
});
|
|
121
127
|
describe('#onUp', function () {
|
|
122
128
|
test('should invoke onUp handle on mouse up', function () {
|
|
123
129
|
var handler = jest.fn();
|
|
124
|
-
|
|
130
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
|
|
125
131
|
activeProp: "active",
|
|
126
132
|
onUp: handler
|
|
127
133
|
}));
|
|
128
|
-
|
|
129
|
-
|
|
134
|
+
|
|
135
|
+
var component = _react.screen.getByTestId('component');
|
|
136
|
+
|
|
137
|
+
_react.fireEvent.mouseDown(component, {});
|
|
138
|
+
|
|
139
|
+
_react.fireEvent.mouseUp(component, {});
|
|
140
|
+
|
|
130
141
|
var expected = 1;
|
|
131
|
-
|
|
132
|
-
expect(actual).toBe(expected);
|
|
142
|
+
expect(handler).toHaveBeenCalledTimes(expected);
|
|
133
143
|
});
|
|
134
144
|
});
|
|
135
145
|
describe('#onTap', function () {
|
|
136
146
|
test('should be called on mouse up', function () {
|
|
137
147
|
var handler = jest.fn();
|
|
138
|
-
|
|
148
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
|
|
139
149
|
activeProp: "active",
|
|
140
150
|
onTap: handler
|
|
141
151
|
}));
|
|
142
|
-
|
|
143
|
-
|
|
152
|
+
|
|
153
|
+
var component = _react.screen.getByTestId('component');
|
|
154
|
+
|
|
155
|
+
_react.fireEvent.mouseDown(component, {});
|
|
156
|
+
|
|
157
|
+
_react.fireEvent.mouseUp(component, {});
|
|
158
|
+
|
|
144
159
|
var expected = 1;
|
|
145
|
-
|
|
146
|
-
expect(actual).toBe(expected);
|
|
160
|
+
expect(handler).toHaveBeenCalledTimes(expected);
|
|
147
161
|
});
|
|
148
162
|
test('should be called on click', function () {
|
|
149
163
|
var handler = jest.fn();
|
|
150
|
-
|
|
164
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
|
|
151
165
|
activeProp: "active",
|
|
152
166
|
onTap: handler
|
|
153
167
|
}));
|
|
154
|
-
|
|
168
|
+
|
|
169
|
+
var component = _react.screen.getByTestId('component');
|
|
170
|
+
|
|
171
|
+
_react.fireEvent.click(component, {});
|
|
172
|
+
|
|
155
173
|
var expected = 1;
|
|
156
|
-
|
|
157
|
-
expect(actual).toBe(expected);
|
|
174
|
+
expect(handler).toHaveBeenCalledTimes(expected);
|
|
158
175
|
});
|
|
159
176
|
test('should be called before onClick on click', function () {
|
|
160
177
|
var handler = jest.fn();
|
|
161
|
-
|
|
178
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
|
|
162
179
|
activeProp: "active",
|
|
163
180
|
onClick: handler,
|
|
164
181
|
onTap: handler
|
|
165
182
|
}));
|
|
166
|
-
|
|
183
|
+
|
|
184
|
+
var component = _react.screen.getByTestId('component');
|
|
185
|
+
|
|
186
|
+
_react.fireEvent.click(component, {});
|
|
187
|
+
|
|
167
188
|
var expected = ['onTap', 'click'];
|
|
168
189
|
var actual = handler.mock.calls.map(function (call) {
|
|
169
190
|
return call[0].type;
|
|
170
191
|
});
|
|
171
192
|
expect(actual).toEqual(expected);
|
|
172
193
|
});
|
|
173
|
-
test('should be called before
|
|
194
|
+
test('should be called before onClick on mouse up', function () {
|
|
174
195
|
var handler = jest.fn();
|
|
175
|
-
|
|
196
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
|
|
176
197
|
activeProp: "active",
|
|
177
198
|
onClick: handler,
|
|
178
199
|
onTap: handler
|
|
179
200
|
}));
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
201
|
+
|
|
202
|
+
var component = _react.screen.getByTestId('component');
|
|
203
|
+
|
|
204
|
+
var mouseDownEvent = _react.createEvent.mouseDown(component, {});
|
|
205
|
+
|
|
206
|
+
var mouseUpEvent = _react.createEvent.mouseUp(component, {});
|
|
207
|
+
|
|
208
|
+
var clickEvent = _react.createEvent.click(component, {}); // a matching timeStamp is used by Touchable to prevent multiple onTaps on "true"
|
|
209
|
+
// click (mouseup + click)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
Object.defineProperty(mouseDownEvent, 'timeStamp', {
|
|
213
|
+
value: 1
|
|
214
|
+
});
|
|
215
|
+
Object.defineProperty(mouseUpEvent, 'timeStamp', {
|
|
216
|
+
value: 1
|
|
217
|
+
});
|
|
218
|
+
Object.defineProperty(clickEvent, 'timeStamp', {
|
|
219
|
+
value: 1
|
|
220
|
+
});
|
|
221
|
+
(0, _react.fireEvent)(component, mouseDownEvent);
|
|
222
|
+
(0, _react.fireEvent)(component, mouseUpEvent);
|
|
223
|
+
(0, _react.fireEvent)(component, clickEvent);
|
|
188
224
|
var expected = ['onTap', 'click'];
|
|
189
225
|
var actual = handler.mock.calls.map(function (call) {
|
|
190
226
|
return call[0].type;
|
|
@@ -193,95 +229,129 @@ describe('useTouch', function () {
|
|
|
193
229
|
});
|
|
194
230
|
test('should be preventable via onUp handler', function () {
|
|
195
231
|
var handler = jest.fn();
|
|
196
|
-
|
|
232
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
|
|
197
233
|
activeProp: "active",
|
|
198
234
|
onTap: handler,
|
|
199
235
|
onUp: preventDefault
|
|
200
236
|
}));
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
237
|
+
|
|
238
|
+
var component = _react.screen.getByTestId('component');
|
|
239
|
+
|
|
240
|
+
_react.fireEvent.mouseDown(component, {});
|
|
241
|
+
|
|
242
|
+
_react.fireEvent.mouseUp(component, {});
|
|
243
|
+
|
|
244
|
+
expect(handler).not.toHaveBeenCalled();
|
|
206
245
|
});
|
|
207
246
|
});
|
|
208
247
|
describe('state management', function () {
|
|
209
248
|
describe('activate', function () {
|
|
210
249
|
test('should update active state on mouse down when activeProp is configured', function () {
|
|
211
250
|
var handler = jest.fn();
|
|
212
|
-
|
|
251
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
|
|
213
252
|
activeProp: "active",
|
|
214
253
|
onDown: handler
|
|
215
254
|
}));
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
255
|
+
|
|
256
|
+
var component = _react.screen.getByTestId('component');
|
|
257
|
+
|
|
258
|
+
var beforeDown = data.active;
|
|
259
|
+
|
|
260
|
+
_react.fireEvent.mouseDown(component, {});
|
|
261
|
+
|
|
262
|
+
var afterDown = data.active;
|
|
219
263
|
var expected = false;
|
|
220
264
|
var actual = beforeDown === afterDown;
|
|
221
265
|
expect(actual).toBe(expected);
|
|
222
266
|
});
|
|
223
267
|
test('should not update active state on mouse down when disabled', function () {
|
|
224
268
|
var handler = jest.fn();
|
|
225
|
-
|
|
269
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
|
|
226
270
|
activeProp: "active",
|
|
227
271
|
disabled: true,
|
|
228
272
|
onDown: handler
|
|
229
273
|
}));
|
|
230
|
-
|
|
274
|
+
|
|
275
|
+
var component = _react.screen.getByTestId('component');
|
|
276
|
+
|
|
277
|
+
_react.fireEvent.mouseDown(component, {});
|
|
278
|
+
|
|
231
279
|
var expected = false;
|
|
232
|
-
var actual =
|
|
280
|
+
var actual = data.active;
|
|
233
281
|
expect(actual).toBe(expected);
|
|
234
282
|
});
|
|
235
283
|
test('should not update active state on mouse down when preventDefault is called', function () {
|
|
236
|
-
|
|
284
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
|
|
237
285
|
activeProp: "active",
|
|
238
286
|
onDown: preventDefault
|
|
239
287
|
}));
|
|
240
|
-
|
|
288
|
+
|
|
289
|
+
var component = _react.screen.getByTestId('component');
|
|
290
|
+
|
|
291
|
+
_react.fireEvent.mouseDown(component, {});
|
|
292
|
+
|
|
241
293
|
var expected = false;
|
|
242
|
-
var actual =
|
|
294
|
+
var actual = data.active;
|
|
243
295
|
expect(actual).toBe(expected);
|
|
244
296
|
});
|
|
245
297
|
});
|
|
246
298
|
describe('deactivate', function () {
|
|
247
299
|
test('should update active state on mouse up when activeProp is configured', function () {
|
|
248
300
|
var handler = jest.fn();
|
|
249
|
-
|
|
301
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
|
|
250
302
|
activeProp: "active",
|
|
251
303
|
onDown: handler
|
|
252
304
|
}));
|
|
253
|
-
|
|
254
|
-
var
|
|
255
|
-
|
|
256
|
-
|
|
305
|
+
|
|
306
|
+
var component = _react.screen.getByTestId('component');
|
|
307
|
+
|
|
308
|
+
_react.fireEvent.mouseDown(component, {});
|
|
309
|
+
|
|
310
|
+
var beforeUp = data.active;
|
|
311
|
+
|
|
312
|
+
_react.fireEvent.mouseUp(component, {});
|
|
313
|
+
|
|
314
|
+
var afterUp = data.active;
|
|
257
315
|
var expected = false;
|
|
258
316
|
var actual = beforeUp === afterUp;
|
|
259
317
|
expect(actual).toBe(expected);
|
|
260
318
|
});
|
|
261
319
|
test('should not update active state on mouse down when disabled', function () {
|
|
262
320
|
var handler = jest.fn();
|
|
263
|
-
|
|
321
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
|
|
264
322
|
activeProp: "active",
|
|
265
323
|
disabled: true,
|
|
266
324
|
onDown: handler
|
|
267
325
|
}));
|
|
268
|
-
|
|
269
|
-
var
|
|
270
|
-
|
|
271
|
-
|
|
326
|
+
|
|
327
|
+
var component = _react.screen.getByTestId('component');
|
|
328
|
+
|
|
329
|
+
_react.fireEvent.mouseDown(component, {});
|
|
330
|
+
|
|
331
|
+
var beforeUp = data.active;
|
|
332
|
+
|
|
333
|
+
_react.fireEvent.mouseUp(component, {});
|
|
334
|
+
|
|
335
|
+
var afterUp = data.active;
|
|
272
336
|
var expected = true;
|
|
273
337
|
var actual = beforeUp === afterUp;
|
|
274
338
|
expect(actual).toBe(expected);
|
|
275
339
|
});
|
|
276
340
|
test('should not update active state on mouse down when preventDefault is called', function () {
|
|
277
|
-
|
|
341
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
|
|
278
342
|
activeProp: "active",
|
|
279
343
|
onDown: preventDefault
|
|
280
344
|
}));
|
|
281
|
-
|
|
282
|
-
var
|
|
283
|
-
|
|
284
|
-
|
|
345
|
+
|
|
346
|
+
var component = _react.screen.getByTestId('component');
|
|
347
|
+
|
|
348
|
+
_react.fireEvent.mouseDown(component, {});
|
|
349
|
+
|
|
350
|
+
var beforeUp = data.active;
|
|
351
|
+
|
|
352
|
+
_react.fireEvent.mouseUp(component, {});
|
|
353
|
+
|
|
354
|
+
var afterUp = data.active;
|
|
285
355
|
var expected = true;
|
|
286
356
|
var actual = beforeUp === afterUp;
|
|
287
357
|
expect(actual).toBe(expected);
|
|
@@ -301,14 +371,17 @@ describe('useTouch', function () {
|
|
|
301
371
|
id: "outer"
|
|
302
372
|
}, outerHook.handlers), {}, {
|
|
303
373
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({
|
|
304
|
-
|
|
374
|
+
"data-testid": "inner"
|
|
305
375
|
}, innerHook.handlers), {}, {
|
|
306
376
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(DivComponent, {})
|
|
307
377
|
}))
|
|
308
378
|
}));
|
|
309
379
|
};
|
|
310
380
|
|
|
311
|
-
|
|
381
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {}));
|
|
382
|
+
|
|
383
|
+
var inner = _react.screen.getByTestId('inner');
|
|
384
|
+
|
|
312
385
|
var mouseEvent = {
|
|
313
386
|
timeStamp: 1
|
|
314
387
|
};
|
|
@@ -323,14 +396,16 @@ describe('useTouch', function () {
|
|
|
323
396
|
clientY: 0
|
|
324
397
|
}]
|
|
325
398
|
};
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
399
|
+
|
|
400
|
+
_react.fireEvent.touchStart(inner, touchEvent);
|
|
401
|
+
|
|
402
|
+
_react.fireEvent.touchEnd(inner, touchEvent);
|
|
403
|
+
|
|
404
|
+
_react.fireEvent.mouseDown(inner, mouseEvent);
|
|
405
|
+
|
|
406
|
+
_react.fireEvent.mouseUp(inner, mouseEvent);
|
|
407
|
+
|
|
408
|
+
expect(handler).toHaveBeenCalled();
|
|
334
409
|
});
|
|
335
410
|
});
|
|
336
411
|
});
|
|
@@ -75,10 +75,11 @@ are also supported and treated as milliseconds.
|
|
|
75
75
|
*/
|
|
76
76
|
noAnimation?: boolean;
|
|
77
77
|
/**
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
* The transition timing function.
|
|
79
|
+
* * Supported function names are: `ease` , `ease-in` , `ease-out` , `ease-in-out` , `ease-in-quart` ,
|
|
80
|
+
*
|
|
81
|
+
* `ease-out-quart` , and `linear` .
|
|
82
|
+
*/
|
|
82
83
|
timingFunction?: string;
|
|
83
84
|
/**
|
|
84
85
|
* The type of transition to affect the content.
|
|
@@ -86,19 +87,19 @@ are also supported and treated as milliseconds.
|
|
|
86
87
|
*
|
|
87
88
|
* Details on types:
|
|
88
89
|
* * `'slide'` - Typically used for bringing something which is off the edge of the screen,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
and not visible, onto the screen. Think of a popup, toast, notification, dialog, or
|
|
91
|
+
an overlaying menu. This requires no re-rendering or repainting of the screen during
|
|
92
|
+
the transition, making it very performant. However, this does not affect layout at
|
|
93
|
+
all, which makes it less useful for transitioning from a place already on the
|
|
94
|
+
screen.
|
|
94
95
|
* * `'clip'` - This is useful for showing a component that transitions-in from a location
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
that is already on the screen. Examples would be an expanding header or an
|
|
97
|
+
accordion. This type does affects layout, its current size will push other sibling
|
|
98
|
+
elements to make room for itself. Because of this, repainting the layout does happen
|
|
99
|
+
during transition.
|
|
99
100
|
* * `'fade'` - Fade the components onto the screen, from 0 opacity (completely invisible)
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
to 1 (full visibility). Pretty basic, but useful for fading on/off a tooltip, a
|
|
102
|
+
menu, a panel, or even view contents. This does not affect layout at all.
|
|
102
103
|
*/
|
|
103
104
|
type?: string;
|
|
104
105
|
/**
|
|
@@ -130,7 +131,8 @@ export interface TransitionProps {
|
|
|
130
131
|
/**
|
|
131
132
|
* Controls how long the transition should take.
|
|
132
133
|
* * Supported preset durations are: `'short'` (250ms), `'medium'` (500ms), and `'long'` (1s).
|
|
133
|
-
|
|
134
|
+
*
|
|
135
|
+
* `'medium'` (500ms) is default when no others are specified.
|
|
134
136
|
*
|
|
135
137
|
* Any valid CSS duration value is also accepted, e.g. "200ms" or "3s". Pure numeric values
|
|
136
138
|
are also supported and treated as miliseconds.
|
|
@@ -162,19 +164,19 @@ Supported function names are: `ease` , `ease-in` , `ease-out` , `ease-in-out
|
|
|
162
164
|
*
|
|
163
165
|
* Details on types:
|
|
164
166
|
* * `'slide'` - Typically used for bringing something which is off the edge of the screen,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
and not visible, onto the screen. Think of a popup, toast, notification, dialog, or
|
|
168
|
+
an overlaying menu. This requires no re-rendering or repainting of the screen during
|
|
169
|
+
the transition, making it very performant. However, this does not affect layout at
|
|
170
|
+
all, which makes it less useful for transitioning from a place already on the
|
|
171
|
+
screen.
|
|
170
172
|
* * `'clip'` - This is useful for showing a component that transitions-in from a location
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
that is already on the screen. Examples would be an expanding header or an
|
|
174
|
+
accordion. This type does affects layout, its current size will push other sibling
|
|
175
|
+
elements to make room for itself. Because of this, repainting the layout does happen
|
|
176
|
+
during transition.
|
|
175
177
|
* * `'fade'` - Fade the components onto the screen, from 0 opacity (completely invisible)
|
|
176
|
-
|
|
177
|
-
|
|
178
|
+
to 1 (full visibility). Pretty basic, but useful for fading on/off a tooltip, a
|
|
179
|
+
menu, a panel, or even view contents. This does not affect layout at all.
|
|
178
180
|
*/
|
|
179
181
|
type?: string;
|
|
180
182
|
/**
|
package/Transition/Transition.js
CHANGED
|
@@ -55,10 +55,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
55
55
|
|
|
56
56
|
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; }
|
|
57
57
|
|
|
58
|
-
var forwardTransitionEnd = (0, _handle.forward)('onTransitionEnd');
|
|
59
|
-
var forwardOnShow = (0, _handle.forward)('onShow');
|
|
60
|
-
var forwardOnHide = (0, _handle.forward)('onHide');
|
|
61
|
-
|
|
62
58
|
var formatter = function formatter(duration) {
|
|
63
59
|
return typeof duration === 'number' ? duration + 'ms' : duration;
|
|
64
60
|
};
|
|
@@ -375,13 +371,13 @@ var Transition = /*#__PURE__*/function (_Component) {
|
|
|
375
371
|
};
|
|
376
372
|
|
|
377
373
|
_this.handleTransitionEnd = function (ev) {
|
|
378
|
-
|
|
374
|
+
(0, _handle.forwardCustom)('onTransitionEnd')(null, _this.props);
|
|
379
375
|
|
|
380
376
|
if (ev.target === _this.childNode) {
|
|
381
377
|
if (!_this.props.visible) {
|
|
382
|
-
|
|
378
|
+
(0, _handle.forwardCustom)('onHide')(null, _this.props);
|
|
383
379
|
} else if (_this.props.visible) {
|
|
384
|
-
|
|
380
|
+
(0, _handle.forwardCustom)('onShow')(null, _this.props);
|
|
385
381
|
}
|
|
386
382
|
}
|
|
387
383
|
};
|
|
@@ -456,9 +452,9 @@ var Transition = /*#__PURE__*/function (_Component) {
|
|
|
456
452
|
|
|
457
453
|
if (noAnimation) {
|
|
458
454
|
if (!prevProps.visible && visible) {
|
|
459
|
-
|
|
455
|
+
(0, _handle.forwardCustom)('onShow')({}, this.props);
|
|
460
456
|
} else if (prevProps.visible && !visible) {
|
|
461
|
-
|
|
457
|
+
(0, _handle.forwardCustom)('onHide')({}, this.props);
|
|
462
458
|
}
|
|
463
459
|
}
|
|
464
460
|
}
|