Skip to content

Commit

Permalink
chore: migrate more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoiver committed Nov 29, 2023
1 parent ab5cb83 commit deee67c
Show file tree
Hide file tree
Showing 170 changed files with 35,238 additions and 2,068 deletions.
4 changes: 2 additions & 2 deletions packages/g6/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"lint-staged": "lint-staged",
"fix": "eslint ./src ./tests --fix && prettier ./src ./tests --write ",
"test": "jest",
"test:integration": "node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest tests/integration/ --config jest.node.config.js --coverage -i --logHeapUsage --detectOpenHandles",
"test:integration_one": "node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest tests/integration/arrow.spec.ts --config jest.node.config.js -i --logHeapUsage --detectOpenHandles",
"test:integration": "node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest tests/integration/ --config jest.node.config.js --coverage --logHeapUsage --detectOpenHandles",
"test:integration_one": "node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest tests/integration/animations --config jest.node.config.js --logHeapUsage --detectOpenHandles",
"test-live": "DEBUG_MODE=1 jest --watch ./tests/unit/item-animate-spec.ts",
"test-behavior": "DEBUG_MODE=1 jest --watch ./tests/unit/item-3d-spec.ts",
"ci": "run-s lint build test:integration",
Expand Down
13 changes: 7 additions & 6 deletions packages/g6/src/stdlib/plugin/lodController/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class LodController extends Base {
this.updateLabelPositions(zoom?.ratio);
}
// @ts-ignore
if (!this.options.disableLod) this.debounceUpdateVisible(zoom?.ratio);
if (!this.options?.disableLod) this.debounceUpdateVisible(zoom?.ratio);
};

private getDebounceFn = (fn) => {
Expand All @@ -122,7 +122,8 @@ export class LodController extends Base {

private updateVisible = (zoomRatio = 1) => {
const { graph, cacheViewModels, options } = this;
const { cellSize, numberPerCell, disableAnimate, disableLod } = options;
const { cellSize, numberPerCell, disableAnimate, disableLod } =
options || {};
const graphZoom = graph.getZoom();
const { inView } = cacheViewModels || this.groupItemsByView(1);

Expand Down Expand Up @@ -296,7 +297,7 @@ export class LodController extends Base {
!item ||
!item.labelGroup.children.length ||
!item.shapeMap.labelShape ||
(!options.disableLod &&
(!options?.disableLod &&
(item.labelGroup.style.visibility === 'hidden' ||
item.shapeMap.labelShape.style.visibility === 'hidden'))
) {
Expand All @@ -307,7 +308,7 @@ export class LodController extends Base {
if (!labelShape) return;
const updatePosition = () => {
// adjust labels'positions for visible items
item.updateLabelPosition(options.disableLod);
item.updateLabelPosition(options?.disableLod);
this.labelPositionDirty.delete(model.id);
};
const { visible, lod } = labelShape;
Expand Down Expand Up @@ -347,7 +348,7 @@ export class LodController extends Base {
disableAnimate: true,
});
});
if (options.disableLod) {
if (options?.disableLod) {
newlyInView.forEach((model) => {
graph.showItem(model.id, {
shapeIds: ['labelShape', 'labelBackgroundShape'],
Expand Down Expand Up @@ -539,7 +540,7 @@ export class LodController extends Base {
if (action !== 'updatePosition') {
this.displayModelCache.delete(model.id);
}
if (this.options.disableLod) {
if (this.options?.disableLod) {
this.graph.showItem(model.id, {
shapeIds: ['labelShape', 'labelBackgroundShape'],
disableAnimate: true,
Expand Down
248 changes: 0 additions & 248 deletions packages/g6/tests/bak/animations-node-build-in.spec.ts

This file was deleted.

Loading

0 comments on commit deee67c

Please sign in to comment.