Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/react-virtualized/dist/es/Grid/utils/ drwxr-xr-x | |
| Viewing file: Select action/file-type: import calculateSizeAndPositionDataAndUpdateScrollOffset from './calculateSizeAndPositionDataAndUpdateScrollOffset';
describe('calculateSizeAndPositionDataAndUpdateScrollOffset', function () {
function helper() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref$cellCount = _ref.cellCount,
cellCount = _ref$cellCount === void 0 ? 100 : _ref$cellCount,
_ref$cellSize = _ref.cellSize,
cellSize = _ref$cellSize === void 0 ? 10 : _ref$cellSize,
_ref$computeMetadataC = _ref.computeMetadataCallbackProps,
computeMetadataCallbackProps = _ref$computeMetadataC === void 0 ? {} : _ref$computeMetadataC,
_ref$nextCellsCount = _ref.nextCellsCount,
nextCellsCount = _ref$nextCellsCount === void 0 ? 100 : _ref$nextCellsCount,
_ref$nextCellSize = _ref.nextCellSize,
nextCellSize = _ref$nextCellSize === void 0 ? 10 : _ref$nextCellSize,
nextScrollToIndex = _ref.nextScrollToIndex,
scrollToIndex = _ref.scrollToIndex;
var computeMetadataCallbackCalls = [];
var updateScrollOffsetForScrollToIndexCalls = [];
calculateSizeAndPositionDataAndUpdateScrollOffset({
cellCount: cellCount,
cellSize: cellSize,
computeMetadataCallback: function computeMetadataCallback(params) {
return computeMetadataCallbackCalls.push(params);
},
computeMetadataCallbackProps: computeMetadataCallbackProps,
nextCellsCount: nextCellsCount,
nextCellSize: nextCellSize,
nextScrollToIndex: nextScrollToIndex,
scrollToIndex: scrollToIndex,
updateScrollOffsetForScrollToIndex: function updateScrollOffsetForScrollToIndex(params) {
return updateScrollOffsetForScrollToIndexCalls.push(params);
}
});
return {
computeMetadataCallbackCalls: computeMetadataCallbackCalls,
updateScrollOffsetForScrollToIndexCalls: updateScrollOffsetForScrollToIndexCalls
};
}
it('should call :computeMetadataCallback if :cellCount has changed', function () {
var _helper = helper({
cellCount: 100,
nextCellsCount: 200
}),
computeMetadataCallbackCalls = _helper.computeMetadataCallbackCalls;
expect(computeMetadataCallbackCalls.length).toEqual(1);
});
it('should call :computeMetadataCallback if numeric :cellSize has changed', function () {
var _helper2 = helper({
cellSize: 10,
nextCellSize: 20
}),
computeMetadataCallbackCalls = _helper2.computeMetadataCallbackCalls;
expect(computeMetadataCallbackCalls.length).toEqual(1);
});
it('should not call :computeMetadataCallback if :cellSize callback has changed', function () {
var _helper3 = helper({
cellSize: function cellSize() {},
nextCellSize: function nextCellSize() {}
}),
computeMetadataCallbackCalls = _helper3.computeMetadataCallbackCalls;
expect(computeMetadataCallbackCalls.length).toEqual(0);
});
it('should not call :updateScrollOffsetForScrollToIndex if :scrollToIndex is not specified', function () {
var _helper4 = helper(),
updateScrollOffsetForScrollToIndexCalls = _helper4.updateScrollOffsetForScrollToIndexCalls;
expect(updateScrollOffsetForScrollToIndexCalls.length).toEqual(0);
});
it('should not call :updateScrollOffsetForScrollToIndex if :scrollToIndex has also changed', function () {
var _helper5 = helper({
scrollToIndex: 10,
nextScrollToIndex: 20
}),
updateScrollOffsetForScrollToIndexCalls = _helper5.updateScrollOffsetForScrollToIndexCalls;
expect(updateScrollOffsetForScrollToIndexCalls.length).toEqual(0);
});
it('should not call :computeMetadataCallback if the above conditions are not true', function () {
var _helper6 = helper(),
computeMetadataCallbackCalls = _helper6.computeMetadataCallbackCalls;
expect(computeMetadataCallbackCalls.length).toEqual(0);
});
}); |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0049 ]-- |