@depup/react-virtualized 9.22.6-depup.0
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/LICENSE +22 -0
- package/README.md +34 -0
- package/changes.json +22 -0
- package/dist/commonjs/ArrowKeyStepper/ArrowKeyStepper.example.js +184 -0
- package/dist/commonjs/ArrowKeyStepper/ArrowKeyStepper.jest.js +338 -0
- package/dist/commonjs/ArrowKeyStepper/ArrowKeyStepper.js +204 -0
- package/dist/commonjs/ArrowKeyStepper/index.js +19 -0
- package/dist/commonjs/ArrowKeyStepper/types.js +5 -0
- package/dist/commonjs/AutoSizer/AutoSizer.example.js +104 -0
- package/dist/commonjs/AutoSizer/AutoSizer.jest.js +341 -0
- package/dist/commonjs/AutoSizer/AutoSizer.js +199 -0
- package/dist/commonjs/AutoSizer/AutoSizer.ssr.js +25 -0
- package/dist/commonjs/AutoSizer/index.js +19 -0
- package/dist/commonjs/CellMeasurer/CellMeasurer.DynamicHeightGrid.example.js +100 -0
- package/dist/commonjs/CellMeasurer/CellMeasurer.DynamicHeightList.example.js +99 -0
- package/dist/commonjs/CellMeasurer/CellMeasurer.DynamicHeightTableColumn.example.js +107 -0
- package/dist/commonjs/CellMeasurer/CellMeasurer.DynamicWidthGrid.example.js +102 -0
- package/dist/commonjs/CellMeasurer/CellMeasurer.DynamicWidthMultiGrid.example.js +107 -0
- package/dist/commonjs/CellMeasurer/CellMeasurer.example.js +129 -0
- package/dist/commonjs/CellMeasurer/CellMeasurer.jest.js +345 -0
- package/dist/commonjs/CellMeasurer/CellMeasurer.js +195 -0
- package/dist/commonjs/CellMeasurer/CellMeasurerCache.jest.js +298 -0
- package/dist/commonjs/CellMeasurer/CellMeasurerCache.js +202 -0
- package/dist/commonjs/CellMeasurer/index.js +22 -0
- package/dist/commonjs/CellMeasurer/types.js +14 -0
- package/dist/commonjs/Collection/Collection.example.js +231 -0
- package/dist/commonjs/Collection/Collection.jest.js +829 -0
- package/dist/commonjs/Collection/Collection.js +266 -0
- package/dist/commonjs/Collection/CollectionView.js +553 -0
- package/dist/commonjs/Collection/Section.jest.js +63 -0
- package/dist/commonjs/Collection/Section.js +57 -0
- package/dist/commonjs/Collection/SectionManager.jest.js +121 -0
- package/dist/commonjs/Collection/SectionManager.js +134 -0
- package/dist/commonjs/Collection/TestData.js +77 -0
- package/dist/commonjs/Collection/index.js +15 -0
- package/dist/commonjs/Collection/types.js +22 -0
- package/dist/commonjs/Collection/utils/calculateSizeAndPositionData.jest.js +34 -0
- package/dist/commonjs/Collection/utils/calculateSizeAndPositionData.js +38 -0
- package/dist/commonjs/ColumnSizer/ColumnSizer.example.js +159 -0
- package/dist/commonjs/ColumnSizer/ColumnSizer.jest.js +129 -0
- package/dist/commonjs/ColumnSizer/ColumnSizer.js +103 -0
- package/dist/commonjs/ColumnSizer/index.js +15 -0
- package/dist/commonjs/Grid/Grid.example.js +330 -0
- package/dist/commonjs/Grid/Grid.jest.js +2561 -0
- package/dist/commonjs/Grid/Grid.js +1432 -0
- package/dist/commonjs/Grid/Grid.ssr.js +62 -0
- package/dist/commonjs/Grid/accessibilityOverscanIndicesGetter.jest.js +92 -0
- package/dist/commonjs/Grid/accessibilityOverscanIndicesGetter.js +40 -0
- package/dist/commonjs/Grid/defaultCellRangeRenderer.js +139 -0
- package/dist/commonjs/Grid/defaultOverscanIndicesGetter.jest.js +92 -0
- package/dist/commonjs/Grid/defaultOverscanIndicesGetter.js +36 -0
- package/dist/commonjs/Grid/index.js +40 -0
- package/dist/commonjs/Grid/types.js +8 -0
- package/dist/commonjs/Grid/utils/CellSizeAndPositionManager.jest.js +375 -0
- package/dist/commonjs/Grid/utils/CellSizeAndPositionManager.js +296 -0
- package/dist/commonjs/Grid/utils/ScalingCellSizeAndPositionManager.jest.js +201 -0
- package/dist/commonjs/Grid/utils/ScalingCellSizeAndPositionManager.js +204 -0
- package/dist/commonjs/Grid/utils/calculateSizeAndPositionDataAndUpdateScrollOffset.jest.js +84 -0
- package/dist/commonjs/Grid/utils/calculateSizeAndPositionDataAndUpdateScrollOffset.js +59 -0
- package/dist/commonjs/Grid/utils/maxElementSize.js +22 -0
- package/dist/commonjs/Grid/utils/updateScrollIndexHelper.jest.js +180 -0
- package/dist/commonjs/Grid/utils/updateScrollIndexHelper.js +85 -0
- package/dist/commonjs/InfiniteLoader/InfiniteLoader.example.js +179 -0
- package/dist/commonjs/InfiniteLoader/InfiniteLoader.jest.js +571 -0
- package/dist/commonjs/InfiniteLoader/InfiniteLoader.js +274 -0
- package/dist/commonjs/InfiniteLoader/index.js +15 -0
- package/dist/commonjs/List/List.example.js +236 -0
- package/dist/commonjs/List/List.jest.js +517 -0
- package/dist/commonjs/List/List.js +318 -0
- package/dist/commonjs/List/index.js +19 -0
- package/dist/commonjs/List/types.js +6 -0
- package/dist/commonjs/Masonry/Masonry.example.js +287 -0
- package/dist/commonjs/Masonry/Masonry.jest.js +450 -0
- package/dist/commonjs/Masonry/Masonry.js +431 -0
- package/dist/commonjs/Masonry/PositionCache.js +88 -0
- package/dist/commonjs/Masonry/createCellPositioner.js +59 -0
- package/dist/commonjs/Masonry/index.js +22 -0
- package/dist/commonjs/MultiGrid/CellMeasurerCacheDecorator.js +106 -0
- package/dist/commonjs/MultiGrid/MultiGrid.example.js +131 -0
- package/dist/commonjs/MultiGrid/MultiGrid.jest.js +584 -0
- package/dist/commonjs/MultiGrid/MultiGrid.js +743 -0
- package/dist/commonjs/MultiGrid/index.js +15 -0
- package/dist/commonjs/ScrollSync/ScrollSync.example.js +257 -0
- package/dist/commonjs/ScrollSync/ScrollSync.jest.js +66 -0
- package/dist/commonjs/ScrollSync/ScrollSync.js +88 -0
- package/dist/commonjs/ScrollSync/index.js +15 -0
- package/dist/commonjs/Table/Column.jest.js +90 -0
- package/dist/commonjs/Table/Column.js +93 -0
- package/dist/commonjs/Table/SortDirection.js +19 -0
- package/dist/commonjs/Table/SortIndicator.js +40 -0
- package/dist/commonjs/Table/Table.example.js +325 -0
- package/dist/commonjs/Table/Table.jest.js +1257 -0
- package/dist/commonjs/Table/Table.js +742 -0
- package/dist/commonjs/Table/createMultiSort.jest.js +165 -0
- package/dist/commonjs/Table/createMultiSort.js +99 -0
- package/dist/commonjs/Table/defaultCellDataGetter.js +21 -0
- package/dist/commonjs/Table/defaultCellRenderer.js +19 -0
- package/dist/commonjs/Table/defaultHeaderRenderer.js +35 -0
- package/dist/commonjs/Table/defaultHeaderRowRenderer.js +21 -0
- package/dist/commonjs/Table/defaultRowRenderer.js +87 -0
- package/dist/commonjs/Table/index.js +78 -0
- package/dist/commonjs/Table/types.js +39 -0
- package/dist/commonjs/WindowScroller/WindowScroller.e2e.js +298 -0
- package/dist/commonjs/WindowScroller/WindowScroller.example.js +167 -0
- package/dist/commonjs/WindowScroller/WindowScroller.header-resize.e2e.js +359 -0
- package/dist/commonjs/WindowScroller/WindowScroller.jest.js +536 -0
- package/dist/commonjs/WindowScroller/WindowScroller.js +268 -0
- package/dist/commonjs/WindowScroller/WindowScroller.ssr.js +25 -0
- package/dist/commonjs/WindowScroller/index.js +23 -0
- package/dist/commonjs/WindowScroller/utils/dimensions.js +89 -0
- package/dist/commonjs/WindowScroller/utils/onScroll.js +70 -0
- package/dist/commonjs/index.js +180 -0
- package/dist/commonjs/jest-setup.js +7 -0
- package/dist/commonjs/utils/TestHelper.js +36 -0
- package/dist/commonjs/utils/animationFrame.js +29 -0
- package/dist/commonjs/utils/createCallbackMemoizer.jest.js +219 -0
- package/dist/commonjs/utils/createCallbackMemoizer.js +31 -0
- package/dist/commonjs/utils/getUpdatedOffsetForIndex.jest.js +68 -0
- package/dist/commonjs/utils/getUpdatedOffsetForIndex.js +38 -0
- package/dist/commonjs/utils/initCellMetadata.js +37 -0
- package/dist/commonjs/utils/requestAnimationTimeout.js +38 -0
- package/dist/commonjs/vendor/binarySearchBounds.js +200 -0
- package/dist/commonjs/vendor/detectElementResize.js +192 -0
- package/dist/commonjs/vendor/intervalTree.js +361 -0
- package/dist/es/ArrowKeyStepper/ArrowKeyStepper.example.js +176 -0
- package/dist/es/ArrowKeyStepper/ArrowKeyStepper.jest.js +332 -0
- package/dist/es/ArrowKeyStepper/ArrowKeyStepper.js +197 -0
- package/dist/es/ArrowKeyStepper/index.js +3 -0
- package/dist/es/ArrowKeyStepper/types.js +4 -0
- package/dist/es/AutoSizer/AutoSizer.example.js +96 -0
- package/dist/es/AutoSizer/AutoSizer.jest.js +335 -0
- package/dist/es/AutoSizer/AutoSizer.js +190 -0
- package/dist/es/AutoSizer/AutoSizer.js.flow +200 -0
- package/dist/es/AutoSizer/AutoSizer.ssr.js +19 -0
- package/dist/es/AutoSizer/index.js +2 -0
- package/dist/es/AutoSizer/index.js.flow +4 -0
- package/dist/es/CellMeasurer/CellMeasurer.DynamicHeightGrid.example.js +91 -0
- package/dist/es/CellMeasurer/CellMeasurer.DynamicHeightList.example.js +90 -0
- package/dist/es/CellMeasurer/CellMeasurer.DynamicHeightTableColumn.example.js +98 -0
- package/dist/es/CellMeasurer/CellMeasurer.DynamicWidthGrid.example.js +93 -0
- package/dist/es/CellMeasurer/CellMeasurer.DynamicWidthMultiGrid.example.js +98 -0
- package/dist/es/CellMeasurer/CellMeasurer.example.js +120 -0
- package/dist/es/CellMeasurer/CellMeasurer.jest.js +340 -0
- package/dist/es/CellMeasurer/CellMeasurer.js +187 -0
- package/dist/es/CellMeasurer/CellMeasurerCache.jest.js +293 -0
- package/dist/es/CellMeasurer/CellMeasurerCache.js +196 -0
- package/dist/es/CellMeasurer/index.js +4 -0
- package/dist/es/CellMeasurer/types.js +13 -0
- package/dist/es/Collection/Collection.example.js +223 -0
- package/dist/es/Collection/Collection.jest.js +824 -0
- package/dist/es/Collection/Collection.js +257 -0
- package/dist/es/Collection/CollectionView.js +544 -0
- package/dist/es/Collection/Section.jest.js +60 -0
- package/dist/es/Collection/Section.js +51 -0
- package/dist/es/Collection/SectionManager.jest.js +118 -0
- package/dist/es/Collection/SectionManager.js +128 -0
- package/dist/es/Collection/TestData.js +71 -0
- package/dist/es/Collection/index.js +3 -0
- package/dist/es/Collection/types.js +21 -0
- package/dist/es/Collection/utils/calculateSizeAndPositionData.jest.js +31 -0
- package/dist/es/Collection/utils/calculateSizeAndPositionData.js +31 -0
- package/dist/es/ColumnSizer/ColumnSizer.example.js +150 -0
- package/dist/es/ColumnSizer/ColumnSizer.jest.js +123 -0
- package/dist/es/ColumnSizer/ColumnSizer.js +95 -0
- package/dist/es/ColumnSizer/index.js +3 -0
- package/dist/es/Grid/Grid.example.js +321 -0
- package/dist/es/Grid/Grid.jest.js +2555 -0
- package/dist/es/Grid/Grid.js +1425 -0
- package/dist/es/Grid/Grid.ssr.js +57 -0
- package/dist/es/Grid/accessibilityOverscanIndicesGetter.jest.js +87 -0
- package/dist/es/Grid/accessibilityOverscanIndicesGetter.js +33 -0
- package/dist/es/Grid/defaultCellRangeRenderer.js +134 -0
- package/dist/es/Grid/defaultOverscanIndicesGetter.jest.js +87 -0
- package/dist/es/Grid/defaultOverscanIndicesGetter.js +29 -0
- package/dist/es/Grid/index.js +15 -0
- package/dist/es/Grid/types.js +96 -0
- package/dist/es/Grid/utils/CellSizeAndPositionManager.jest.js +372 -0
- package/dist/es/Grid/utils/CellSizeAndPositionManager.js +290 -0
- package/dist/es/Grid/utils/ScalingCellSizeAndPositionManager.jest.js +198 -0
- package/dist/es/Grid/utils/ScalingCellSizeAndPositionManager.js +198 -0
- package/dist/es/Grid/utils/calculateSizeAndPositionDataAndUpdateScrollOffset.jest.js +81 -0
- package/dist/es/Grid/utils/calculateSizeAndPositionDataAndUpdateScrollOffset.js +53 -0
- package/dist/es/Grid/utils/maxElementSize.js +16 -0
- package/dist/es/Grid/utils/updateScrollIndexHelper.jest.js +174 -0
- package/dist/es/Grid/utils/updateScrollIndexHelper.js +79 -0
- package/dist/es/InfiniteLoader/InfiniteLoader.example.js +170 -0
- package/dist/es/InfiniteLoader/InfiniteLoader.jest.js +565 -0
- package/dist/es/InfiniteLoader/InfiniteLoader.js +263 -0
- package/dist/es/InfiniteLoader/index.js +3 -0
- package/dist/es/List/List.example.js +227 -0
- package/dist/es/List/List.jest.js +511 -0
- package/dist/es/List/List.js +312 -0
- package/dist/es/List/index.js +3 -0
- package/dist/es/List/types.js +21 -0
- package/dist/es/Masonry/Masonry.example.js +278 -0
- package/dist/es/Masonry/Masonry.jest.js +444 -0
- package/dist/es/Masonry/Masonry.js +421 -0
- package/dist/es/Masonry/PositionCache.js +82 -0
- package/dist/es/Masonry/createCellPositioner.js +53 -0
- package/dist/es/Masonry/index.js +4 -0
- package/dist/es/MultiGrid/CellMeasurerCacheDecorator.js +100 -0
- package/dist/es/MultiGrid/MultiGrid.example.js +122 -0
- package/dist/es/MultiGrid/MultiGrid.jest.js +579 -0
- package/dist/es/MultiGrid/MultiGrid.js +733 -0
- package/dist/es/MultiGrid/index.js +3 -0
- package/dist/es/ScrollSync/ScrollSync.example.js +248 -0
- package/dist/es/ScrollSync/ScrollSync.jest.js +60 -0
- package/dist/es/ScrollSync/ScrollSync.js +80 -0
- package/dist/es/ScrollSync/index.js +3 -0
- package/dist/es/Table/Column.jest.js +84 -0
- package/dist/es/Table/Column.js +85 -0
- package/dist/es/Table/SortDirection.js +13 -0
- package/dist/es/Table/SortIndicator.js +31 -0
- package/dist/es/Table/Table.example.js +316 -0
- package/dist/es/Table/Table.jest.js +1251 -0
- package/dist/es/Table/Table.js +735 -0
- package/dist/es/Table/createMultiSort.jest.js +162 -0
- package/dist/es/Table/createMultiSort.js +93 -0
- package/dist/es/Table/defaultCellDataGetter.js +15 -0
- package/dist/es/Table/defaultCellRenderer.js +13 -0
- package/dist/es/Table/defaultHeaderRenderer.js +25 -0
- package/dist/es/Table/defaultHeaderRowRenderer.js +12 -0
- package/dist/es/Table/defaultRowRenderer.js +77 -0
- package/dist/es/Table/index.js +12 -0
- package/dist/es/Table/types.js +38 -0
- package/dist/es/WindowScroller/WindowScroller.e2e.js +295 -0
- package/dist/es/WindowScroller/WindowScroller.example.js +158 -0
- package/dist/es/WindowScroller/WindowScroller.header-resize.e2e.js +356 -0
- package/dist/es/WindowScroller/WindowScroller.jest.js +530 -0
- package/dist/es/WindowScroller/WindowScroller.js +259 -0
- package/dist/es/WindowScroller/WindowScroller.js.flow +277 -0
- package/dist/es/WindowScroller/WindowScroller.ssr.js +19 -0
- package/dist/es/WindowScroller/index.js +3 -0
- package/dist/es/WindowScroller/index.js.flow +6 -0
- package/dist/es/WindowScroller/utils/dimensions.js +81 -0
- package/dist/es/WindowScroller/utils/dimensions.js.flow +91 -0
- package/dist/es/WindowScroller/utils/onScroll.js +64 -0
- package/dist/es/WindowScroller/utils/onScroll.js.flow +94 -0
- package/dist/es/index.js +13 -0
- package/dist/es/jest-setup.js +5 -0
- package/dist/es/utils/TestHelper.js +30 -0
- package/dist/es/utils/animationFrame.js +23 -0
- package/dist/es/utils/createCallbackMemoizer.jest.js +216 -0
- package/dist/es/utils/createCallbackMemoizer.js +25 -0
- package/dist/es/utils/getUpdatedOffsetForIndex.jest.js +65 -0
- package/dist/es/utils/getUpdatedOffsetForIndex.js +32 -0
- package/dist/es/utils/initCellMetadata.js +31 -0
- package/dist/es/utils/requestAnimationTimeout.js +32 -0
- package/dist/es/vendor/binarySearchBounds.js +194 -0
- package/dist/es/vendor/detectElementResize.js +186 -0
- package/dist/es/vendor/intervalTree.js +354 -0
- package/dist/umd/react-virtualized.js +4638 -0
- package/package.json +188 -0
- package/styles.css +80 -0
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
8
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
9
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
11
|
+
import InfiniteLoader, { forceUpdateReactVirtualizedComponent, isRangeVisible, scanForUnloadedRanges } from './InfiniteLoader';
|
|
12
|
+
import * as React from 'react';
|
|
13
|
+
import List from '../List';
|
|
14
|
+
import { render } from '../TestUtils';
|
|
15
|
+
describe('InfiniteLoader', function () {
|
|
16
|
+
var innerOnRowsRendered;
|
|
17
|
+
var isRowLoadedCalls = [];
|
|
18
|
+
var isRowLoadedMap = {};
|
|
19
|
+
var loadMoreRowsCalls = [];
|
|
20
|
+
var rowRendererCalls = [];
|
|
21
|
+
beforeEach(function () {
|
|
22
|
+
isRowLoadedCalls = [];
|
|
23
|
+
isRowLoadedMap = {};
|
|
24
|
+
loadMoreRowsCalls = [];
|
|
25
|
+
rowRendererCalls = [];
|
|
26
|
+
});
|
|
27
|
+
function defaultIsRowLoaded(_ref) {
|
|
28
|
+
var index = _ref.index;
|
|
29
|
+
isRowLoadedCalls.push(index);
|
|
30
|
+
return !!isRowLoadedMap[index];
|
|
31
|
+
}
|
|
32
|
+
function defaultLoadMoreRows(_ref2) {
|
|
33
|
+
var startIndex = _ref2.startIndex,
|
|
34
|
+
stopIndex = _ref2.stopIndex;
|
|
35
|
+
loadMoreRowsCalls.push({
|
|
36
|
+
startIndex: startIndex,
|
|
37
|
+
stopIndex: stopIndex
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function rowRenderer(_ref3) {
|
|
41
|
+
var index = _ref3.index,
|
|
42
|
+
key = _ref3.key,
|
|
43
|
+
style = _ref3.style;
|
|
44
|
+
rowRendererCalls.push(index);
|
|
45
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
key: key,
|
|
47
|
+
style: style
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function getMarkup() {
|
|
51
|
+
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
52
|
+
_ref4$height = _ref4.height,
|
|
53
|
+
height = _ref4$height === void 0 ? 100 : _ref4$height,
|
|
54
|
+
_ref4$isRowLoaded = _ref4.isRowLoaded,
|
|
55
|
+
isRowLoaded = _ref4$isRowLoaded === void 0 ? defaultIsRowLoaded : _ref4$isRowLoaded,
|
|
56
|
+
_ref4$loadMoreRows = _ref4.loadMoreRows,
|
|
57
|
+
loadMoreRows = _ref4$loadMoreRows === void 0 ? defaultLoadMoreRows : _ref4$loadMoreRows,
|
|
58
|
+
_ref4$minimumBatchSiz = _ref4.minimumBatchSize,
|
|
59
|
+
minimumBatchSize = _ref4$minimumBatchSiz === void 0 ? 1 : _ref4$minimumBatchSiz,
|
|
60
|
+
_ref4$rowHeight = _ref4.rowHeight,
|
|
61
|
+
rowHeight = _ref4$rowHeight === void 0 ? 20 : _ref4$rowHeight,
|
|
62
|
+
_ref4$rowCount = _ref4.rowCount,
|
|
63
|
+
rowCount = _ref4$rowCount === void 0 ? 100 : _ref4$rowCount,
|
|
64
|
+
scrollToIndex = _ref4.scrollToIndex,
|
|
65
|
+
_ref4$threshold = _ref4.threshold,
|
|
66
|
+
threshold = _ref4$threshold === void 0 ? 10 : _ref4$threshold,
|
|
67
|
+
_ref4$width = _ref4.width,
|
|
68
|
+
width = _ref4$width === void 0 ? 200 : _ref4$width;
|
|
69
|
+
return /*#__PURE__*/React.createElement(InfiniteLoader, {
|
|
70
|
+
isRowLoaded: isRowLoaded,
|
|
71
|
+
loadMoreRows: loadMoreRows,
|
|
72
|
+
minimumBatchSize: minimumBatchSize,
|
|
73
|
+
rowCount: rowCount,
|
|
74
|
+
threshold: threshold
|
|
75
|
+
}, function (_ref5) {
|
|
76
|
+
var onRowsRendered = _ref5.onRowsRendered,
|
|
77
|
+
registerChild = _ref5.registerChild;
|
|
78
|
+
innerOnRowsRendered = onRowsRendered;
|
|
79
|
+
return /*#__PURE__*/React.createElement(List, {
|
|
80
|
+
ref: registerChild,
|
|
81
|
+
height: height,
|
|
82
|
+
onRowsRendered: onRowsRendered,
|
|
83
|
+
rowHeight: rowHeight,
|
|
84
|
+
rowRenderer: rowRenderer,
|
|
85
|
+
rowCount: rowCount,
|
|
86
|
+
scrollToIndex: scrollToIndex,
|
|
87
|
+
width: width
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
it('should call :isRowLoaded for all rows within the threshold each time a range of rows are rendered', function () {
|
|
92
|
+
render(getMarkup());
|
|
93
|
+
expect(isRowLoadedCalls).toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]);
|
|
94
|
+
});
|
|
95
|
+
it('should call :isRowLoaded for all rows within the rowCount each time a range of rows are rendered', function () {
|
|
96
|
+
render(getMarkup({
|
|
97
|
+
rowCount: 10
|
|
98
|
+
}));
|
|
99
|
+
expect(isRowLoadedCalls).toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
|
|
100
|
+
});
|
|
101
|
+
it('should call :loadMoreRows for unloaded rows within the threshold', function () {
|
|
102
|
+
render(getMarkup());
|
|
103
|
+
expect(loadMoreRowsCalls).toEqual([{
|
|
104
|
+
startIndex: 0,
|
|
105
|
+
stopIndex: 14
|
|
106
|
+
}]);
|
|
107
|
+
});
|
|
108
|
+
it('should call :loadMoreRows for unloaded rows within the rowCount', function () {
|
|
109
|
+
render(getMarkup({
|
|
110
|
+
rowCount: 10
|
|
111
|
+
}));
|
|
112
|
+
expect(loadMoreRowsCalls).toEqual([{
|
|
113
|
+
startIndex: 0,
|
|
114
|
+
stopIndex: 9
|
|
115
|
+
}]);
|
|
116
|
+
});
|
|
117
|
+
it('should :forceUpdate once rows have loaded if :loadMoreRows returns a Promise', /*#__PURE__*/function () {
|
|
118
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(done) {
|
|
119
|
+
var savedResolve, loadMoreRows;
|
|
120
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
121
|
+
while (1) switch (_context.prev = _context.next) {
|
|
122
|
+
case 0:
|
|
123
|
+
loadMoreRows = function _loadMoreRows() {
|
|
124
|
+
return new Promise(function (resolve) {
|
|
125
|
+
savedResolve = resolve;
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
render(getMarkup({
|
|
129
|
+
loadMoreRows: loadMoreRows
|
|
130
|
+
}));
|
|
131
|
+
rowRendererCalls.splice(0);
|
|
132
|
+
_context.next = 5;
|
|
133
|
+
return savedResolve();
|
|
134
|
+
case 5:
|
|
135
|
+
expect(rowRendererCalls.length > 0).toEqual(true);
|
|
136
|
+
done();
|
|
137
|
+
case 7:
|
|
138
|
+
case "end":
|
|
139
|
+
return _context.stop();
|
|
140
|
+
}
|
|
141
|
+
}, _callee);
|
|
142
|
+
}));
|
|
143
|
+
return function (_x) {
|
|
144
|
+
return _ref6.apply(this, arguments);
|
|
145
|
+
};
|
|
146
|
+
}());
|
|
147
|
+
it('should not :forceUpdate once rows have loaded rows are no longer visible', /*#__PURE__*/function () {
|
|
148
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(done) {
|
|
149
|
+
var resolves, loadMoreRows;
|
|
150
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
151
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
152
|
+
case 0:
|
|
153
|
+
loadMoreRows = function _loadMoreRows2() {
|
|
154
|
+
return new Promise(function (resolve) {
|
|
155
|
+
resolves.push(resolve);
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
resolves = [];
|
|
159
|
+
render(getMarkup({
|
|
160
|
+
loadMoreRows: loadMoreRows
|
|
161
|
+
}));
|
|
162
|
+
// Simulate a new range of rows being loaded
|
|
163
|
+
innerOnRowsRendered({
|
|
164
|
+
startIndex: 100,
|
|
165
|
+
stopIndex: 101
|
|
166
|
+
});
|
|
167
|
+
rowRendererCalls.splice(0);
|
|
168
|
+
_context2.next = 7;
|
|
169
|
+
return resolves[0]();
|
|
170
|
+
case 7:
|
|
171
|
+
// Resolve the first request only, not the simulated row-change
|
|
172
|
+
expect(rowRendererCalls.length).toEqual(0);
|
|
173
|
+
done();
|
|
174
|
+
case 9:
|
|
175
|
+
case "end":
|
|
176
|
+
return _context2.stop();
|
|
177
|
+
}
|
|
178
|
+
}, _callee2);
|
|
179
|
+
}));
|
|
180
|
+
return function (_x2) {
|
|
181
|
+
return _ref7.apply(this, arguments);
|
|
182
|
+
};
|
|
183
|
+
}());
|
|
184
|
+
describe('minimumBatchSize', function () {
|
|
185
|
+
it('should respect the specified :minimumBatchSize when scrolling down', function () {
|
|
186
|
+
render(getMarkup({
|
|
187
|
+
minimumBatchSize: 10,
|
|
188
|
+
threshold: 0
|
|
189
|
+
}));
|
|
190
|
+
expect(loadMoreRowsCalls.length).toEqual(1);
|
|
191
|
+
expect(loadMoreRowsCalls).toEqual([{
|
|
192
|
+
startIndex: 0,
|
|
193
|
+
stopIndex: 9
|
|
194
|
+
}]);
|
|
195
|
+
});
|
|
196
|
+
it('should respect the specified :minimumBatchSize when scrolling up', function () {
|
|
197
|
+
render(getMarkup({
|
|
198
|
+
minimumBatchSize: 10,
|
|
199
|
+
scrollToIndex: 20,
|
|
200
|
+
threshold: 0
|
|
201
|
+
}));
|
|
202
|
+
loadMoreRowsCalls.splice(0);
|
|
203
|
+
render(getMarkup({
|
|
204
|
+
isRowLoaded: function isRowLoaded(_ref8) {
|
|
205
|
+
var index = _ref8.index;
|
|
206
|
+
return index >= 20;
|
|
207
|
+
},
|
|
208
|
+
minimumBatchSize: 10,
|
|
209
|
+
scrollToIndex: 15,
|
|
210
|
+
threshold: 0
|
|
211
|
+
}));
|
|
212
|
+
expect(loadMoreRowsCalls.length).toEqual(1);
|
|
213
|
+
expect(loadMoreRowsCalls).toEqual([{
|
|
214
|
+
startIndex: 10,
|
|
215
|
+
stopIndex: 19
|
|
216
|
+
}]);
|
|
217
|
+
});
|
|
218
|
+
it('should not interfere with :threshold', function () {
|
|
219
|
+
render(getMarkup({
|
|
220
|
+
minimumBatchSize: 10,
|
|
221
|
+
threshold: 10
|
|
222
|
+
}));
|
|
223
|
+
expect(loadMoreRowsCalls.length).toEqual(1);
|
|
224
|
+
expect(loadMoreRowsCalls).toEqual([{
|
|
225
|
+
startIndex: 0,
|
|
226
|
+
stopIndex: 14
|
|
227
|
+
}]);
|
|
228
|
+
});
|
|
229
|
+
it('should respect the specified :minimumBatchSize if a user scrolls past the previous range', function () {
|
|
230
|
+
var isRowLoadedIndices = {};
|
|
231
|
+
function isRowLoaded(_ref9) {
|
|
232
|
+
var index = _ref9.index;
|
|
233
|
+
if (!isRowLoadedIndices[index]) {
|
|
234
|
+
isRowLoadedIndices[index] = true;
|
|
235
|
+
return false;
|
|
236
|
+
} else {
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
render(getMarkup({
|
|
241
|
+
isRowLoaded: isRowLoaded,
|
|
242
|
+
minimumBatchSize: 10,
|
|
243
|
+
threshold: 0
|
|
244
|
+
}));
|
|
245
|
+
// Simulate a new range of rows being loaded
|
|
246
|
+
innerOnRowsRendered({
|
|
247
|
+
startIndex: 5,
|
|
248
|
+
stopIndex: 10
|
|
249
|
+
});
|
|
250
|
+
expect(loadMoreRowsCalls).toEqual([{
|
|
251
|
+
startIndex: 0,
|
|
252
|
+
stopIndex: 9
|
|
253
|
+
}, {
|
|
254
|
+
startIndex: 10,
|
|
255
|
+
stopIndex: 19
|
|
256
|
+
}]);
|
|
257
|
+
});
|
|
258
|
+
it('should not exceed ending boundaries if :minimumBatchSize is larger than needed', function () {
|
|
259
|
+
render(getMarkup({
|
|
260
|
+
minimumBatchSize: 10,
|
|
261
|
+
rowCount: 25,
|
|
262
|
+
threshold: 0
|
|
263
|
+
}));
|
|
264
|
+
// Simulate a new range of rows being loaded
|
|
265
|
+
innerOnRowsRendered({
|
|
266
|
+
startIndex: 18,
|
|
267
|
+
stopIndex: 22
|
|
268
|
+
});
|
|
269
|
+
expect(loadMoreRowsCalls).toEqual([{
|
|
270
|
+
startIndex: 0,
|
|
271
|
+
stopIndex: 9
|
|
272
|
+
}, {
|
|
273
|
+
startIndex: 15,
|
|
274
|
+
stopIndex: 24
|
|
275
|
+
}]);
|
|
276
|
+
});
|
|
277
|
+
it('should not exceed beginning boundaries if :minimumBatchSize is larger than needed', function () {
|
|
278
|
+
render(getMarkup({
|
|
279
|
+
minimumBatchSize: 10,
|
|
280
|
+
scrollToIndex: 15,
|
|
281
|
+
threshold: 0
|
|
282
|
+
}));
|
|
283
|
+
loadMoreRowsCalls.splice(0);
|
|
284
|
+
render(getMarkup({
|
|
285
|
+
isRowLoaded: function isRowLoaded(_ref10) {
|
|
286
|
+
var index = _ref10.index;
|
|
287
|
+
return index >= 6;
|
|
288
|
+
},
|
|
289
|
+
minimumBatchSize: 10,
|
|
290
|
+
scrollToIndex: 2,
|
|
291
|
+
threshold: 0
|
|
292
|
+
}));
|
|
293
|
+
expect(loadMoreRowsCalls.length).toEqual(1);
|
|
294
|
+
expect(loadMoreRowsCalls).toEqual([{
|
|
295
|
+
startIndex: 0,
|
|
296
|
+
stopIndex: 5
|
|
297
|
+
}]);
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
// Verifies improved memoization; see bvaughn/react-virtualized/issues/345
|
|
302
|
+
it('should memoize calls to :loadMoreRows (not calling unless unloaded ranges have changed)', function () {
|
|
303
|
+
render(getMarkup({
|
|
304
|
+
isRowLoaded: function isRowLoaded() {
|
|
305
|
+
return false;
|
|
306
|
+
},
|
|
307
|
+
minimumBatchSize: 20,
|
|
308
|
+
threshold: 0
|
|
309
|
+
}));
|
|
310
|
+
expect(loadMoreRowsCalls).toEqual([{
|
|
311
|
+
startIndex: 0,
|
|
312
|
+
stopIndex: 19
|
|
313
|
+
}]);
|
|
314
|
+
innerOnRowsRendered({
|
|
315
|
+
startIndex: 0,
|
|
316
|
+
stopIndex: 15
|
|
317
|
+
});
|
|
318
|
+
expect(loadMoreRowsCalls).toEqual([{
|
|
319
|
+
startIndex: 0,
|
|
320
|
+
stopIndex: 19
|
|
321
|
+
}]);
|
|
322
|
+
loadMoreRowsCalls.splice(0);
|
|
323
|
+
innerOnRowsRendered({
|
|
324
|
+
startIndex: 0,
|
|
325
|
+
stopIndex: 20
|
|
326
|
+
});
|
|
327
|
+
expect(loadMoreRowsCalls).toEqual([{
|
|
328
|
+
startIndex: 0,
|
|
329
|
+
stopIndex: 20
|
|
330
|
+
}]);
|
|
331
|
+
});
|
|
332
|
+
it('resetLoadMoreRowsCache should reset memoized state', function () {
|
|
333
|
+
var component = render(getMarkup({
|
|
334
|
+
isRowLoaded: function isRowLoaded() {
|
|
335
|
+
return false;
|
|
336
|
+
},
|
|
337
|
+
minimumBatchSize: 20,
|
|
338
|
+
threshold: 0
|
|
339
|
+
}));
|
|
340
|
+
expect(loadMoreRowsCalls).toEqual([{
|
|
341
|
+
startIndex: 0,
|
|
342
|
+
stopIndex: 19
|
|
343
|
+
}]);
|
|
344
|
+
innerOnRowsRendered({
|
|
345
|
+
startIndex: 0,
|
|
346
|
+
stopIndex: 15
|
|
347
|
+
});
|
|
348
|
+
loadMoreRowsCalls.splice(0);
|
|
349
|
+
expect(loadMoreRowsCalls).toEqual([]);
|
|
350
|
+
component.resetLoadMoreRowsCache();
|
|
351
|
+
innerOnRowsRendered({
|
|
352
|
+
startIndex: 0,
|
|
353
|
+
stopIndex: 15
|
|
354
|
+
});
|
|
355
|
+
expect(loadMoreRowsCalls).toEqual([{
|
|
356
|
+
startIndex: 0,
|
|
357
|
+
stopIndex: 19
|
|
358
|
+
}]);
|
|
359
|
+
});
|
|
360
|
+
it('resetLoadMoreRowsCache should call :loadMoreRows if :autoReload parameter is true', function () {
|
|
361
|
+
var component = render(getMarkup({
|
|
362
|
+
isRowLoaded: function isRowLoaded() {
|
|
363
|
+
return false;
|
|
364
|
+
},
|
|
365
|
+
minimumBatchSize: 1,
|
|
366
|
+
threshold: 0
|
|
367
|
+
}));
|
|
368
|
+
|
|
369
|
+
// Simulate a new range of rows being loaded
|
|
370
|
+
loadMoreRowsCalls.splice(0);
|
|
371
|
+
innerOnRowsRendered({
|
|
372
|
+
startIndex: 0,
|
|
373
|
+
stopIndex: 10
|
|
374
|
+
});
|
|
375
|
+
component.resetLoadMoreRowsCache(true);
|
|
376
|
+
expect(loadMoreRowsCalls[loadMoreRowsCalls.length - 1]).toEqual({
|
|
377
|
+
startIndex: 0,
|
|
378
|
+
stopIndex: 10
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
// Simulate a new range of rows being loaded
|
|
382
|
+
loadMoreRowsCalls.splice(0);
|
|
383
|
+
innerOnRowsRendered({
|
|
384
|
+
startIndex: 20,
|
|
385
|
+
stopIndex: 30
|
|
386
|
+
});
|
|
387
|
+
expect(loadMoreRowsCalls[loadMoreRowsCalls.length - 1]).toEqual({
|
|
388
|
+
startIndex: 20,
|
|
389
|
+
stopIndex: 30
|
|
390
|
+
});
|
|
391
|
+
loadMoreRowsCalls.splice(0);
|
|
392
|
+
component.resetLoadMoreRowsCache(true);
|
|
393
|
+
expect(loadMoreRowsCalls[loadMoreRowsCalls.length - 1]).toEqual({
|
|
394
|
+
startIndex: 20,
|
|
395
|
+
stopIndex: 30
|
|
396
|
+
});
|
|
397
|
+
});
|
|
398
|
+
});
|
|
399
|
+
describe('scanForUnloadedRanges', function () {
|
|
400
|
+
function createIsRowLoaded(rows) {
|
|
401
|
+
return function (_ref11) {
|
|
402
|
+
var index = _ref11.index;
|
|
403
|
+
return rows[index];
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
it('should return an empty array for a range of rows that have all been loaded', function () {
|
|
407
|
+
expect(scanForUnloadedRanges({
|
|
408
|
+
isRowLoaded: createIsRowLoaded([true, true, true]),
|
|
409
|
+
startIndex: 0,
|
|
410
|
+
stopIndex: 2
|
|
411
|
+
})).toEqual([]);
|
|
412
|
+
});
|
|
413
|
+
it('return a range of only 1 unloaded row', function () {
|
|
414
|
+
expect(scanForUnloadedRanges({
|
|
415
|
+
isRowLoaded: createIsRowLoaded([true, false, true]),
|
|
416
|
+
startIndex: 0,
|
|
417
|
+
stopIndex: 2
|
|
418
|
+
})).toEqual([{
|
|
419
|
+
startIndex: 1,
|
|
420
|
+
stopIndex: 1
|
|
421
|
+
}]);
|
|
422
|
+
});
|
|
423
|
+
it('return a range of multiple unloaded rows', function () {
|
|
424
|
+
expect(scanForUnloadedRanges({
|
|
425
|
+
isRowLoaded: createIsRowLoaded([false, false, true]),
|
|
426
|
+
startIndex: 0,
|
|
427
|
+
stopIndex: 2
|
|
428
|
+
})).toEqual([{
|
|
429
|
+
startIndex: 0,
|
|
430
|
+
stopIndex: 1
|
|
431
|
+
}]);
|
|
432
|
+
});
|
|
433
|
+
it('return multiple ranges of unloaded rows', function () {
|
|
434
|
+
expect(scanForUnloadedRanges({
|
|
435
|
+
isRowLoaded: createIsRowLoaded([true, false, false, true, false, true, false]),
|
|
436
|
+
startIndex: 0,
|
|
437
|
+
stopIndex: 6
|
|
438
|
+
})).toEqual([{
|
|
439
|
+
startIndex: 1,
|
|
440
|
+
stopIndex: 2
|
|
441
|
+
}, {
|
|
442
|
+
startIndex: 4,
|
|
443
|
+
stopIndex: 4
|
|
444
|
+
}, {
|
|
445
|
+
startIndex: 6,
|
|
446
|
+
stopIndex: 6
|
|
447
|
+
}]);
|
|
448
|
+
});
|
|
449
|
+
});
|
|
450
|
+
describe('isRangeVisible', function () {
|
|
451
|
+
it('first row(s) are visible', function () {
|
|
452
|
+
expect(isRangeVisible({
|
|
453
|
+
lastRenderedStartIndex: 10,
|
|
454
|
+
lastRenderedStopIndex: 20,
|
|
455
|
+
startIndex: 20,
|
|
456
|
+
stopIndex: 30
|
|
457
|
+
})).toEqual(true);
|
|
458
|
+
});
|
|
459
|
+
it('last row(s) are visible', function () {
|
|
460
|
+
expect(isRangeVisible({
|
|
461
|
+
lastRenderedStartIndex: 10,
|
|
462
|
+
lastRenderedStopIndex: 20,
|
|
463
|
+
startIndex: 0,
|
|
464
|
+
stopIndex: 10
|
|
465
|
+
})).toEqual(true);
|
|
466
|
+
});
|
|
467
|
+
it('all row(s) are visible', function () {
|
|
468
|
+
expect(isRangeVisible({
|
|
469
|
+
lastRenderedStartIndex: 10,
|
|
470
|
+
lastRenderedStopIndex: 20,
|
|
471
|
+
startIndex: 12,
|
|
472
|
+
stopIndex: 14
|
|
473
|
+
})).toEqual(true);
|
|
474
|
+
});
|
|
475
|
+
it('no row(s) are visible', function () {
|
|
476
|
+
expect(isRangeVisible({
|
|
477
|
+
lastRenderedStartIndex: 10,
|
|
478
|
+
lastRenderedStopIndex: 20,
|
|
479
|
+
startIndex: 0,
|
|
480
|
+
stopIndex: 9
|
|
481
|
+
})).toEqual(false);
|
|
482
|
+
expect(isRangeVisible({
|
|
483
|
+
lastRenderedStartIndex: 10,
|
|
484
|
+
lastRenderedStopIndex: 20,
|
|
485
|
+
startIndex: 21,
|
|
486
|
+
stopIndex: 30
|
|
487
|
+
})).toEqual(false);
|
|
488
|
+
});
|
|
489
|
+
});
|
|
490
|
+
describe('forceUpdateReactVirtualizedComponent', function () {
|
|
491
|
+
it('should call :recomputeGridSize if defined', function () {
|
|
492
|
+
var recomputeGridSize = jest.fn();
|
|
493
|
+
var TestComponent = /*#__PURE__*/function (_React$Component) {
|
|
494
|
+
function TestComponent() {
|
|
495
|
+
var _this;
|
|
496
|
+
_classCallCheck(this, TestComponent);
|
|
497
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
498
|
+
args[_key] = arguments[_key];
|
|
499
|
+
}
|
|
500
|
+
_this = _callSuper(this, TestComponent, [].concat(args));
|
|
501
|
+
_defineProperty(_this, "recomputeGridSize", recomputeGridSize);
|
|
502
|
+
return _this;
|
|
503
|
+
}
|
|
504
|
+
_inherits(TestComponent, _React$Component);
|
|
505
|
+
return _createClass(TestComponent, [{
|
|
506
|
+
key: "render",
|
|
507
|
+
value: function render() {
|
|
508
|
+
return /*#__PURE__*/React.createElement("div", null);
|
|
509
|
+
}
|
|
510
|
+
}]);
|
|
511
|
+
}(React.Component);
|
|
512
|
+
forceUpdateReactVirtualizedComponent(render(/*#__PURE__*/React.createElement(TestComponent, null)), 10);
|
|
513
|
+
expect(recomputeGridSize).toHaveBeenCalledTimes(1);
|
|
514
|
+
expect(recomputeGridSize).toHaveBeenCalledWith(10);
|
|
515
|
+
});
|
|
516
|
+
it('should called :recomputeRowHeights if defined', function () {
|
|
517
|
+
var recomputeRowHeights = jest.fn();
|
|
518
|
+
var TestComponent = /*#__PURE__*/function (_React$Component2) {
|
|
519
|
+
function TestComponent() {
|
|
520
|
+
var _this2;
|
|
521
|
+
_classCallCheck(this, TestComponent);
|
|
522
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
523
|
+
args[_key2] = arguments[_key2];
|
|
524
|
+
}
|
|
525
|
+
_this2 = _callSuper(this, TestComponent, [].concat(args));
|
|
526
|
+
_defineProperty(_this2, "recomputeRowHeights", recomputeRowHeights);
|
|
527
|
+
return _this2;
|
|
528
|
+
}
|
|
529
|
+
_inherits(TestComponent, _React$Component2);
|
|
530
|
+
return _createClass(TestComponent, [{
|
|
531
|
+
key: "render",
|
|
532
|
+
value: function render() {
|
|
533
|
+
return /*#__PURE__*/React.createElement("div", null);
|
|
534
|
+
}
|
|
535
|
+
}]);
|
|
536
|
+
}(React.Component);
|
|
537
|
+
forceUpdateReactVirtualizedComponent(render(/*#__PURE__*/React.createElement(TestComponent, null)), 10);
|
|
538
|
+
expect(recomputeRowHeights).toHaveBeenCalledTimes(1);
|
|
539
|
+
expect(recomputeRowHeights).toHaveBeenCalledWith(10);
|
|
540
|
+
});
|
|
541
|
+
it('should call :forceUpdate otherwise', function () {
|
|
542
|
+
var forceUpdate = jest.fn();
|
|
543
|
+
var TestComponent = /*#__PURE__*/function (_React$Component3) {
|
|
544
|
+
function TestComponent() {
|
|
545
|
+
var _this3;
|
|
546
|
+
_classCallCheck(this, TestComponent);
|
|
547
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
548
|
+
args[_key3] = arguments[_key3];
|
|
549
|
+
}
|
|
550
|
+
_this3 = _callSuper(this, TestComponent, [].concat(args));
|
|
551
|
+
_defineProperty(_this3, "forceUpdate", forceUpdate);
|
|
552
|
+
return _this3;
|
|
553
|
+
}
|
|
554
|
+
_inherits(TestComponent, _React$Component3);
|
|
555
|
+
return _createClass(TestComponent, [{
|
|
556
|
+
key: "render",
|
|
557
|
+
value: function render() {
|
|
558
|
+
return /*#__PURE__*/React.createElement("div", null);
|
|
559
|
+
}
|
|
560
|
+
}]);
|
|
561
|
+
}(React.Component);
|
|
562
|
+
forceUpdateReactVirtualizedComponent(render(/*#__PURE__*/React.createElement(TestComponent, null)), 10);
|
|
563
|
+
expect(forceUpdate).toHaveBeenCalledTimes(1);
|
|
564
|
+
});
|
|
565
|
+
});
|