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