From deee67c16acdd185558dd4625fedf1bd0fc16714 Mon Sep 17 00:00:00 2001 From: "yuqi.pyq" Date: Wed, 29 Nov 2023 13:15:31 +0800 Subject: [PATCH] chore: migrate more test cases --- packages/g6/package.json | 4 +- .../src/stdlib/plugin/lodController/index.ts | 13 +- .../bak/animations-node-build-in.spec.ts | 248 -- .../bak/behaviors-activate-relations.spec.ts | 125 - .../tests/bak/behaviors-scroll-canvas.spec.ts | 108 - .../bak/behaviors-shortcuts-call.spec.ts | 103 - packages/g6/tests/bak/combo-render.spec.ts | 114 - .../g6/tests/bak/items-node-donut.spec.ts | 160 -- .../g6/tests/bak/items-node-image.spec.ts | 93 - .../g6/tests/bak/timebar-timeline.spec.ts | 31 - packages/g6/tests/bak/toolbar-default.spec.ts | 59 - .../g6/tests/bak/treegraph-render.spec.ts | 200 -- .../g6/tests/demo/plugins/edgeFilterLens.ts | 4 +- packages/g6/tests/demo/tree/treeGraph.ts | 120 +- packages/g6/tests/integration/anchor.spec.ts | 74 +- .../animations-node-build-in.spec.ts | 92 + .../api-update-mapper.spec.ts | 26 +- .../behaviors-activate-relations.spec.ts | 56 + .../behaviors-collapse-expand-tree.spec.ts | 48 +- .../behaviors-create-edge.spec.ts | 106 +- .../behaviors-scroll-canvas.spec.ts | 56 + .../behaviors-shortcuts-call.spec.ts | 92 + .../g6/tests/integration/combo-render.spec.ts | 96 + .../data-process-parallel-edges.spec.ts | 77 +- .../data-validate.spec.ts | 175 +- .../integration/items-edge-arrow.spec.ts | 86 +- .../tests/integration/items-edge-line.spec.ts | 82 +- .../tests/integration/items-edge-loop.spec.ts | 108 +- .../integration/items-edge-polyline.spec.ts | 164 +- .../integration/items-node-donut.spec.ts | 87 + .../integration/items-node-image.spec.ts | 35 + .../integration/layouts-circular.spec.ts | 10 +- .../tests/integration/layouts-d3force.spec.ts | 18 +- .../tests/integration/layouts-dagre.spec.ts | 10 +- .../tests/integration/layouts-force.spec.ts | 10 +- .../g6/tests/integration/layouts-grid.spec.ts | 10 +- .../g6/tests/integration/node-diamond.spec.ts | 26 +- .../g6/tests/integration/node-ellipse.spec.ts | 26 +- .../g6/tests/integration/node-hexagon.spec.ts | 26 +- .../tests/integration/node-modelRect.spec.ts | 26 +- .../g6/tests/integration/node-star.spec.ts | 25 +- .../tests/integration/node-triangle.spec.ts | 26 +- .../plugins-edgeFilterLens.spec.ts | 32 +- .../plugins-history-combo.spec.ts | 28 +- .../plugins-history.spec.ts | 28 +- .../{bak => integration}/plugins-hull.spec.ts | 85 +- .../plugins-watermarker.spec.ts | 35 +- .../animations-node-build-in-finished.svg | 2083 ++++++++++++++++ .../animations-node-build-in-ready.svg | 2115 ++++++++++++++++ .../animations-node-build-in-running.svg | 2115 ++++++++++++++++ .../api/api-update-mapper-edge-func.svg | 130 + .../api/api-update-mapper-edge-json.svg | 130 + .../snapshots/api/api-update-mapper-init.svg | 130 + .../api/api-update-mapper-node-func.svg | 130 + .../api/api-update-mapper-node-json.svg | 130 + .../behaviors-scroll-canvas-wheel.svg | 240 ++ .../behaviors-scroll-canvas-zoom.svg | 243 ++ .../behaivors/behaviors-scroll-canvas.svg | 228 ++ ...iors-activate-relations-activate-node1.svg | 498 ++++ ...rs-activate-relations-deactivate-node1.svg | 364 +++ .../behaviors-activate-relations.svg | 360 +++ ...aviors-collapse-expand-collapse-cnode1.svg | 468 ++++ ...haviors-collapse-expand-collapse-node1.svg | 474 ++++ ...ehaviors-collapse-expand-expand-cnode1.svg | 474 ++++ ...behaviors-collapse-expand-expand-node1.svg | 474 ++++ .../behaviors/behaviors-collapse-expand.svg | 465 ++++ .../behaviors-create-edge-click-begin.svg | 427 ++++ .../behaviors-create-edge-click-finish.svg | 385 +++ .../behaviors-create-edge-click-loop.svg | 404 +++ .../behaviors-create-edge-drag-begin.svg | 427 ++++ .../behaviors-create-edge-drag-finish.svg | 360 +++ .../behaviors-create-edge-drag-loop.svg | 360 +++ .../behaviors-shortcuts-call-with-fitView.svg | 116 + .../behaviors-shortcuts-call-with-zoom.svg | 116 + .../behaviors/behaviors-shortcuts-call.svg | 116 + .../data-parallel-edges-add-edge.svg | 598 +++++ .../data-parallel-edges-loop.svg | 580 +++++ .../data-parallel-edges-quadratic.svg | 400 +++ .../data-parallel-edges-remove-edge.svg | 580 +++++ .../data-parallel-edges-update-edge-1.svg | 580 +++++ .../data-parallel-edges-update-edge-2.svg | 580 +++++ .../data-parallel-edges-update-edge-3.svg | 580 +++++ .../data/data-validate-combo-no-id.svg | 69 + .../data-validate-duplicate-node-edge-id.svg | 44 + .../data/data-validate-duplicate-node-id.svg | 31 + .../data/data-validate-edge-no-id.svg | 69 + .../data/data-validate-edge-no-source.svg | 44 + .../data-validate-edge-source-not-exist.svg | 44 + .../data/data-validate-node-no-data.svg | 69 + .../data/data-validate-node-no-id.svg | 31 + .../data-validate-node-parent-not-exist.svg | 69 + .../items/combo/combo-circle-collapsed.svg | 397 +++ .../items/combo/combo-circle-expand.svg | 307 +++ .../items/combo/combo-circle-selected.svg | 293 +++ .../snapshots/items/combo/combo-circle.svg | 277 +++ .../items/combo/combo-rect-collapsed.svg | 389 +++ .../items/combo/combo-rect-expand.svg | 299 +++ .../items/combo/combo-rect-selected.svg | 285 +++ .../snapshots/items/combo/combo-rect.svg | 271 ++ .../donut/items-node-donut-custom-attrs.svg | 113 + .../donut/items-node-donut-custom-colors.svg | 113 + .../items-node-donut-custom-innersize.svg | 113 + .../donut/items-node-donut-selected-style.svg | 128 + .../items/node/donut/items-node-donut.svg | 113 + .../items/node/image/items-node-image.svg | 2211 +++++++++++++++++ .../plugins-edge-filter-lens-transients.svg | 416 ++++ .../plugins-history-add-combo-redo.svg | 50 + .../plugins-history-add-combo-undo.svg | 34 + .../history/plugins-history-add-combo.svg | 50 + .../history/plugins-history-add-data-redo.svg | 134 + .../history/plugins-history-add-data-undo.svg | 97 + .../history/plugins-history-add-data.svg | 134 + .../plugins-history-back-item-redo.svg | 134 + .../plugins-history-back-item-undo.svg | 134 + .../history/plugins-history-back-item.svg | 134 + .../plugins-history-clear-item-state-redo.svg | 83 + .../plugins-history-clear-item-state-undo.svg | 97 + .../plugins-history-clear-item-state.svg | 83 + .../history/plugins-history-combo-init.svg | 34 + .../plugins-history-delete-data-redo.svg | 97 + .../plugins-history-delete-data-undo.svg | 134 + .../history/plugins-history-delete-data.svg | 97 + .../plugins-history-front-item-redo.svg | 134 + .../plugins-history-front-item-undo.svg | 134 + .../history/plugins-history-front-item.svg | 134 + .../plugins-history-hide-item-redo.svg | 134 + .../plugins-history-hide-item-undo.svg | 134 + .../history/plugins-history-hide-item.svg | 134 + .../plugins/history/plugins-history-init.svg | 82 + .../plugins-history-set-item-state-redo.svg | 97 + .../plugins-history-set-item-state-undo.svg | 83 + .../plugins-history-set-item-state.svg | 97 + .../plugins-history-show-item-redo.svg | 134 + .../plugins-history-show-item-undo.svg | 134 + .../history/plugins-history-show-item.svg | 134 + .../plugins-history-update-data-redo.svg | 133 + .../plugins-history-update-data-undo.svg | 133 + .../history/plugins-history-update-data.svg | 133 + .../plugins/hull/plugins-hull-add-hull.svg | 57 + .../plugins/hull/plugins-hull-add-member.svg | 47 + .../plugins/hull/plugins-hull-add-node.svg | 47 + .../hull/plugins-hull-add-nonmember.svg | 47 + .../plugins/hull/plugins-hull-remove-hull.svg | 47 + .../hull/plugins-hull-remove-member.svg | 47 + .../plugins/hull/plugins-hull-remove-node.svg | 47 + .../hull/plugins-hull-remove-nonmember.svg | 47 + .../hull/plugins-hull-render-bubble.svg | 47 + .../plugins-hull-render-smooth-convex.svg | 47 + .../plugins/hull/plugins-hull-render.svg | 47 + .../hull/plugins-hull-update-config.svg | 47 + .../toolbar/plugins-toolbar-default.svg | 167 ++ .../watermarker/plugins-watermarker-text.svg | 253 ++ .../treegraph/treegraph-graphdata-addnode.svg | 366 +++ .../treegraph-graphdata-changedata.svg | 465 ++++ .../treegraph-graphdata-changedata2.svg | 383 +++ .../treegraph-graphdata-changelayout.svg | 386 +++ .../treegraph-graphdata-initial-collapse.svg | 267 ++ .../treegraph-graphdata-removenode.svg | 302 +++ .../treegraph-graphdata-updatenode.svg | 366 +++ .../treegraph/treegraph-graphdata.svg | 465 ++++ .../treegraph-treedata-changelayout.svg | 465 ++++ .../treegraph/treegraph-treedata-collapse.svg | 465 ++++ .../treegraph/treegraph-treedata-expand.svg | 465 ++++ .../treegraph-treedata-initial-collapse.svg | 270 ++ .../treegraph/treegraph-treedata.svg | 465 ++++ .../timebar-chart.spec.ts | 24 +- .../integration/timebar-timeline.spec.ts | 34 + .../tests/integration/toolbar-default.spec.ts | 34 + .../integration/treegraph-render.spec.ts | 220 ++ .../integration/utils/toMatchSVGSnapshot.ts | 62 +- 170 files changed, 35238 insertions(+), 2068 deletions(-) delete mode 100644 packages/g6/tests/bak/animations-node-build-in.spec.ts delete mode 100644 packages/g6/tests/bak/behaviors-activate-relations.spec.ts delete mode 100644 packages/g6/tests/bak/behaviors-scroll-canvas.spec.ts delete mode 100644 packages/g6/tests/bak/behaviors-shortcuts-call.spec.ts delete mode 100644 packages/g6/tests/bak/combo-render.spec.ts delete mode 100644 packages/g6/tests/bak/items-node-donut.spec.ts delete mode 100644 packages/g6/tests/bak/items-node-image.spec.ts delete mode 100644 packages/g6/tests/bak/timebar-timeline.spec.ts delete mode 100644 packages/g6/tests/bak/toolbar-default.spec.ts delete mode 100644 packages/g6/tests/bak/treegraph-render.spec.ts create mode 100644 packages/g6/tests/integration/animations-node-build-in.spec.ts rename packages/g6/tests/{bak => integration}/api-update-mapper.spec.ts (79%) create mode 100644 packages/g6/tests/integration/behaviors-activate-relations.spec.ts rename packages/g6/tests/{bak => integration}/behaviors-collapse-expand-tree.spec.ts (55%) rename packages/g6/tests/{bak => integration}/behaviors-create-edge.spec.ts (55%) create mode 100644 packages/g6/tests/integration/behaviors-scroll-canvas.spec.ts create mode 100644 packages/g6/tests/integration/behaviors-shortcuts-call.spec.ts create mode 100644 packages/g6/tests/integration/combo-render.spec.ts rename packages/g6/tests/{bak => integration}/data-process-parallel-edges.spec.ts (57%) rename packages/g6/tests/{bak => integration}/data-validate.spec.ts (65%) create mode 100644 packages/g6/tests/integration/items-node-donut.spec.ts create mode 100644 packages/g6/tests/integration/items-node-image.spec.ts rename packages/g6/tests/{bak => integration}/plugins-edgeFilterLens.spec.ts (59%) rename packages/g6/tests/{bak => integration}/plugins-history-combo.spec.ts (87%) rename packages/g6/tests/{bak => integration}/plugins-history.spec.ts (92%) rename packages/g6/tests/{bak => integration}/plugins-hull.spec.ts (74%) rename packages/g6/tests/{bak => integration}/plugins-watermarker.spec.ts (51%) create mode 100644 packages/g6/tests/integration/snapshots/animations/animations-node-build-in-finished.svg create mode 100644 packages/g6/tests/integration/snapshots/animations/animations-node-build-in-ready.svg create mode 100644 packages/g6/tests/integration/snapshots/animations/animations-node-build-in-running.svg create mode 100644 packages/g6/tests/integration/snapshots/api/api-update-mapper-edge-func.svg create mode 100644 packages/g6/tests/integration/snapshots/api/api-update-mapper-edge-json.svg create mode 100644 packages/g6/tests/integration/snapshots/api/api-update-mapper-init.svg create mode 100644 packages/g6/tests/integration/snapshots/api/api-update-mapper-node-func.svg create mode 100644 packages/g6/tests/integration/snapshots/api/api-update-mapper-node-json.svg create mode 100644 packages/g6/tests/integration/snapshots/behaivors/behaviors-scroll-canvas-wheel.svg create mode 100644 packages/g6/tests/integration/snapshots/behaivors/behaviors-scroll-canvas-zoom.svg create mode 100644 packages/g6/tests/integration/snapshots/behaivors/behaviors-scroll-canvas.svg create mode 100644 packages/g6/tests/integration/snapshots/behaviors/behaviors-activate-relations-activate-node1.svg create mode 100644 packages/g6/tests/integration/snapshots/behaviors/behaviors-activate-relations-deactivate-node1.svg create mode 100644 packages/g6/tests/integration/snapshots/behaviors/behaviors-activate-relations.svg create mode 100644 packages/g6/tests/integration/snapshots/behaviors/behaviors-collapse-expand-collapse-cnode1.svg create mode 100644 packages/g6/tests/integration/snapshots/behaviors/behaviors-collapse-expand-collapse-node1.svg create mode 100644 packages/g6/tests/integration/snapshots/behaviors/behaviors-collapse-expand-expand-cnode1.svg create mode 100644 packages/g6/tests/integration/snapshots/behaviors/behaviors-collapse-expand-expand-node1.svg create mode 100644 packages/g6/tests/integration/snapshots/behaviors/behaviors-collapse-expand.svg create mode 100644 packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-click-begin.svg create mode 100644 packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-click-finish.svg create mode 100644 packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-click-loop.svg create mode 100644 packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-drag-begin.svg create mode 100644 packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-drag-finish.svg create mode 100644 packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-drag-loop.svg create mode 100644 packages/g6/tests/integration/snapshots/behaviors/behaviors-shortcuts-call-with-fitView.svg create mode 100644 packages/g6/tests/integration/snapshots/behaviors/behaviors-shortcuts-call-with-zoom.svg create mode 100644 packages/g6/tests/integration/snapshots/behaviors/behaviors-shortcuts-call.svg create mode 100644 packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-add-edge.svg create mode 100644 packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-loop.svg create mode 100644 packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-quadratic.svg create mode 100644 packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-remove-edge.svg create mode 100644 packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-update-edge-1.svg create mode 100644 packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-update-edge-2.svg create mode 100644 packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-update-edge-3.svg create mode 100644 packages/g6/tests/integration/snapshots/data/data-validate-combo-no-id.svg create mode 100644 packages/g6/tests/integration/snapshots/data/data-validate-duplicate-node-edge-id.svg create mode 100644 packages/g6/tests/integration/snapshots/data/data-validate-duplicate-node-id.svg create mode 100644 packages/g6/tests/integration/snapshots/data/data-validate-edge-no-id.svg create mode 100644 packages/g6/tests/integration/snapshots/data/data-validate-edge-no-source.svg create mode 100644 packages/g6/tests/integration/snapshots/data/data-validate-edge-source-not-exist.svg create mode 100644 packages/g6/tests/integration/snapshots/data/data-validate-node-no-data.svg create mode 100644 packages/g6/tests/integration/snapshots/data/data-validate-node-no-id.svg create mode 100644 packages/g6/tests/integration/snapshots/data/data-validate-node-parent-not-exist.svg create mode 100644 packages/g6/tests/integration/snapshots/items/combo/combo-circle-collapsed.svg create mode 100644 packages/g6/tests/integration/snapshots/items/combo/combo-circle-expand.svg create mode 100644 packages/g6/tests/integration/snapshots/items/combo/combo-circle-selected.svg create mode 100644 packages/g6/tests/integration/snapshots/items/combo/combo-circle.svg create mode 100644 packages/g6/tests/integration/snapshots/items/combo/combo-rect-collapsed.svg create mode 100644 packages/g6/tests/integration/snapshots/items/combo/combo-rect-expand.svg create mode 100644 packages/g6/tests/integration/snapshots/items/combo/combo-rect-selected.svg create mode 100644 packages/g6/tests/integration/snapshots/items/combo/combo-rect.svg create mode 100644 packages/g6/tests/integration/snapshots/items/node/donut/items-node-donut-custom-attrs.svg create mode 100644 packages/g6/tests/integration/snapshots/items/node/donut/items-node-donut-custom-colors.svg create mode 100644 packages/g6/tests/integration/snapshots/items/node/donut/items-node-donut-custom-innersize.svg create mode 100644 packages/g6/tests/integration/snapshots/items/node/donut/items-node-donut-selected-style.svg create mode 100644 packages/g6/tests/integration/snapshots/items/node/donut/items-node-donut.svg create mode 100644 packages/g6/tests/integration/snapshots/items/node/image/items-node-image.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/edgeFilterLens/plugins-edge-filter-lens-transients.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-combo-redo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-combo-undo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-combo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-data-redo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-data-undo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-data.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-back-item-redo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-back-item-undo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-back-item.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-clear-item-state-redo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-clear-item-state-undo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-clear-item-state.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-combo-init.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-delete-data-redo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-delete-data-undo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-delete-data.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-front-item-redo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-front-item-undo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-front-item.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-hide-item-redo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-hide-item-undo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-hide-item.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-init.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-set-item-state-redo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-set-item-state-undo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-set-item-state.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-show-item-redo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-show-item-undo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-show-item.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-update-data-redo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-update-data-undo.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/history/plugins-history-update-data.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-add-hull.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-add-member.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-add-node.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-add-nonmember.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-remove-hull.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-remove-member.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-remove-node.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-remove-nonmember.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-render-bubble.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-render-smooth-convex.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-render.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-update-config.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/toolbar/plugins-toolbar-default.svg create mode 100644 packages/g6/tests/integration/snapshots/plugins/watermarker/plugins-watermarker-text.svg create mode 100644 packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-addnode.svg create mode 100644 packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-changedata.svg create mode 100644 packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-changedata2.svg create mode 100644 packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-changelayout.svg create mode 100644 packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-initial-collapse.svg create mode 100644 packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-removenode.svg create mode 100644 packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-updatenode.svg create mode 100644 packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata.svg create mode 100644 packages/g6/tests/integration/snapshots/treegraph/treegraph-treedata-changelayout.svg create mode 100644 packages/g6/tests/integration/snapshots/treegraph/treegraph-treedata-collapse.svg create mode 100644 packages/g6/tests/integration/snapshots/treegraph/treegraph-treedata-expand.svg create mode 100644 packages/g6/tests/integration/snapshots/treegraph/treegraph-treedata-initial-collapse.svg create mode 100644 packages/g6/tests/integration/snapshots/treegraph/treegraph-treedata.svg rename packages/g6/tests/{bak => integration}/timebar-chart.spec.ts (55%) create mode 100644 packages/g6/tests/integration/timebar-timeline.spec.ts create mode 100644 packages/g6/tests/integration/toolbar-default.spec.ts create mode 100644 packages/g6/tests/integration/treegraph-render.spec.ts diff --git a/packages/g6/package.json b/packages/g6/package.json index 061292b591a..da7c34d15d6 100644 --- a/packages/g6/package.json +++ b/packages/g6/package.json @@ -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", diff --git a/packages/g6/src/stdlib/plugin/lodController/index.ts b/packages/g6/src/stdlib/plugin/lodController/index.ts index b0e7b5466d5..89f2f33c529 100644 --- a/packages/g6/src/stdlib/plugin/lodController/index.ts +++ b/packages/g6/src/stdlib/plugin/lodController/index.ts @@ -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) => { @@ -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); @@ -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')) ) { @@ -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; @@ -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'], @@ -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, diff --git a/packages/g6/tests/bak/animations-node-build-in.spec.ts b/packages/g6/tests/bak/animations-node-build-in.spec.ts deleted file mode 100644 index 3f360811c3c..00000000000 --- a/packages/g6/tests/bak/animations-node-build-in.spec.ts +++ /dev/null @@ -1,248 +0,0 @@ -import { resetEntityCounter } from '@antv/g'; -import nodeBuildIn from '../demo/animations/node-build-in'; -import { createContext } from './utils'; -import './utils/useSnapshotMatchers'; - -describe('Animation node buildIn', () => { - beforeEach(() => { - /** - * SVG Snapshot testing will generate a unique id for each element. - * Reset to 0 to keep snapshot consistent. - */ - resetEntityCounter(); - }); - - it('should be rendered correctly with Canvas2D', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); - - const graph = nodeBuildIn({ - container, - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - }); - - graph.on('afterlayout', async () => { - const nodes = graph.getAllNodesData(); - - /** - * Time: 0 - */ - nodes.forEach(({ id }) => { - const node = graph['getItemById'](id); - node.animations.forEach((animation) => { - animation.currentTime = 0; - animation.pause(); - }); - }); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'animations-node-build-in-ready', - ); - - /** - * Time: 200 - */ - nodes.forEach(({ id }) => { - const node = graph['getItemById'](id); - node.animations.forEach((animation) => { - animation.currentTime = 200; - animation.pause(); - }); - }); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'animations-node-build-in-running', - ); - - /** - * Resume all animations. - */ - nodes.forEach(({ id }) => { - const node = graph['getItemById'](id); - node.animations.forEach((animation) => { - animation.play(); - }); - }); - - /** - * Time: finished - */ - await Promise.all( - nodes.map(async ({ id }) => { - const node = graph['getItemById'](id); - await Promise.all( - node.animations.map((animation) => animation.finished), - ); - }), - ); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'animations-node-build-in-finished', - ); - - graph.destroy(); - done(); - }); - }); - - it('should be rendered correctly with SVG', (done) => { - const dir = `${__dirname}/snapshots/svg`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('svg', 500, 500); - - const graph = nodeBuildIn({ - container, - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - }); - - graph.on('afterlayout', async () => { - const nodes = graph.getAllNodesData(); - - /** - * Time: 0 - */ - nodes.forEach(({ id }) => { - const node = graph['getItemById'](id); - node.animations.forEach((animation) => { - animation.currentTime = 0; - animation.pause(); - }); - }); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'animations-node-build-in-ready', - ); - - /** - * Time: 200 - */ - nodes.forEach(({ id }) => { - const node = graph['getItemById'](id); - node.animations.forEach((animation) => { - animation.currentTime = 200; - animation.pause(); - }); - }); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'animations-node-build-in-running', - ); - - /** - * Resume all animations. - */ - nodes.forEach(({ id }) => { - const node = graph['getItemById'](id); - node.animations.forEach((animation) => { - animation.play(); - }); - }); - - /** - * Time: finished - */ - await Promise.all( - nodes.map(async ({ id }) => { - const node = graph['getItemById'](id); - await Promise.all( - node.animations.map((animation) => animation.finished), - ); - }), - ); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'animations-node-build-in-finished', - ); - - graph.destroy(); - done(); - }); - }); - - it.skip('should be rendered correctly with WebGL', (done) => { - const dir = `${__dirname}/snapshots/webgl`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('webgl', 500, 500); - - const graph = nodeBuildIn({ - container, - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - }); - - graph.on('afterlayout', async () => { - const nodes = graph.getAllNodesData(); - - /** - * Time: 0 - */ - nodes.forEach(({ id }) => { - const node = graph['getItemById'](id); - node.animations.forEach((animation) => { - animation.currentTime = 0; - animation.pause(); - }); - }); - await expect(canvas).toMatchWebGLSnapshot( - dir, - 'animations-node-build-in-ready', - ); - - /** - * Time: 200 - */ - nodes.forEach(({ id }) => { - const node = graph['getItemById'](id); - node.animations.forEach((animation) => { - animation.currentTime = 200; - animation.pause(); - }); - }); - await expect(canvas).toMatchWebGLSnapshot( - dir, - 'animations-node-build-in-running', - ); - - /** - * Resume all animations. - */ - nodes.forEach(({ id }) => { - const node = graph['getItemById'](id); - node.animations.forEach((animation) => { - animation.play(); - }); - }); - - /** - * Time: finished - */ - await Promise.all( - nodes.map(async ({ id }) => { - const node = graph['getItemById'](id); - await Promise.all( - node.animations.map((animation) => animation.finished), - ); - }), - ); - await expect(canvas).toMatchWebGLSnapshot( - dir, - 'animations-node-build-in-finished', - ); - - graph.destroy(); - done(); - }); - }); -}); diff --git a/packages/g6/tests/bak/behaviors-activate-relations.spec.ts b/packages/g6/tests/bak/behaviors-activate-relations.spec.ts deleted file mode 100644 index 578700748a0..00000000000 --- a/packages/g6/tests/bak/behaviors-activate-relations.spec.ts +++ /dev/null @@ -1,125 +0,0 @@ -import { resetEntityCounter } from '@antv/g'; -import activateRelations from '../demo/behaviors/activate-relations'; -import { createContext, sleep } from './utils'; -import './utils/useSnapshotMatchers'; - -describe('Activate relations behavior', () => { - beforeEach(() => { - /** - * SVG Snapshot testing will generate a unique id for each element. - * Reset to 0 to keep snapshot consistent. - */ - resetEntityCounter(); - }); - - it('should be rendered correctly with Canvas2D', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); - - const graph = activateRelations({ - container, - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - }); - - graph.on('afterlayout', async () => { - await sleep(300); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'behaviors-activate-relations', - ); - - // @ts-ignore - // mouseEvent.target = canvas.getContextService().getDomElement(); - graph.emit('node:click', { itemId: 'node1', itemType: 'node' }); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'behaviors-activate-relations-activate-node1', - ); - - /** - * Click document to clear active state. - */ - graph.emit('canvas:click', {}); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'behaviors-activate-relations-deactivate-node1', - ); - - graph.destroy(); - done(); - }); - }); - - it('should be rendered correctly with SVG', (done) => { - const dir = `${__dirname}/snapshots/svg`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('svg', 500, 500); - - const graph = activateRelations({ - container, - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - }); - - graph.on('afterlayout', async () => { - await sleep(300); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'behaviors-activate-relations', - ); - graph.destroy(); - done(); - }); - }); - - it.skip('should be rendered correctly with WebGL', (done) => { - const dir = `${__dirname}/snapshots/webgl`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('webgl', 500, 500); - - const graph = activateRelations({ - container, - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - }); - - graph.on('afterlayout', async () => { - await sleep(300); - await expect(canvas).toMatchWebGLSnapshot( - dir, - 'behaviors-activate-relations', - ); - - triggerEvent(graph, 'mousedown', 81, 50); - triggerEvent(graph, 'mouseup', 81, 50); - await expect(canvas).toMatchWebGLSnapshot( - dir, - 'behaviors-activate-relations-activate-node1', - ); - - /** - * Click document to clear active state. - */ - triggerEvent(graph, 'mousedown', 0, 0); - triggerEvent(graph, 'mouseup', 0, 0); - await expect(canvas).toMatchWebGLSnapshot( - dir, - 'behaviors-activate-relations-deactivate-node1', - ); - - graph.destroy(); - done(); - }); - }); -}); diff --git a/packages/g6/tests/bak/behaviors-scroll-canvas.spec.ts b/packages/g6/tests/bak/behaviors-scroll-canvas.spec.ts deleted file mode 100644 index 2fe232a5f3b..00000000000 --- a/packages/g6/tests/bak/behaviors-scroll-canvas.spec.ts +++ /dev/null @@ -1,108 +0,0 @@ -import { resetEntityCounter } from '@antv/g'; -import scrollCanvas from '../demo/behaviors/scroll-canvas'; -import { createContext, triggerEvent } from './utils'; -import './utils/useSnapshotMatchers'; - -function sleep(time: number) { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve(null); - }, time); - }); -} -describe('Scroll canvas behavior', () => { - beforeEach(() => { - /** - * SVG Snapshot testing will generate a unique id for each element. - * Reset to 0 to keep snapshot consistent. - */ - resetEntityCounter(); - }); - - it('should be rendered correctly with Canvas2D', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); - - const graph = scrollCanvas({ - container, - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - }); - - graph.on('afterlayout', async () => { - await expect(canvas).toMatchSVGSnapshot(dir, 'behaviors-scroll-canvas'); - - graph.emit('wheel', { - deltaX: 50, - deltaY: 50, - }); - await sleep(2000); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'behaviors-scroll-canvas-wheel', - ); - - graph.emit('wheel', { - client: { x: 50, y: 50 }, - ctrlKey: true, - }); - - await sleep(2000); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'behaviors-scroll-canvas-zoom', - ); - - graph.destroy(); - done(); - }); - }); - - it('should be rendered correctly with SVG', (done) => { - const dir = `${__dirname}/snapshots/svg`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('svg', 500, 500); - - const graph = scrollCanvas({ - container, - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - }); - - graph.on('afterlayout', async () => { - await expect(canvas).toMatchSVGSnapshot(dir, 'behaviors-scroll-canvas'); - - graph.emit('wheel', { - deltaX: 50, - deltaY: 50, - }); - - await sleep(2000); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'behaviors-scroll-canvas-wheel', - ); - - graph.emit('wheel', { - client: { x: 50, y: 50 }, - ctrlKey: true, - }); - - await sleep(2000); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'behaviors-scroll-canvas-zoom', - ); - - graph.destroy(); - done(); - }); - }); -}); diff --git a/packages/g6/tests/bak/behaviors-shortcuts-call.spec.ts b/packages/g6/tests/bak/behaviors-shortcuts-call.spec.ts deleted file mode 100644 index 901caf28043..00000000000 --- a/packages/g6/tests/bak/behaviors-shortcuts-call.spec.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { resetEntityCounter } from '@antv/g'; -import ShortcutsCall from '../demo/behaviors/shortcuts-call'; -import { createContext, sleep } from './utils'; -import './utils/useSnapshotMatchers'; - -describe('Shortcuts-call behavior', () => { - beforeEach(() => { - /** - * SVG Snapshot testing will generate a unique id for each element. - * Reset to 0 to keep snapshot consistent. - */ - resetEntityCounter(); - }); - - it('should be rendered correctly with default options in Canvas2D', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); - - const graph = ShortcutsCall({ - container, - backgroundCanvas, - canvas, - transientCanvas, - }); - - graph.on('afterlayout', async () => { - await sleep(300); - await expect(canvas).toMatchSVGSnapshot(dir, 'behaviors-shortcuts-call'); - - // default behavior ctrl + 1 to fitView - graph.emit('keydown', { - key: 'control', - }); - graph.emit('keydown', { - key: '1', - }); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'behaviors-shortcuts-call-with-fitView', - ); - graph.destroy(); - done(); - }); - }); - it('should be rendered correctly with custom options in Canvas2D', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); - - const graph = ShortcutsCall( - { - container, - backgroundCanvas, - canvas, - transientCanvas, - }, - { - trigger: 'shift', - combinedKey: 'm', - functionName: 'zoomTo', - functionParams: [0.5], - }, - ); - - graph.on('afterlayout', async () => { - // shift + m to zoom to 0.5 - graph.emit('keydown', { - key: 'shift', - }); - graph.emit('keydown', { - key: 'm', - }); - await sleep(300); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'behaviors-shortcuts-call-with-zoom', - ); - graph.destroy(); - done(); - }); - }); - - it('should be rendered correctly with SVG', (done) => { - const dir = `${__dirname}/snapshots/svg`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('svg', 500, 500); - - const graph = ShortcutsCall({ - container, - backgroundCanvas, - canvas, - transientCanvas, - }); - - graph.on('afterlayout', async () => { - await sleep(300); - await expect(canvas).toMatchSVGSnapshot(dir, 'behaviors-shortcuts-call'); - graph.destroy(); - done(); - }); - }); -}); diff --git a/packages/g6/tests/bak/combo-render.spec.ts b/packages/g6/tests/bak/combo-render.spec.ts deleted file mode 100644 index 0d79c4910bd..00000000000 --- a/packages/g6/tests/bak/combo-render.spec.ts +++ /dev/null @@ -1,114 +0,0 @@ -import comboBasic from '../demo/combo/combo-basic'; -import './utils/useSnapshotMatchers'; -import { createContext, sleep } from './utils'; - -describe('combo circle', () => { - // TODO(FIXME): 本地能通过,线上不通过 - xit('circle combo should be rendered correctly with Canvas2D', (done) => { - const dir = `${__dirname}/snapshots/canvas/items/combo`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); - - const graph = comboBasic( - { - container, - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - }, - { - disableAnimate: true, - }, - ); - - graph.on('afterlayout', async () => { - await expect(canvas).toMatchSVGSnapshot(dir, 'combo-circle'); - //seleted state - graph.setItemState('combo1', 'selected', true); - await sleep(200); - await expect(canvas).toMatchSVGSnapshot(dir, 'combo-circle-selected'); - graph.collapseCombo('combo1'); - await sleep(200); - await expect(canvas).toMatchSVGSnapshot(dir, 'combo-circle-collapsed'); - graph.expandCombo('combo1'); - await sleep(200); - await expect(canvas).toMatchSVGSnapshot(dir, 'combo-circle-expand'); - graph.destroy(); - done(); - }); - }); - xit('rect combo should be rendered correctly with Canvas2D', (done) => { - const dir = `${__dirname}/snapshots/canvas/items/edge/line`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); - - const graph = comboBasic( - { - container, - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - }, - { - disableAnimate: true, - comboType: 'rect-combo', - }, - ); - - graph.on('afterlayout', async () => { - await expect(canvas).toMatchSVGSnapshot(dir, 'combo-rect'); - //seleted state - graph.setItemState('combo1', 'selected', true); - await sleep(200); - await expect(canvas).toMatchSVGSnapshot(dir, 'combo-rect-selected'); - graph.collapseCombo('combo1'); - await sleep(200); - await expect(canvas).toMatchSVGSnapshot(dir, 'combo-rect-collapsed'); - graph.expandCombo('combo1'); - await sleep(200); - await expect(canvas).toMatchSVGSnapshot(dir, 'combo-rect-expand'); - graph.destroy(); - done(); - }); - }); - - xit('circle combo should be rendered correctly with SVG', (done) => { - const dir = `${__dirname}/snapshots/svg/items/combo`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('svg', 500, 500); - - const graph = comboBasic( - { - container, - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - }, - { - disableAnimate: true, - }, - ); - - graph.on('afterlayout', async () => { - await expect(canvas).toMatchSVGSnapshot(dir, 'combo-circle'); - //seleted state - graph.setItemState('combo1', 'selected', true); - await sleep(200); - await expect(canvas).toMatchSVGSnapshot(dir, 'combo-circle-selected'); - graph.collapseCombo('combo1'); - await sleep(200); - await expect(canvas).toMatchSVGSnapshot(dir, 'combo-circle-collapsed'); - graph.expandCombo('combo1'); - await sleep(200); - await expect(canvas).toMatchSVGSnapshot(dir, 'combo-circle-expand'); - graph.destroy(); - done(); - }); - }); -}); diff --git a/packages/g6/tests/bak/items-node-donut.spec.ts b/packages/g6/tests/bak/items-node-donut.spec.ts deleted file mode 100644 index 0884d55cee5..00000000000 --- a/packages/g6/tests/bak/items-node-donut.spec.ts +++ /dev/null @@ -1,160 +0,0 @@ -import { resetEntityCounter } from '@antv/g'; -import donutNode from '../demo/item/node/donut-node'; -import './utils/useSnapshotMatchers'; -import { createContext, sleep } from './utils'; - -describe('Items node donut', () => { - beforeEach(() => { - /** - * SVG Snapshot testing will generate a unique id for each element. - * Reset to 0 to keep snapshot consistent. - */ - resetEntityCounter(); - }); - - it('should be rendered correctly with Canvas2D', (done) => { - const dir = `${__dirname}/snapshots/canvas/items/node/donut`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); - - const graph = donutNode({ - container, - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - }); - - graph.on('afterrender', async () => { - await sleep(1000); - await expect(canvas).toMatchSVGSnapshot(dir, 'items-node-donut'); - - /** - * Click the checkbox to set custom colors. - */ - const $customColors = document.querySelectorAll( - 'input', - )[0] as HTMLInputElement; - $customColors.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-node-donut-custom-colors', - ); - $customColors.click(); - - /** - * Click the checkbox to set custom inner size. - */ - const $innerSize = document.querySelectorAll( - 'input', - )[1] as HTMLInputElement; - $innerSize.click(); - await sleep(500); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-node-donut-custom-innersize', - ); - $innerSize.click(); - - /** - * Click the checkbox to update attrs. - */ - const $attrs = document.querySelectorAll('input')[2] as HTMLInputElement; - $attrs.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-node-donut-custom-attrs', - ); - $attrs.click(); - - /** - * Click the checkbox to set selected style. - */ - const $selected = document.querySelectorAll( - 'input', - )[3] as HTMLInputElement; - $selected.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-node-donut-selected-style', - ); - $selected.click(); - - graph.destroy(); - done(); - }); - }); - - it('should be rendered correctly with SVG', (done) => { - const dir = `${__dirname}/snapshots/svg/items/node/donut`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('svg', 500, 500); - - const graph = donutNode({ - container, - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - }); - - graph.on('afterlayout', async () => { - await expect(canvas).toMatchSVGSnapshot(dir, 'items-node-donut'); - /** - * Click the checkbox to set custom colors. - */ - const $customColors = document.querySelectorAll( - 'input', - )[0] as HTMLInputElement; - $customColors.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-node-donut-custom-colors', - ); - $customColors.click(); - - /** - * Click the checkbox to set custom inner size. - */ - const $innerSize = document.querySelectorAll( - 'input', - )[1] as HTMLInputElement; - $innerSize.click(); - await sleep(300); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-node-donut-custom-innersize', - ); - $innerSize.click(); - - /** - * Click the checkbox to update attrs. - */ - const $attrs = document.querySelectorAll('input')[2] as HTMLInputElement; - $attrs.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-node-donut-custom-attrs', - ); - $attrs.click(); - - /** - * Click the checkbox to set selected style. - */ - const $selected = document.querySelectorAll( - 'input', - )[3] as HTMLInputElement; - $selected.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-node-donut-selected-style', - ); - $selected.click(); - - graph.destroy(); - done(); - }); - }); -}); diff --git a/packages/g6/tests/bak/items-node-image.spec.ts b/packages/g6/tests/bak/items-node-image.spec.ts deleted file mode 100644 index 20aba75cf44..00000000000 --- a/packages/g6/tests/bak/items-node-image.spec.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { resetEntityCounter } from '@antv/g'; -import { loadImage } from 'canvas'; -import imageNode from '../demo/item/node/image'; -import './utils/useSnapshotMatchers'; -import { createContext } from './utils'; - -describe('Items node image', () => { - beforeEach(() => { - /** - * SVG Snapshot testing will generate a unique id for each element. - * Reset to 0 to keep snapshot consistent. - */ - resetEntityCounter(); - }); - - it('should be rendered correctly with Canvas2D', async () => { - const dir = `${__dirname}/snapshots/canvas/items/node/image`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); - - const src = await loadImage(__dirname + '/../assets/antv.png'); - - const graph = imageNode({ - container, - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - extendedParams: src as any, - }); - - await new Promise((resolve, reject) => { - graph.on('afterlayout', async () => { - await expect(canvas).toMatchSVGSnapshot(dir, 'items-node-image'); - graph.destroy(); - - resolve(undefined); - }); - }); - }); - - it('should be rendered correctly with SVG', async () => { - const dir = `${__dirname}/snapshots/svg/items/node/image`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('svg', 500, 500); - - const graph = imageNode({ - container, - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - }); - - await new Promise((resolve, reject) => { - graph.on('afterlayout', async () => { - await expect(canvas).toMatchSVGSnapshot(dir, 'items-node-image'); - graph.destroy(); - - resolve(undefined); - }); - }); - }); - - it.skip('should be rendered correctly with WebGL', async () => { - const dir = `${__dirname}/snapshots/webgl/items/node/image`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('webgl', 500, 500); - - const src = await loadImage(__dirname + '/../assets/antv.png'); - - const graph = imageNode({ - container, - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - extendedParams: src as any, - }); - - await new Promise((resolve, reject) => { - graph.on('afterlayout', async () => { - await expect(canvas).toMatchWebGLSnapshot(dir, 'items-node-image'); - graph.destroy(); - - resolve(undefined); - }); - }); - }); -}); diff --git a/packages/g6/tests/bak/timebar-timeline.spec.ts b/packages/g6/tests/bak/timebar-timeline.spec.ts deleted file mode 100644 index f292102560d..00000000000 --- a/packages/g6/tests/bak/timebar-timeline.spec.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { resetEntityCounter } from '@antv/g'; -import TimebarTime from '../demo/plugins/timebar-time'; -import { createContext, sleep } from './utils'; -import './utils/useSnapshotMatchers'; - -describe('Default Timebar', () => { - beforeEach(() => { - resetEntityCounter(); - }); - - it('should be rendered correctly with Canvas2D', (done) => { - const dir = `${__dirname}/snapshots/canvas/plugins/timebar`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); - const graph = TimebarTime({ - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - container, - }); - - graph.on('afterlayout', async () => { - await sleep(300); - await expect(canvas).toMatchSVGSnapshot(dir, 'plugins-timebar-timeline'); - graph.destroy(); - done(); - }); - }); -}); diff --git a/packages/g6/tests/bak/toolbar-default.spec.ts b/packages/g6/tests/bak/toolbar-default.spec.ts deleted file mode 100644 index 12ac9b08670..00000000000 --- a/packages/g6/tests/bak/toolbar-default.spec.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { resetEntityCounter } from '@antv/g'; -import toolbar from '../demo/plugins/toolbar'; -import { createContext } from './utils'; -import './utils/useSnapshotMatchers'; - -describe('Circular layout', () => { - beforeEach(() => { - /** - * SVG Snapshot testing will generate a unique id for each element. - * Reset to 0 to keep snapshot consistent. - */ - resetEntityCounter(); - }); - - it('should be rendered correctly with Canvas2D', (done) => { - const dir = `${__dirname}/snapshots/canvas/plugins/toolbar`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); - const graph = toolbar({ - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - container, - }); - - graph.on('afterlayout', async () => { - await expect(canvas).toMatchSVGSnapshot(dir, 'plugins-toolbar-default'); - graph.destroy(); - done(); - }); - }); - - // it.skip('should be rendered correctly with WebGL', (done) => { - // const dir = `${__dirname}/snapshots/webgl`; - // const { - // backgroundCanvas, - // canvas, - // transientCanvas, - // container, - // } = createContext('webgl', 500, 500); - - // const graph = toolbar({ - // container, - // backgroundCanvas, - // canvas, - // transientCanvas, - // width: 500, - // height: 500, - // }); - - // graph.on('afterlayout', async () => { - // await expect(canvas).toMatchWebGLSnapshot(dir, 'toolbar-default'); - // graph.destroy(); - // done(); - // }); - // }); -}); diff --git a/packages/g6/tests/bak/treegraph-render.spec.ts b/packages/g6/tests/bak/treegraph-render.spec.ts deleted file mode 100644 index 93b11ef990f..00000000000 --- a/packages/g6/tests/bak/treegraph-render.spec.ts +++ /dev/null @@ -1,200 +0,0 @@ -import { resetEntityCounter } from '@antv/g'; -import treeGraph from '../demo/tree/treeGraph'; -import { createContext, sleep } from './utils'; -import './utils/useSnapshotMatchers'; - -describe('TreeGraph', () => { - beforeEach(() => { - /** - * SVG Snapshot testing will generate a unique id for each element. - * Reset to 0 to keep snapshot consistent. - */ - resetEntityCounter(); - }); - - it('graph data with tree layout, remove/add/update node, and change layout', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); - - const graph = treeGraph( - { - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - container, - }, - { - dataType: 'graph', - layoutType: 'compactBox', - }, - ); - - (async () => { - await sleep(50); - await expect(canvas).toMatchSVGSnapshot(dir, 'treegraph-graphdata'); - - // ====== change to tree data ====== - const $changeData = document.getElementById('treegraph-changedata'); - $changeData.click(); - await sleep(500); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'treegraph-graphdata-changedata', - ); - - // ====== remove a node ====== - const $removeNode = document.getElementById('treegraph-removenode'); - $removeNode.click(); // remove - graph.layout(); - await sleep(500); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'treegraph-graphdata-removenode', - ); - - // ====== add a node ====== - $removeNode.click(); // add - graph.layout(); - await sleep(500); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'treegraph-graphdata-addnode', - ); - - // ====== update a node ====== - const $updateNode = document.getElementById('treegraph-updatenode'); - $updateNode.click(); // update label - await expect(canvas).toMatchSVGSnapshot( - dir, - 'treegraph-graphdata-udpatenode', - ); - - // ====== change to graph layout ====== - const $changeLayout = document.getElementById('treegraph-changelayout'); - $changeLayout.click(); - await sleep(500); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'treegraph-graphdata-changelayout', - ); - graph.destroy(); - })(); - done(); - }); - - it('should be rendered correctly with tree data', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); - - const graph = treeGraph( - { - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - container, - }, - { - dataType: 'tree', - layoutType: 'compactBox', - }, - ); - (async () => { - await sleep(100); - await expect(canvas).toMatchSVGSnapshot(dir, 'treegraph-treedata'); - - // ======= collapse ======= - const $collapse = document.getElementById('treegraph-collapse'); - $collapse.click(); // collapse - await sleep(500); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'treegraph-treedata-collapse', - ); - - // ======= expand ======= - $collapse.click(); // expand - await sleep(500); - await expect(canvas).toMatchSVGSnapshot(dir, 'treegraph-treedata-expand'); - - // ======= change layout ======= - const $changeLayout = document.getElementById('treegraph-changelayout'); - $changeLayout.click(); - await sleep(700); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'treegraph-treedata-changelayout', - ); - - graph.destroy(); - })(); - done(); - }); - - it('graph data with initiated collapsed', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); - - const graph = treeGraph( - { - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - container, - }, - { - dataType: 'graph', - layoutType: 'compactBox', - defaultCollapse: true, - }, - ); - (async () => { - await sleep(50); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'treegraph-graphdata-initial-collapse', - ); - graph.destroy(); - })(); - done(); - }); - - it('tree data with initiated collapsed', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); - - const graph = treeGraph( - { - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - container, - }, - { - dataType: 'tree', - layoutType: 'compactBox', - defaultCollapse: true, - }, - ); - (async () => { - await sleep(50); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'treegraph-treedata-initial-collapse', - ); - graph.destroy(); - })(); - done(); - }); -}); diff --git a/packages/g6/tests/demo/plugins/edgeFilterLens.ts b/packages/g6/tests/demo/plugins/edgeFilterLens.ts index af58c52502c..50d50c256bf 100644 --- a/packages/g6/tests/demo/plugins/edgeFilterLens.ts +++ b/packages/g6/tests/demo/plugins/edgeFilterLens.ts @@ -15,7 +15,7 @@ export default (context: TestCaseContext, options = {}) => { }; // ================= The DOMs for configurations =============== // - const graphDiv = document.getElementById('container'); + const graphDiv = context.container!; const buttonContainer = document.createElement('div'); buttonContainer.style.display = 'inline-block'; @@ -92,7 +92,7 @@ export default (context: TestCaseContext, options = {}) => { configScaleRBy.appendChild(scaleRByUnset); buttonContainer.appendChild(configScaleRBy); - graphDiv.parentNode.appendChild(buttonContainer); + graphDiv.parentNode!.appendChild(buttonContainer); // ========================================================= // diff --git a/packages/g6/tests/demo/tree/treeGraph.ts b/packages/g6/tests/demo/tree/treeGraph.ts index f29b86410fe..56f3853c168 100644 --- a/packages/g6/tests/demo/tree/treeGraph.ts +++ b/packages/g6/tests/demo/tree/treeGraph.ts @@ -42,40 +42,40 @@ export default ( data: { x, y, - animates: { - update: [ - { - fields: ['x', 'y'], - duration: 500, - shapeId: 'group', - order: 0, - }, - ], - hide: [ - { - fields: ['opacity'], - duration: 200, - shapeId: 'keyShape', - }, - { - fields: ['opacity'], - duration: 200, - shapeId: 'labelShape', - }, - ], - show: [ - { - fields: ['opacity'], - duration: 1000, - shapeId: 'keyShape', - }, - { - fields: ['opacity'], - duration: 1000, - shapeId: 'labelShape', - }, - ], - }, + // animates: { + // update: [ + // { + // fields: ['x', 'y'], + // duration: 500, + // shapeId: 'group', + // order: 0, + // }, + // ], + // hide: [ + // { + // fields: ['opacity'], + // duration: 200, + // shapeId: 'keyShape', + // }, + // { + // fields: ['opacity'], + // duration: 200, + // shapeId: 'labelShape', + // }, + // ], + // show: [ + // { + // fields: ['opacity'], + // duration: 1000, + // shapeId: 'keyShape', + // }, + // { + // fields: ['opacity'], + // duration: 1000, + // shapeId: 'labelShape', + // }, + // ], + // }, // animate in shapes, unrelated to each other, excuted parallely labelShape: { text: innerModel.id, @@ -89,32 +89,32 @@ export default ( ...innerModel, data: { ...innerModel.data, - animates: { - // hide: [ - // { - // fields: ['opacity'], - // duration: 200, - // shapeId: 'keyShape', - // }, - // { - // fields: ['opacity'], - // duration: 200, - // shapeId: 'labelShape', - // }, - // ], - // show: [ - // { - // fields: ['opacity'], - // duration: 1000, - // shapeId: 'keyShape', - // }, - // { - // fields: ['opacity'], - // duration: 1000, - // shapeId: 'labelShape', - // }, - // ], - }, + // animates: { + // hide: [ + // { + // fields: ['opacity'], + // duration: 200, + // shapeId: 'keyShape', + // }, + // { + // fields: ['opacity'], + // duration: 200, + // shapeId: 'labelShape', + // }, + // ], + // show: [ + // { + // fields: ['opacity'], + // duration: 1000, + // shapeId: 'keyShape', + // }, + // { + // fields: ['opacity'], + // duration: 1000, + // shapeId: 'labelShape', + // }, + // ], + // }, }, }; }, diff --git a/packages/g6/tests/integration/anchor.spec.ts b/packages/g6/tests/integration/anchor.spec.ts index 9e2d10a0040..afe4625dccd 100644 --- a/packages/g6/tests/integration/anchor.spec.ts +++ b/packages/g6/tests/integration/anchor.spec.ts @@ -33,12 +33,10 @@ describe('Anchor points and shapes', () => { ); graph.on('afterlayout', async () => { - try { - await expect(canvas).toMatchSVGSnapshot(dir, 'anchor-empty'); - } finally { - graph.destroy(); - done(); - } + await expect(canvas).toMatchSVGSnapshot(dir, 'anchor-empty'); + + graph.destroy(); + done(); }); }); @@ -75,26 +73,24 @@ describe('Anchor points and shapes', () => { ); graph.on('afterlayout', async () => { - try { - await expect(canvas).toMatchSVGSnapshot(dir, 'anchor-4-points'); - - // move node, edge find the nearset again - graph.updateData('node', { - id: 'node1', - data: { - x: 50, - y: 100, - }, - }); - - await expect(canvas).toMatchSVGSnapshot( - dir, - 'anchor-4-points-update-position', - ); - } finally { - graph.destroy(); - done(); - } + await expect(canvas).toMatchSVGSnapshot(dir, 'anchor-4-points'); + + // move node, edge find the nearset again + graph.updateData('node', { + id: 'node1', + data: { + x: 50, + y: 100, + }, + }); + + await expect(canvas).toMatchSVGSnapshot( + dir, + 'anchor-4-points-update-position', + ); + + graph.destroy(); + done(); }); }); @@ -131,20 +127,18 @@ describe('Anchor points and shapes', () => { ); graph.on('afterlayout', async () => { - try { - await expect(canvas).toMatchSVGSnapshot(dir, 'anchor-4-shapes'); - - graph.updateData('edge', { - id: 'edge1', - data: { - sourceAnchor: 1, - targetAnchor: 0, - }, - }); - } finally { - graph.destroy(); - done(); - } + await expect(canvas).toMatchSVGSnapshot(dir, 'anchor-4-shapes'); + + graph.updateData('edge', { + id: 'edge1', + data: { + sourceAnchor: 1, + targetAnchor: 0, + }, + }); + + graph.destroy(); + done(); }); }); }); diff --git a/packages/g6/tests/integration/animations-node-build-in.spec.ts b/packages/g6/tests/integration/animations-node-build-in.spec.ts new file mode 100644 index 00000000000..cf5fc92367a --- /dev/null +++ b/packages/g6/tests/integration/animations-node-build-in.spec.ts @@ -0,0 +1,92 @@ +import nodeBuildIn from '../demo/animations/node-build-in'; +import { createContext } from './utils'; +import './utils/useSnapshotMatchers'; + +const dir = `${__dirname}/snapshots/animations`; + +describe('Animation node buildIn', () => { + it('should be rendered correctly', (done) => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); + + const graph = nodeBuildIn({ + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + width: 500, + height: 500, + }); + + graph.on('afterlayout', async () => { + const nodes = graph.getAllNodesData(); + + /** + * Time: 0 + */ + nodes.forEach(({ id }) => { + const node = graph['getItemById'](id)!; + node.animations.forEach((animation) => { + animation.currentTime = 0; + animation.pause(); + }); + }); + await expect(canvas).toMatchSVGSnapshot( + dir, + 'animations-node-build-in-ready', + ); + + /** + * Time: 200 + */ + nodes.forEach(({ id }) => { + const node = graph['getItemById'](id)!; + node.animations.forEach((animation) => { + animation.currentTime = 200; + animation.pause(); + }); + }); + await expect(canvas).toMatchSVGSnapshot( + dir, + 'animations-node-build-in-running', + ); + + /** + * Resume all animations. + */ + nodes.forEach(({ id }) => { + const node = graph['getItemById'](id)!; + node.animations.forEach((animation) => { + animation.play(); + }); + }); + + /** + * Time: finished + */ + await Promise.all( + nodes.map(async ({ id }) => { + const node = graph['getItemById'](id)!; + await Promise.all( + node.animations.map((animation) => animation.finished), + ); + }), + ); + await expect(canvas).toMatchSVGSnapshot( + dir, + 'animations-node-build-in-finished', + ); + + graph.destroy(); + done(); + }); + }); +}); diff --git a/packages/g6/tests/bak/api-update-mapper.spec.ts b/packages/g6/tests/integration/api-update-mapper.spec.ts similarity index 79% rename from packages/g6/tests/bak/api-update-mapper.spec.ts rename to packages/g6/tests/integration/api-update-mapper.spec.ts index e38c66c7cfe..b2ef9db5b36 100644 --- a/packages/g6/tests/bak/api-update-mapper.spec.ts +++ b/packages/g6/tests/integration/api-update-mapper.spec.ts @@ -1,27 +1,27 @@ -import { resetEntityCounter } from '@antv/g'; import mapper from '../demo/visual/mapper'; import { createContext } from './utils'; import './utils/useSnapshotMatchers'; -describe('updateMapper API', () => { - beforeEach(() => { - /** - * SVG Snapshot testing will generate a unique id for each element. - * Reset to 0 to keep snapshot consistent. - */ - resetEntityCounter(); - }); +const dir = `${__dirname}/snapshots/api`; +describe('updateMapper API', () => { it('node and edge mapper update', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = mapper({ - container, backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, }); diff --git a/packages/g6/tests/integration/behaviors-activate-relations.spec.ts b/packages/g6/tests/integration/behaviors-activate-relations.spec.ts new file mode 100644 index 00000000000..1b369137026 --- /dev/null +++ b/packages/g6/tests/integration/behaviors-activate-relations.spec.ts @@ -0,0 +1,56 @@ +import activateRelations from '../demo/behaviors/activate-relations'; +import { createContext } from './utils'; +import './utils/useSnapshotMatchers'; + +const dir = `${__dirname}/snapshots/behaviors`; + +describe('Activate relations behavior', () => { + it('should be rendered correctly', (done) => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); + + const graph = activateRelations({ + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + width: 500, + height: 500, + }); + + graph.on('afterlayout', async () => { + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( + dir, + 'behaviors-activate-relations', + ); + + // @ts-ignore + // mouseEvent.target = canvas.getContextService().getDomElement(); + graph.emit('node:click', { itemId: 'node1', itemType: 'node' }); + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( + dir, + 'behaviors-activate-relations-activate-node1', + ); + + /** + * Click document to clear active state. + */ + graph.emit('canvas:click', {}); + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( + dir, + 'behaviors-activate-relations-deactivate-node1', + ); + + graph.destroy(); + done(); + }); + }); +}); diff --git a/packages/g6/tests/bak/behaviors-collapse-expand-tree.spec.ts b/packages/g6/tests/integration/behaviors-collapse-expand-tree.spec.ts similarity index 55% rename from packages/g6/tests/bak/behaviors-collapse-expand-tree.spec.ts rename to packages/g6/tests/integration/behaviors-collapse-expand-tree.spec.ts index 86a90ba5b02..3565d8b7e11 100644 --- a/packages/g6/tests/bak/behaviors-collapse-expand-tree.spec.ts +++ b/packages/g6/tests/integration/behaviors-collapse-expand-tree.spec.ts @@ -1,62 +1,60 @@ -import { resetEntityCounter } from '@antv/g'; import './utils/useSnapshotMatchers'; import collapseExpandTree from '../demo/behaviors/collapse-expand-tree'; -import { createContext, sleep } from './utils'; +import { createContext } from './utils'; -describe('Collapse or expand a branch', () => { - beforeEach(() => { - /** - * SVG Snapshot testing will generate a unique id for each element. - * Reset to 0 to keep snapshot consistent. - */ - resetEntityCounter(); - }); +const dir = `${__dirname}/snapshots/behaviors`; - it('should be rendered correctly with Canvas2D', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); +describe('Collapse or expand a branch', () => { + it('should be rendered correctly', (done) => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = collapseExpandTree({ - container, backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, }); graph.on('afterrender', async (e) => { - await sleep(100); - await expect(canvas).toMatchSVGSnapshot(dir, 'behaviors-collapse-expand'); + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( + dir, + 'behaviors-collapse-expand', + ); // collapse child branch graph.emit('node:click', { itemId: 'cnode1', itemType: 'node' }); - await sleep(800); - await expect(canvas).toMatchSVGSnapshot( + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( dir, 'behaviors-collapse-expand-collapse-cnode1', ); // collapse parent branch graph.emit('node:click', { itemId: 'node1', itemType: 'node' }); - await sleep(800); - await expect(canvas).toMatchSVGSnapshot( + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( dir, 'behaviors-collapse-expand-collapse-node1', ); // expand parent branch graph.emit('node:click', { itemId: 'node1', itemType: 'node' }); - await sleep(1000); - await expect(canvas).toMatchSVGSnapshot( + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( dir, 'behaviors-collapse-expand-expand-node1', ); // expand child branch graph.emit('node:click', { itemId: 'cnode1', itemType: 'node' }); - await sleep(1000); - await expect(canvas).toMatchSVGSnapshot( + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( dir, 'behaviors-collapse-expand-expand-cnode1', ); diff --git a/packages/g6/tests/bak/behaviors-create-edge.spec.ts b/packages/g6/tests/integration/behaviors-create-edge.spec.ts similarity index 55% rename from packages/g6/tests/bak/behaviors-create-edge.spec.ts rename to packages/g6/tests/integration/behaviors-create-edge.spec.ts index 8bb38c4d61e..65ce02651bd 100644 --- a/packages/g6/tests/bak/behaviors-create-edge.spec.ts +++ b/packages/g6/tests/integration/behaviors-create-edge.spec.ts @@ -1,28 +1,28 @@ -import { resetEntityCounter } from '@antv/g'; import createEdge from '../demo/behaviors/create-edge'; import { createContext } from './utils'; import './utils/useSnapshotMatchers'; -describe('Create edge behavior', () => { - beforeEach(() => { - /** - * SVG Snapshot testing will generate a unique id for each element. - * Reset to 0 to keep snapshot consistent. - */ - resetEntityCounter(); - }); +const dir = `${__dirname}/snapshots/behaviors`; - it('trigger click should be rendered correctly with Canvas2D', (done) => { - const dir = `${__dirname}/snapshots/canvas/behaviors`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); +describe('Create edge behavior', () => { + it('trigger click should be rendered correctly', (done) => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = createEdge( { - container, backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, }, @@ -41,7 +41,7 @@ describe('Create edge behavior', () => { canvas: { x: 100, y: 100 }, }); graph.emit('pointermove', { canvas: { x: 100, y: 100 } }); - await expect(canvas).toMatchSVGSnapshot( + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( dir, 'behaviors-create-edge-click-begin', ); @@ -51,7 +51,7 @@ describe('Create edge behavior', () => { itemType: 'node', canvas: { x: 100, y: 100 }, }); - await expect(canvas).toMatchSVGSnapshot( + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( dir, 'behaviors-create-edge-click-finish', ); @@ -66,7 +66,7 @@ describe('Create edge behavior', () => { itemType: 'node', canvas: { x: 100, y: 100 }, }); - await expect(canvas).toMatchSVGSnapshot( + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( dir, 'behaviors-create-edge-click-loop', ); @@ -76,17 +76,24 @@ describe('Create edge behavior', () => { }); }); - it('trigger drag should be rendered correctly with Canvas2D', (done) => { - const dir = `${__dirname}/snapshots/canvas/behaviors`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); + it('trigger drag should be rendered correctly', (done) => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = createEdge( { - container, backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, }, @@ -103,7 +110,7 @@ describe('Create edge behavior', () => { canvas: { x: 100, y: 100 }, }); graph.emit('drag', { canvas: { x: 100, y: 100 } }); - await expect(canvas).toMatchSVGSnapshot( + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( dir, 'behaviors-create-edge-drag-begin', ); @@ -114,7 +121,7 @@ describe('Create edge behavior', () => { itemType: 'node', canvas: { x: nodeModel?.data.x, y: nodeModel?.data.y }, }); - await expect(canvas).toMatchSVGSnapshot( + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( dir, 'behaviors-create-edge-drag-finish', ); @@ -131,7 +138,7 @@ describe('Create edge behavior', () => { itemType: 'node', canvas: { x: node5Model?.data.x, y: node5Model?.data.y }, }); - await expect(canvas).toMatchSVGSnapshot( + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( dir, 'behaviors-create-edge-drag-loop', ); @@ -140,53 +147,4 @@ describe('Create edge behavior', () => { done(); }); }); - - it('should be rendered correctly with SVG', (done) => { - const dir = `${__dirname}/snapshots/svg/behaviors`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('svg', 500, 500); - - const graph = createEdge( - { - container, - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - }, - { - trigger: 'click', - edgeConfig: { keyShape: { stroke: '#f00' } }, - createVirtualEventName: 'begincreate', - cancelCreateEventName: 'cancelcreate', - }, - ); - - graph.on('afterlayout', async () => { - graph.emit('node:click', { - itemId: 'node5', - itemType: 'node', - canvas: { x: 100, y: 100 }, - }); - graph.emit('pointermove', { canvas: { x: 100, y: 100 } }); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'behaviors-create-edge-click-begin', - ); - - graph.emit('node:click', { - itemId: 'node2', - itemType: 'node', - canvas: { x: 100, y: 100 }, - }); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'behaviors-create-edge-click-finish', - ); - - graph.destroy(); - done(); - }); - }); }); diff --git a/packages/g6/tests/integration/behaviors-scroll-canvas.spec.ts b/packages/g6/tests/integration/behaviors-scroll-canvas.spec.ts new file mode 100644 index 00000000000..01f5cd1a66f --- /dev/null +++ b/packages/g6/tests/integration/behaviors-scroll-canvas.spec.ts @@ -0,0 +1,56 @@ +import scrollCanvas from '../demo/behaviors/scroll-canvas'; +import { createContext } from './utils'; +import './utils/useSnapshotMatchers'; + +const dir = `${__dirname}/snapshots/behaivors`; + +describe('Scroll canvas behavior', () => { + it('should be rendered correctly', (done) => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); + + const graph = scrollCanvas({ + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + width: 500, + height: 500, + }); + + graph.on('afterlayout', async () => { + await expect(canvas).toMatchSVGSnapshot(dir, 'behaviors-scroll-canvas'); + + graph.emit('wheel', { + deltaX: 50, + deltaY: 50, + }); + + await expect(canvas).toMatchSVGSnapshot( + dir, + 'behaviors-scroll-canvas-wheel', + ); + + graph.emit('wheel', { + client: { x: 50, y: 50 }, + ctrlKey: true, + }); + + await expect(canvas).toMatchSVGSnapshot( + dir, + 'behaviors-scroll-canvas-zoom', + ); + + graph.destroy(); + done(); + }); + }); +}); diff --git a/packages/g6/tests/integration/behaviors-shortcuts-call.spec.ts b/packages/g6/tests/integration/behaviors-shortcuts-call.spec.ts new file mode 100644 index 00000000000..456a35ca566 --- /dev/null +++ b/packages/g6/tests/integration/behaviors-shortcuts-call.spec.ts @@ -0,0 +1,92 @@ +import ShortcutsCall from '../demo/behaviors/shortcuts-call'; +import { createContext } from './utils'; +import './utils/useSnapshotMatchers'; + +const dir = `${__dirname}/snapshots/behaviors`; + +describe('Shortcuts-call behavior', () => { + it('should be rendered correctly with default options', (done) => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); + + const graph = ShortcutsCall({ + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + }); + + graph.on('afterlayout', async () => { + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( + dir, + 'behaviors-shortcuts-call', + ); + + // default behavior ctrl + 1 to fitView + graph.emit('keydown', { + key: 'control', + }); + graph.emit('keydown', { + key: '1', + }); + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( + dir, + 'behaviors-shortcuts-call-with-fitView', + ); + graph.destroy(); + done(); + }); + }); + + it('should be rendered correctly with custom options', (done) => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); + + const graph = ShortcutsCall( + { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + }, + { + trigger: 'shift', + combinedKey: 'm', + functionName: 'zoomTo', + functionParams: [0.5], + }, + ); + + graph.on('afterlayout', async () => { + // shift + m to zoom to 0.5 + graph.emit('keydown', { + key: 'shift', + }); + graph.emit('keydown', { + key: 'm', + }); + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( + dir, + 'behaviors-shortcuts-call-with-zoom', + ); + graph.destroy(); + done(); + }); + }); +}); diff --git a/packages/g6/tests/integration/combo-render.spec.ts b/packages/g6/tests/integration/combo-render.spec.ts new file mode 100644 index 00000000000..29105f87989 --- /dev/null +++ b/packages/g6/tests/integration/combo-render.spec.ts @@ -0,0 +1,96 @@ +import comboBasic from '../demo/combo/combo-basic'; +import './utils/useSnapshotMatchers'; +import { createContext } from './utils'; + +const dir = `${__dirname}/snapshots/items/combo`; + +describe('combo circle', () => { + it('circle combo should be rendered correctly', (done) => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); + + const graph = comboBasic( + { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + width: 500, + height: 500, + }, + { + disableAnimate: true, + }, + ); + + graph.on('afterlayout', async () => { + await expect(canvas).toMatchSVGSnapshot(dir, 'combo-circle'); + //seleted state + graph.setItemState('combo1', 'selected', true); + + await expect(canvas).toMatchSVGSnapshot(dir, 'combo-circle-selected'); + graph.collapseCombo('combo1'); + + await expect(canvas).toMatchSVGSnapshot(dir, 'combo-circle-collapsed'); + graph.expandCombo('combo1'); + + await expect(canvas).toMatchSVGSnapshot(dir, 'combo-circle-expand'); + + graph.destroy(); + done(); + }); + }); + + it('rect combo should be rendered correctly with Canvas2D', (done) => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); + + const graph = comboBasic( + { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + width: 500, + height: 500, + }, + { + disableAnimate: true, + comboType: 'rect-combo', + }, + ); + + graph.on('afterlayout', async () => { + await expect(canvas).toMatchSVGSnapshot(dir, 'combo-rect'); + //seleted state + graph.setItemState('combo1', 'selected', true); + + await expect(canvas).toMatchSVGSnapshot(dir, 'combo-rect-selected'); + graph.collapseCombo('combo1'); + + await expect(canvas).toMatchSVGSnapshot(dir, 'combo-rect-collapsed'); + graph.expandCombo('combo1'); + + await expect(canvas).toMatchSVGSnapshot(dir, 'combo-rect-expand'); + + graph.destroy(); + done(); + }); + }); +}); diff --git a/packages/g6/tests/bak/data-process-parallel-edges.spec.ts b/packages/g6/tests/integration/data-process-parallel-edges.spec.ts similarity index 57% rename from packages/g6/tests/bak/data-process-parallel-edges.spec.ts rename to packages/g6/tests/integration/data-process-parallel-edges.spec.ts index 79ae686f74c..bcd6f7a444a 100644 --- a/packages/g6/tests/bak/data-process-parallel-edges.spec.ts +++ b/packages/g6/tests/integration/data-process-parallel-edges.spec.ts @@ -1,28 +1,28 @@ -import { resetEntityCounter } from '@antv/g'; import processParallelEdges from '../demo/data/process-parallel-edges'; import { EdgeUserModel } from '../../src'; -import { createContext, sleep } from './utils'; +import { createContext } from './utils'; import './utils/useSnapshotMatchers'; -describe('Process parallel edges', () => { - beforeEach(() => { - /** - * SVG Snapshot testing will generate a unique id for each element. - * Reset to 0 to keep snapshot consistent. - */ - resetEntityCounter(); - }); +const dir = `${__dirname}/snapshots/data-parallel`; +describe('Process parallel edges', () => { it('should be rendered correctly with Canvas2D', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = processParallelEdges({ - container, backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, }); @@ -85,53 +85,4 @@ describe('Process parallel edges', () => { done(); }); }); - - it('should be rendered correctly with SVG', (done) => { - const dir = `${__dirname}/snapshots/svg`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('svg', 500, 500); - - const graph = processParallelEdges({ - container, - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - }); - - graph.on('afterlayout', async () => { - await expect(canvas).toMatchSVGSnapshot( - dir, - 'data-parallel-edges-quadratic', - ); - - graph.destroy(); - done(); - }); - }); - - it.skip('should be rendered correctly with WebGL', (done) => { - const dir = `${__dirname}/snapshots/webgl`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('webgl', 500, 500); - - const graph = processParallelEdges({ - container, - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - }); - - graph.on('afterlayout', async () => { - await expect(canvas).toMatchWebGLSnapshot( - dir, - 'data-parallel-edges-quadratic', - ); - graph.destroy(); - done(); - }); - }); }); diff --git a/packages/g6/tests/bak/data-validate.spec.ts b/packages/g6/tests/integration/data-validate.spec.ts similarity index 65% rename from packages/g6/tests/bak/data-validate.spec.ts rename to packages/g6/tests/integration/data-validate.spec.ts index 0f9c758d3cd..8ad8d07f863 100644 --- a/packages/g6/tests/bak/data-validate.spec.ts +++ b/packages/g6/tests/integration/data-validate.spec.ts @@ -1,31 +1,30 @@ -import { resetEntityCounter } from '@antv/g'; -import treeGraph from '../demo/tree/treeGraph'; -import { createContext, sleep } from './utils'; +import { createContext } from './utils'; import './utils/useSnapshotMatchers'; import dataValidate from '../demo/data/data-validate'; -describe('TreeGraph', () => { - beforeEach(() => { - /** - * SVG Snapshot testing will generate a unique id for each element. - * Reset to 0 to keep snapshot consistent. - */ - resetEntityCounter(); - }); +const dir = `${__dirname}/snapshots/data`; +describe('TreeGraph', () => { it('data with error DUPLICATE_NODE_ID', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = dataValidate( { backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, - container, }, { errorType: 'DUPLICATE_NODE_ID', @@ -37,22 +36,32 @@ describe('TreeGraph', () => { dir, 'data-validate-duplicate-node-id', ); + + graph.destroy(); done(); }); }); + it('data with error DUPLICATE_NODE_EDGE_ID', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = dataValidate( { backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, - container, }, { errorType: 'DUPLICATE_NODE_EDGE_ID', @@ -64,22 +73,32 @@ describe('TreeGraph', () => { dir, 'data-validate-duplicate-node-edge-id', ); + + graph.destroy(); done(); }); }); + it('data with error NODE_NO_DATA', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = dataValidate( { backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, - container, }, { errorType: 'NODE_NO_DATA', @@ -91,22 +110,32 @@ describe('TreeGraph', () => { dir, 'data-validate-node-no-data', ); + + graph.destroy(); done(); }); }); + it('data with error NODE_NO_ID', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = dataValidate( { backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, - container, }, { errorType: 'NODE_NO_ID', @@ -115,22 +144,32 @@ describe('TreeGraph', () => { graph.on('afterlayout', async () => { await expect(canvas).toMatchSVGSnapshot(dir, 'data-validate-node-no-id'); + + graph.destroy(); done(); }); }); + it('data with error EDGE_NO_ID', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = dataValidate( { backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, - container, }, { errorType: 'EDGE_NO_ID', @@ -139,22 +178,31 @@ describe('TreeGraph', () => { graph.on('afterlayout', async () => { await expect(canvas).toMatchSVGSnapshot(dir, 'data-validate-edge-no-id'); + + graph.destroy(); done(); }); }); it('data with error NODE_PARENT_NOT_EXIST', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = dataValidate( { backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, - container, }, { errorType: 'NODE_PARENT_NOT_EXIST', @@ -166,22 +214,32 @@ describe('TreeGraph', () => { dir, 'data-validate-node-parent-not-exist', ); + + graph.destroy(); done(); }); }); + it('data with error EDGE_SOURCE_NOT_EXIST', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = dataValidate( { backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, - container, }, { errorType: 'EDGE_SOURCE_NOT_EXIST', @@ -193,22 +251,32 @@ describe('TreeGraph', () => { dir, 'data-validate-edge-source-not-exist', ); + + graph.destroy(); done(); }); }); + it('data with error EDGE_NO_SOURCE', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = dataValidate( { backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, - container, }, { errorType: 'EDGE_NO_SOURCE', @@ -220,22 +288,32 @@ describe('TreeGraph', () => { dir, 'data-validate-edge-no-source', ); + + graph.destroy(); done(); }); }); + it('data with error COMBO_NO_ID', (done) => { - const dir = `${__dirname}/snapshots/canvas`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = dataValidate( { backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, - container, }, { errorType: 'COMBO_NO_ID', @@ -243,8 +321,9 @@ describe('TreeGraph', () => { ); graph.on('afterlayout', async () => { - await sleep(300); await expect(canvas).toMatchSVGSnapshot(dir, 'data-validate-combo-no-id'); + + graph.destroy(); done(); }); }); diff --git a/packages/g6/tests/integration/items-edge-arrow.spec.ts b/packages/g6/tests/integration/items-edge-arrow.spec.ts index 4f8918b73c5..27a8d3402cb 100644 --- a/packages/g6/tests/integration/items-edge-arrow.spec.ts +++ b/packages/g6/tests/integration/items-edge-arrow.spec.ts @@ -33,54 +33,49 @@ describe('Edge start arrow', () => { ); graph.on('afterlayout', async () => { - try { - await expect(canvas).toMatchSVGSnapshot(dir, 'arrow-end'); + await expect(canvas).toMatchSVGSnapshot(dir, 'arrow-end'); - const $typeBtn = document.getElementById( - 'arrow-change-type', - ) as HTMLInputElement; - $typeBtn.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'arrow-end-change-type-circle', - ); + const $typeBtn = document.getElementById( + 'arrow-change-type', + ) as HTMLInputElement; + $typeBtn.click(); + await expect(canvas).toMatchSVGSnapshot( + dir, + 'arrow-end-change-type-circle', + ); - $typeBtn.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'arrow-end-change-type-rect', - ); + $typeBtn.click(); + await expect(canvas).toMatchSVGSnapshot( + dir, + 'arrow-end-change-type-rect', + ); - $typeBtn.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'arrow-end-change-type-diamond', - ); + $typeBtn.click(); + await expect(canvas).toMatchSVGSnapshot( + dir, + 'arrow-end-change-type-diamond', + ); - $typeBtn.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'arrow-end-change-type-vee', - ); + $typeBtn.click(); + await expect(canvas).toMatchSVGSnapshot(dir, 'arrow-end-change-type-vee'); - const $colorBtn = document.getElementById( - 'arrow-change-color', - ) as HTMLInputElement; - $colorBtn.click(); - await expect(canvas).toMatchSVGSnapshot(dir, 'arrow-end-change-color'); + const $colorBtn = document.getElementById( + 'arrow-change-color', + ) as HTMLInputElement; + $colorBtn.click(); + await expect(canvas).toMatchSVGSnapshot(dir, 'arrow-end-change-color'); - const $removeBtn = document.getElementById( - 'arrow-remove', - ) as HTMLInputElement; - $removeBtn.click(); - await expect(canvas).toMatchSVGSnapshot(dir, 'arrow-end-remove'); + const $removeBtn = document.getElementById( + 'arrow-remove', + ) as HTMLInputElement; + $removeBtn.click(); + await expect(canvas).toMatchSVGSnapshot(dir, 'arrow-end-remove'); - $removeBtn.click(); - await expect(canvas).toMatchSVGSnapshot(dir, 'arrow-end-add'); - } finally { - graph.destroy(); - done(); - } + $removeBtn.click(); + await expect(canvas).toMatchSVGSnapshot(dir, 'arrow-end-add'); + + graph.destroy(); + done(); }); }); @@ -112,12 +107,9 @@ describe('Edge start arrow', () => { ); graph.on('afterlayout', async () => { - try { - await expect(canvas).toMatchSVGSnapshot(dir, 'arrow-start'); - } finally { - graph.destroy(); - done(); - } + await expect(canvas).toMatchSVGSnapshot(dir, 'arrow-start'); + graph.destroy(); + done(); }); }); }); diff --git a/packages/g6/tests/integration/items-edge-line.spec.ts b/packages/g6/tests/integration/items-edge-line.spec.ts index 158a68823ee..9027abb2d40 100644 --- a/packages/g6/tests/integration/items-edge-line.spec.ts +++ b/packages/g6/tests/integration/items-edge-line.spec.ts @@ -27,51 +27,49 @@ describe('Items edge line', () => { }); graph.on('afterlayout', async () => { - try { - await expect(canvas).toMatchSVGSnapshot(dir, 'items-edge-line'); + await expect(canvas).toMatchSVGSnapshot(dir, 'items-edge-line'); - /** - * Click the checkbox to show label. - */ - const $showLabel = document.querySelectorAll( - 'input', - )[0] as HTMLInputElement; - $showLabel.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-edge-line-show-label', - ); - $showLabel.click(); + /** + * Click the checkbox to show label. + */ + const $showLabel = document.querySelectorAll( + 'input', + )[0] as HTMLInputElement; + $showLabel.click(); + await expect(canvas).toMatchSVGSnapshot( + dir, + 'items-edge-line-show-label', + ); + $showLabel.click(); - /** - * Click the checkbox to display selected style. - */ - const $selected = document.querySelectorAll( - 'input', - )[2] as HTMLInputElement; - $selected.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-edge-line-selected-style', - ); - $selected.click(); + /** + * Click the checkbox to display selected style. + */ + const $selected = document.querySelectorAll( + 'input', + )[2] as HTMLInputElement; + $selected.click(); + await expect(canvas).toMatchSVGSnapshot( + dir, + 'items-edge-line-selected-style', + ); + $selected.click(); - /** - * Click the checkbox to highlight. - */ - const $highlight = document.querySelectorAll( - 'input', - )[3] as HTMLInputElement; - $highlight.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-edge-line-highlight-style', - ); - $highlight.click(); - } finally { - graph.destroy(); - done(); - } + /** + * Click the checkbox to highlight. + */ + const $highlight = document.querySelectorAll( + 'input', + )[3] as HTMLInputElement; + $highlight.click(); + await expect(canvas).toMatchSVGSnapshot( + dir, + 'items-edge-line-highlight-style', + ); + $highlight.click(); + + graph.destroy(); + done(); }); }); }); diff --git a/packages/g6/tests/integration/items-edge-loop.spec.ts b/packages/g6/tests/integration/items-edge-loop.spec.ts index 64f3e3fb984..219fd99398b 100644 --- a/packages/g6/tests/integration/items-edge-loop.spec.ts +++ b/packages/g6/tests/integration/items-edge-loop.spec.ts @@ -27,70 +27,56 @@ describe('Items edge line', () => { }); graph.on('afterlayout', async () => { - try { - await expect(canvas).toMatchSVGSnapshot(dir, 'items-edge-loop'); + await expect(canvas).toMatchSVGSnapshot(dir, 'items-edge-loop'); - /** - * Click the checkbox to switch clockwise. - */ - const $switchClockwise = document.querySelectorAll( - 'input', - )[0] as HTMLInputElement; - $switchClockwise.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-edge-loop-clockwise', - ); - $switchClockwise.click(); + /** + * Click the checkbox to switch clockwise. + */ + const $switchClockwise = document.querySelectorAll( + 'input', + )[0] as HTMLInputElement; + $switchClockwise.click(); + await expect(canvas).toMatchSVGSnapshot(dir, 'items-edge-loop-clockwise'); + $switchClockwise.click(); - /** - * Click the checkbox to set custom distance. - */ - const $dist = document.querySelectorAll('input')[1] as HTMLInputElement; - $dist.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-edge-loop-distance', - ); - $dist.click(); + /** + * Click the checkbox to set custom distance. + */ + const $dist = document.querySelectorAll('input')[1] as HTMLInputElement; + $dist.click(); + await expect(canvas).toMatchSVGSnapshot(dir, 'items-edge-loop-distance'); + $dist.click(); - /** - * Click the button to change loop position. - */ - const $loopPositionBtn = document.querySelectorAll( - 'button', - )[0] as HTMLButtonElement; - $loopPositionBtn.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-edge-loop-top-right', - ); - $loopPositionBtn.click(); - await expect(canvas).toMatchSVGSnapshot(dir, 'items-edge-loop-right'); - $loopPositionBtn.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-edge-loop-bottom-right', - ); - $loopPositionBtn.click(); - await expect(canvas).toMatchSVGSnapshot(dir, 'items-edge-loop-bottom'); - $loopPositionBtn.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-edge-loop-bottom-left', - ); - $loopPositionBtn.click(); - await expect(canvas).toMatchSVGSnapshot(dir, 'items-edge-loop-left'); - $loopPositionBtn.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-edge-loop-top-left', - ); - $loopPositionBtn.click(); - } finally { - graph.destroy(); - done(); - } + /** + * Click the button to change loop position. + */ + const $loopPositionBtn = document.querySelectorAll( + 'button', + )[0] as HTMLButtonElement; + $loopPositionBtn.click(); + await expect(canvas).toMatchSVGSnapshot(dir, 'items-edge-loop-top-right'); + $loopPositionBtn.click(); + await expect(canvas).toMatchSVGSnapshot(dir, 'items-edge-loop-right'); + $loopPositionBtn.click(); + await expect(canvas).toMatchSVGSnapshot( + dir, + 'items-edge-loop-bottom-right', + ); + $loopPositionBtn.click(); + await expect(canvas).toMatchSVGSnapshot(dir, 'items-edge-loop-bottom'); + $loopPositionBtn.click(); + await expect(canvas).toMatchSVGSnapshot( + dir, + 'items-edge-loop-bottom-left', + ); + $loopPositionBtn.click(); + await expect(canvas).toMatchSVGSnapshot(dir, 'items-edge-loop-left'); + $loopPositionBtn.click(); + await expect(canvas).toMatchSVGSnapshot(dir, 'items-edge-loop-top-left'); + $loopPositionBtn.click(); + + graph.destroy(); + done(); }); }); }); diff --git a/packages/g6/tests/integration/items-edge-polyline.spec.ts b/packages/g6/tests/integration/items-edge-polyline.spec.ts index 60b513b4df2..344b3c1f173 100644 --- a/packages/g6/tests/integration/items-edge-polyline.spec.ts +++ b/packages/g6/tests/integration/items-edge-polyline.spec.ts @@ -27,96 +27,92 @@ describe('Items edge polyline', () => { }); graph.on('afterlayout', async () => { - try { - await expect(canvas).toMatchSVGSnapshot(dir, 'items-edge-polyline'); + await expect(canvas).toMatchSVGSnapshot(dir, 'items-edge-polyline'); - /** - * Click the checkbox to show label. - */ - const $showLabel = document.querySelectorAll( - 'input', - )[0] as HTMLInputElement; - $showLabel.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-edge-polyline-show-label', - ); - $showLabel.click(); + /** + * Click the checkbox to show label. + */ + const $showLabel = document.querySelectorAll( + 'input', + )[0] as HTMLInputElement; + $showLabel.click(); + await expect(canvas).toMatchSVGSnapshot( + dir, + 'items-edge-polyline-show-label', + ); + $showLabel.click(); - /** - * Click the checkbox to display selected style. - */ - const $selected = document.querySelectorAll( - 'input', - )[2] as HTMLInputElement; - $selected.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-edge-polyline-selected-style', - ); - $selected.click(); + /** + * Click the checkbox to display selected style. + */ + const $selected = document.querySelectorAll( + 'input', + )[2] as HTMLInputElement; + $selected.click(); + await expect(canvas).toMatchSVGSnapshot( + dir, + 'items-edge-polyline-selected-style', + ); + $selected.click(); - /** - * Click the checkbox to highlight. - */ - const $highlight = document.querySelectorAll( - 'input', - )[3] as HTMLInputElement; - $highlight.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-edge-polyline-highlight-style', - ); - $highlight.click(); + /** + * Click the checkbox to highlight. + */ + const $highlight = document.querySelectorAll( + 'input', + )[3] as HTMLInputElement; + $highlight.click(); + await expect(canvas).toMatchSVGSnapshot( + dir, + 'items-edge-polyline-highlight-style', + ); + $highlight.click(); - /** - * Click the checkbox to add border radius. - */ - const $radius = document.querySelectorAll( - 'input', - )[4] as HTMLInputElement; - $radius.click(); - await expect(canvas).toMatchSVGSnapshot( - dir, - 'items-edge-polyline-radius', - ); - $radius.click(); + /** + * Click the checkbox to add border radius. + */ + const $radius = document.querySelectorAll('input')[4] as HTMLInputElement; + $radius.click(); + await expect(canvas).toMatchSVGSnapshot( + dir, + 'items-edge-polyline-radius', + ); + $radius.click(); - /** - * Click the checkbox to enable automatic obstacle avoidances. - */ - const $obstacle = document.querySelectorAll( - 'input', - )[5] as HTMLInputElement; - const $enableObstacleAvoidance = document.querySelectorAll( - 'input', - )[6] as HTMLInputElement; + /** + * Click the checkbox to enable automatic obstacle avoidances. + */ + const $obstacle = document.querySelectorAll( + 'input', + )[5] as HTMLInputElement; + const $enableObstacleAvoidance = document.querySelectorAll( + 'input', + )[6] as HTMLInputElement; - /** - * Click the checkbox to prevent obstacle to overlap edges. - */ - // const $preventObstacleOverlapEdges = document.querySelectorAll( - // 'input', - // )[7] as HTMLInputElement; - // const $moveObstacle = document.querySelectorAll( - // 'input', - // )[8] as HTMLInputElement; - // $obstacle.click(); - // $enableObstacleAvoidance.click(); - // $preventObstacleOverlapEdges.click(); - // $moveObstacle.click(); - // await expect(canvas).toMatchSVGSnapshot( - // dir, - // 'items-edge-polyline-prevent-overlap-edges', - // ); - // $obstacle.click(); - // $enableObstacleAvoidance.click(); - // $preventObstacleOverlapEdges.click(); - // $moveObstacle.click(); - } finally { - graph.destroy(); - done(); - } + /** + * Click the checkbox to prevent obstacle to overlap edges. + */ + // const $preventObstacleOverlapEdges = document.querySelectorAll( + // 'input', + // )[7] as HTMLInputElement; + // const $moveObstacle = document.querySelectorAll( + // 'input', + // )[8] as HTMLInputElement; + // $obstacle.click(); + // $enableObstacleAvoidance.click(); + // $preventObstacleOverlapEdges.click(); + // $moveObstacle.click(); + // await expect(canvas).toMatchSVGSnapshot( + // dir, + // 'items-edge-polyline-prevent-overlap-edges', + // ); + // $obstacle.click(); + // $enableObstacleAvoidance.click(); + // $preventObstacleOverlapEdges.click(); + // $moveObstacle.click(); + + graph.destroy(); + done(); }); }); }); diff --git a/packages/g6/tests/integration/items-node-donut.spec.ts b/packages/g6/tests/integration/items-node-donut.spec.ts new file mode 100644 index 00000000000..0096d7cfdf6 --- /dev/null +++ b/packages/g6/tests/integration/items-node-donut.spec.ts @@ -0,0 +1,87 @@ +import donutNode from '../demo/item/node/donut-node'; +import './utils/useSnapshotMatchers'; +import { createContext } from './utils'; + +const dir = `${__dirname}/snapshots/items/node/donut`; + +describe('Items node donut', () => { + it('should be rendered correctly', (done) => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); + + const graph = donutNode({ + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + width: 500, + height: 500, + }); + + graph.on('afterrender', async () => { + await expect(canvas).toMatchSVGSnapshot(dir, 'items-node-donut'); + + /** + * Click the checkbox to set custom colors. + */ + const $customColors = document.querySelectorAll( + 'input', + )[0] as HTMLInputElement; + $customColors.click(); + await expect(canvas).toMatchSVGSnapshot( + dir, + 'items-node-donut-custom-colors', + ); + $customColors.click(); + + /** + * Click the checkbox to set custom inner size. + */ + const $innerSize = document.querySelectorAll( + 'input', + )[1] as HTMLInputElement; + $innerSize.click(); + + await expect(canvas).toMatchSVGSnapshot( + dir, + 'items-node-donut-custom-innersize', + ); + $innerSize.click(); + + /** + * Click the checkbox to update attrs. + */ + const $attrs = document.querySelectorAll('input')[2] as HTMLInputElement; + $attrs.click(); + await expect(canvas).toMatchSVGSnapshot( + dir, + 'items-node-donut-custom-attrs', + ); + $attrs.click(); + + /** + * Click the checkbox to set selected style. + */ + const $selected = document.querySelectorAll( + 'input', + )[3] as HTMLInputElement; + $selected.click(); + await expect(canvas).toMatchSVGSnapshot( + dir, + 'items-node-donut-selected-style', + ); + $selected.click(); + + graph.destroy(); + done(); + }); + }); +}); diff --git a/packages/g6/tests/integration/items-node-image.spec.ts b/packages/g6/tests/integration/items-node-image.spec.ts new file mode 100644 index 00000000000..2e43b144d30 --- /dev/null +++ b/packages/g6/tests/integration/items-node-image.spec.ts @@ -0,0 +1,35 @@ +import imageNode from '../demo/item/node/image'; +import './utils/useSnapshotMatchers'; +import { createContext } from './utils'; + +const dir = `${__dirname}/snapshots/items/node/image`; + +describe('Items node image', () => { + it('should be rendered correctly', (done) => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); + + const graph = imageNode({ + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + width: 500, + height: 500, + }); + + graph.on('afterlayout', async () => { + await expect(canvas).toMatchSVGSnapshot(dir, 'items-node-image'); + graph.destroy(); + done(); + }); + }); +}); diff --git a/packages/g6/tests/integration/layouts-circular.spec.ts b/packages/g6/tests/integration/layouts-circular.spec.ts index de0d29e690d..a437752d946 100644 --- a/packages/g6/tests/integration/layouts-circular.spec.ts +++ b/packages/g6/tests/integration/layouts-circular.spec.ts @@ -27,12 +27,10 @@ describe('Circular layout', () => { }); graph.on('afterlayout', async () => { - try { - await expect(canvas).toMatchSVGSnapshot(dir, 'circular'); - } finally { - graph.destroy(); - done(); - } + await expect(canvas).toMatchSVGSnapshot(dir, 'circular'); + + graph.destroy(); + done(); }); }); }); diff --git a/packages/g6/tests/integration/layouts-d3force.spec.ts b/packages/g6/tests/integration/layouts-d3force.spec.ts index 6a3c357674d..fd8f2ab3be8 100644 --- a/packages/g6/tests/integration/layouts-d3force.spec.ts +++ b/packages/g6/tests/integration/layouts-d3force.spec.ts @@ -30,17 +30,15 @@ describe('D3Force layout', () => { }); graph.on('afterlayout', async () => { - try { - await expect(canvas).toMatchSVGSnapshot(dir, 'd3force'); - } finally { - // const layoutAnimation = graph.getLayoutCurrentAnimation()!; - // layoutAnimation. - // layoutAnimation.currentTime = 0; - // await expect(canvas).toMatchSVGSnapshot(dir, 'layouts-d3force-0'); + await expect(canvas).toMatchSVGSnapshot(dir, 'd3force'); - graph.destroy(); - done(); - } + // const layoutAnimation = graph.getLayoutCurrentAnimation()!; + // layoutAnimation. + // layoutAnimation.currentTime = 0; + // await expect(canvas).toMatchSVGSnapshot(dir, 'layouts-d3force-0'); + + graph.destroy(); + done(); }); }); }); diff --git a/packages/g6/tests/integration/layouts-dagre.spec.ts b/packages/g6/tests/integration/layouts-dagre.spec.ts index 7bba46b1d85..a407c5cc3a9 100644 --- a/packages/g6/tests/integration/layouts-dagre.spec.ts +++ b/packages/g6/tests/integration/layouts-dagre.spec.ts @@ -27,12 +27,10 @@ describe('Dagre layout', () => { }); graph.on('afterlayout', async () => { - try { - await expect(canvas).toMatchSVGSnapshot(dir, 'dagre'); - } finally { - graph.destroy(); - done(); - } + await expect(canvas).toMatchSVGSnapshot(dir, 'dagre'); + + graph.destroy(); + done(); }); }); }); diff --git a/packages/g6/tests/integration/layouts-force.spec.ts b/packages/g6/tests/integration/layouts-force.spec.ts index e800b944f9d..2deb6ef1f25 100644 --- a/packages/g6/tests/integration/layouts-force.spec.ts +++ b/packages/g6/tests/integration/layouts-force.spec.ts @@ -27,12 +27,10 @@ describe.skip('Force layout', () => { }); graph.on('afterlayout', async () => { - try { - await expect(canvas).toMatchSVGSnapshot(dir, 'force'); - } finally { - graph.destroy(); - done(); - } + await expect(canvas).toMatchSVGSnapshot(dir, 'force'); + + graph.destroy(); + done(); }); }); }); diff --git a/packages/g6/tests/integration/layouts-grid.spec.ts b/packages/g6/tests/integration/layouts-grid.spec.ts index 0f91fcc56c6..7ec5fa7c5bf 100644 --- a/packages/g6/tests/integration/layouts-grid.spec.ts +++ b/packages/g6/tests/integration/layouts-grid.spec.ts @@ -27,12 +27,10 @@ describe('Grid layout', () => { }); graph.on('afterlayout', async () => { - try { - await expect(canvas).toMatchSVGSnapshot(dir, 'grid'); - } finally { - graph.destroy(); - done(); - } + await expect(canvas).toMatchSVGSnapshot(dir, 'grid'); + + graph.destroy(); + done(); }); }); }); diff --git a/packages/g6/tests/integration/node-diamond.spec.ts b/packages/g6/tests/integration/node-diamond.spec.ts index f5c257967c3..75fda0bd506 100644 --- a/packages/g6/tests/integration/node-diamond.spec.ts +++ b/packages/g6/tests/integration/node-diamond.spec.ts @@ -28,20 +28,18 @@ describe('node diamond', () => { }); graph.on('afterlayout', async () => { - try { - await expect(canvas).toMatchSVGSnapshot(dir, 'node-diamond'); - //seleted state - triggerEvent(graph, 'mousedown', 100, 100); - triggerEvent(graph, 'mouseup', 100, 100); - await expect(canvas).toMatchSVGSnapshot(dir, 'node-diamond-selected'); - //normal state - triggerEvent(graph, 'mousedown', 100, 100); - triggerEvent(graph, 'mouseup', 100, 100); - await expect(canvas).toMatchSVGSnapshot(dir, 'node-diamond-restore'); - } finally { - graph.destroy(); - done(); - } + await expect(canvas).toMatchSVGSnapshot(dir, 'node-diamond'); + //seleted state + triggerEvent(graph, 'mousedown', 100, 100); + triggerEvent(graph, 'mouseup', 100, 100); + await expect(canvas).toMatchSVGSnapshot(dir, 'node-diamond-selected'); + //normal state + triggerEvent(graph, 'mousedown', 100, 100); + triggerEvent(graph, 'mouseup', 100, 100); + await expect(canvas).toMatchSVGSnapshot(dir, 'node-diamond-restore'); + + graph.destroy(); + done(); }); }); }); diff --git a/packages/g6/tests/integration/node-ellipse.spec.ts b/packages/g6/tests/integration/node-ellipse.spec.ts index b606c29c6ee..850269fa176 100644 --- a/packages/g6/tests/integration/node-ellipse.spec.ts +++ b/packages/g6/tests/integration/node-ellipse.spec.ts @@ -28,20 +28,18 @@ describe('node ellipse', () => { }); graph.on('afterlayout', async () => { - try { - await expect(canvas).toMatchSVGSnapshot(dir, 'node-ellipse'); - //seleted state - triggerEvent(graph, 'mousedown', 100, 100); - triggerEvent(graph, 'mouseup', 100, 100); - await expect(canvas).toMatchSVGSnapshot(dir, 'node-ellipse-selected'); - //normal state - triggerEvent(graph, 'mousedown', 100, 100); - triggerEvent(graph, 'mouseup', 100, 100); - await expect(canvas).toMatchSVGSnapshot(dir, 'node-ellipse'); - } finally { - graph.destroy(); - done(); - } + await expect(canvas).toMatchSVGSnapshot(dir, 'node-ellipse'); + //seleted state + triggerEvent(graph, 'mousedown', 100, 100); + triggerEvent(graph, 'mouseup', 100, 100); + await expect(canvas).toMatchSVGSnapshot(dir, 'node-ellipse-selected'); + //normal state + triggerEvent(graph, 'mousedown', 100, 100); + triggerEvent(graph, 'mouseup', 100, 100); + await expect(canvas).toMatchSVGSnapshot(dir, 'node-ellipse'); + + graph.destroy(); + done(); }); }); }); diff --git a/packages/g6/tests/integration/node-hexagon.spec.ts b/packages/g6/tests/integration/node-hexagon.spec.ts index d600360e00a..c9978018df8 100644 --- a/packages/g6/tests/integration/node-hexagon.spec.ts +++ b/packages/g6/tests/integration/node-hexagon.spec.ts @@ -28,20 +28,18 @@ describe('node hexagon', () => { }); graph.on('afterlayout', async () => { - try { - await expect(canvas).toMatchSVGSnapshot(dir, 'node-hexagon'); - //seleted state - triggerEvent(graph, 'mousedown', 100, 100); - triggerEvent(graph, 'mouseup', 100, 100); - await expect(canvas).toMatchSVGSnapshot(dir, 'node-hexagon-selected'); - //normal state - triggerEvent(graph, 'mousedown', 100, 100); - triggerEvent(graph, 'mouseup', 100, 100); - await expect(canvas).toMatchSVGSnapshot(dir, 'node-hexagon'); - } finally { - graph.destroy(); - done(); - } + await expect(canvas).toMatchSVGSnapshot(dir, 'node-hexagon'); + //seleted state + triggerEvent(graph, 'mousedown', 100, 100); + triggerEvent(graph, 'mouseup', 100, 100); + await expect(canvas).toMatchSVGSnapshot(dir, 'node-hexagon-selected'); + //normal state + triggerEvent(graph, 'mousedown', 100, 100); + triggerEvent(graph, 'mouseup', 100, 100); + await expect(canvas).toMatchSVGSnapshot(dir, 'node-hexagon'); + + graph.destroy(); + done(); }); }); }); diff --git a/packages/g6/tests/integration/node-modelRect.spec.ts b/packages/g6/tests/integration/node-modelRect.spec.ts index 38695a2f928..f3fdd66b72b 100644 --- a/packages/g6/tests/integration/node-modelRect.spec.ts +++ b/packages/g6/tests/integration/node-modelRect.spec.ts @@ -28,20 +28,18 @@ describe('node modelRect', () => { }); graph.on('afterlayout', async () => { - try { - await expect(canvas).toMatchSVGSnapshot(dir, 'node-modelRect'); - //seleted state - triggerEvent(graph, 'mousedown', 100, 100); - triggerEvent(graph, 'mouseup', 100, 100); - await expect(canvas).toMatchSVGSnapshot(dir, 'node-modelRect-selected'); - //normal state - triggerEvent(graph, 'mousedown', 100, 100); - triggerEvent(graph, 'mouseup', 100, 100); - await expect(canvas).toMatchSVGSnapshot(dir, 'node-modelRect-restore'); - } finally { - graph.destroy(); - done(); - } + await expect(canvas).toMatchSVGSnapshot(dir, 'node-modelRect'); + //seleted state + triggerEvent(graph, 'mousedown', 100, 100); + triggerEvent(graph, 'mouseup', 100, 100); + await expect(canvas).toMatchSVGSnapshot(dir, 'node-modelRect-selected'); + //normal state + triggerEvent(graph, 'mousedown', 100, 100); + triggerEvent(graph, 'mouseup', 100, 100); + await expect(canvas).toMatchSVGSnapshot(dir, 'node-modelRect-restore'); + + graph.destroy(); + done(); }); }); }); diff --git a/packages/g6/tests/integration/node-star.spec.ts b/packages/g6/tests/integration/node-star.spec.ts index 1b5bed8290c..49ff2fe26c1 100644 --- a/packages/g6/tests/integration/node-star.spec.ts +++ b/packages/g6/tests/integration/node-star.spec.ts @@ -28,20 +28,17 @@ describe('node star', () => { }); graph.on('afterlayout', async () => { - try { - await expect(canvas).toMatchSVGSnapshot(dir, 'node-star'); - //seleted state - triggerEvent(graph, 'mousedown', 100, 100); - triggerEvent(graph, 'mouseup', 100, 100); - await expect(canvas).toMatchSVGSnapshot(dir, 'node-star-selected'); - //normal state - triggerEvent(graph, 'mousedown', 100, 100); - triggerEvent(graph, 'mouseup', 100, 100); - await expect(canvas).toMatchSVGSnapshot(dir, 'node-star'); - } finally { - graph.destroy(); - done(); - } + await expect(canvas).toMatchSVGSnapshot(dir, 'node-star'); + //seleted state + triggerEvent(graph, 'mousedown', 100, 100); + triggerEvent(graph, 'mouseup', 100, 100); + await expect(canvas).toMatchSVGSnapshot(dir, 'node-star-selected'); + //normal state + triggerEvent(graph, 'mousedown', 100, 100); + triggerEvent(graph, 'mouseup', 100, 100); + await expect(canvas).toMatchSVGSnapshot(dir, 'node-star'); + graph.destroy(); + done(); }); }); }); diff --git a/packages/g6/tests/integration/node-triangle.spec.ts b/packages/g6/tests/integration/node-triangle.spec.ts index 335765dc092..1c6749026d8 100644 --- a/packages/g6/tests/integration/node-triangle.spec.ts +++ b/packages/g6/tests/integration/node-triangle.spec.ts @@ -28,20 +28,18 @@ describe('node triangle', () => { }); graph.on('afterlayout', async () => { - try { - await expect(canvas).toMatchSVGSnapshot(dir, 'node-triangle'); - //seleted state - triggerEvent(graph, 'mousedown', 100, 100); - triggerEvent(graph, 'mouseup', 100, 100); - await expect(canvas).toMatchSVGSnapshot(dir, 'node-triangle-selected'); - //normal state - triggerEvent(graph, 'mousedown', 100, 100); - triggerEvent(graph, 'mouseup', 100, 100); - await expect(canvas).toMatchSVGSnapshot(dir, 'node-triangle'); - } finally { - graph.destroy(); - done(); - } + await expect(canvas).toMatchSVGSnapshot(dir, 'node-triangle'); + //seleted state + triggerEvent(graph, 'mousedown', 100, 100); + triggerEvent(graph, 'mouseup', 100, 100); + await expect(canvas).toMatchSVGSnapshot(dir, 'node-triangle-selected'); + //normal state + triggerEvent(graph, 'mousedown', 100, 100); + triggerEvent(graph, 'mouseup', 100, 100); + await expect(canvas).toMatchSVGSnapshot(dir, 'node-triangle'); + + graph.destroy(); + done(); }); }); }); diff --git a/packages/g6/tests/bak/plugins-edgeFilterLens.spec.ts b/packages/g6/tests/integration/plugins-edgeFilterLens.spec.ts similarity index 59% rename from packages/g6/tests/bak/plugins-edgeFilterLens.spec.ts rename to packages/g6/tests/integration/plugins-edgeFilterLens.spec.ts index 8afa86e6232..cf6676ba470 100644 --- a/packages/g6/tests/bak/plugins-edgeFilterLens.spec.ts +++ b/packages/g6/tests/integration/plugins-edgeFilterLens.spec.ts @@ -1,37 +1,39 @@ -import { resetEntityCounter } from '@antv/g'; import EdgeFilterLens from '../demo/plugins/edgeFilterLens'; -import { createContext, sleep } from './utils'; +import { createContext } from './utils'; import { triggerEvent } from './utils/event'; import './utils/useSnapshotMatchers'; -describe('Default EdgeFilterLens', () => { - beforeEach(() => { - resetEntityCounter(); - }); +const dir = `${__dirname}/snapshots/plugins/edgeFilterLens`; +describe('Default EdgeFilterLens', () => { it('should be rendered correctly with fitler lens with mousemove', async () => { - const dir = `${__dirname}/snapshots/canvas/plugins/edgeFilterLens`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = EdgeFilterLens({ backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, - container, }); - console.log('graph', graph); - const process = new Promise((reslove) => { + const process = new Promise((resolve) => { graph.on('afterlayout', () => { - console.log('afterlayout'); - reslove(); + resolve(undefined); }); }); await process; - await sleep(300); + triggerEvent(graph, 'mousedown', 200, 200); await expect(transientCanvas).toMatchSVGSnapshot( dir, diff --git a/packages/g6/tests/bak/plugins-history-combo.spec.ts b/packages/g6/tests/integration/plugins-history-combo.spec.ts similarity index 87% rename from packages/g6/tests/bak/plugins-history-combo.spec.ts rename to packages/g6/tests/integration/plugins-history-combo.spec.ts index a35e14d1082..64daa9787e5 100644 --- a/packages/g6/tests/bak/plugins-history-combo.spec.ts +++ b/packages/g6/tests/integration/plugins-history-combo.spec.ts @@ -1,27 +1,27 @@ -import { resetEntityCounter } from '@antv/g'; import historyCombo from '../demo/plugins/history-combo'; import './utils/useSnapshotMatchers'; import { createContext } from './utils'; -describe('Plugins history combo', () => { - beforeEach(() => { - /** - * SVG Snapshot testing will generate a unique id for each element. - * Reset to 0 to keep snapshot consistent. - */ - resetEntityCounter(); - }); +const dir = `${__dirname}/snapshots/plugins/history`; - it('should be rendered correctly with Canvas2D', (done) => { - const dir = `${__dirname}/snapshots/canvas/plugins/history`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); +describe('Plugins history combo', () => { + it('should be rendered correctly', (done) => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = historyCombo({ - container, backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, }); diff --git a/packages/g6/tests/bak/plugins-history.spec.ts b/packages/g6/tests/integration/plugins-history.spec.ts similarity index 92% rename from packages/g6/tests/bak/plugins-history.spec.ts rename to packages/g6/tests/integration/plugins-history.spec.ts index f333507fadb..1770bf6eeb1 100644 --- a/packages/g6/tests/bak/plugins-history.spec.ts +++ b/packages/g6/tests/integration/plugins-history.spec.ts @@ -1,27 +1,27 @@ -import { resetEntityCounter } from '@antv/g'; import history from '../demo/plugins/history'; import './utils/useSnapshotMatchers'; import { createContext } from './utils'; -describe('Plugins history', () => { - beforeEach(() => { - /** - * SVG Snapshot testing will generate a unique id for each element. - * Reset to 0 to keep snapshot consistent. - */ - resetEntityCounter(); - }); +const dir = `${__dirname}/snapshots/plugins/history`; - it('should be rendered correctly with Canvas2D', (done) => { - const dir = `${__dirname}/snapshots/canvas/plugins/history`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); +describe('Plugins history', () => { + it('should be rendered correctly', (done) => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = history({ - container, backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, }); diff --git a/packages/g6/tests/bak/plugins-hull.spec.ts b/packages/g6/tests/integration/plugins-hull.spec.ts similarity index 74% rename from packages/g6/tests/bak/plugins-hull.spec.ts rename to packages/g6/tests/integration/plugins-hull.spec.ts index 372094775e6..0d85e847c21 100644 --- a/packages/g6/tests/bak/plugins-hull.spec.ts +++ b/packages/g6/tests/integration/plugins-hull.spec.ts @@ -1,29 +1,28 @@ -import { resetEntityCounter } from '@antv/g'; -import activateRelations from '../demo/behaviors/activate-relations'; -import './utils/useSnapshotMatchers'; import hull from '../demo/plugins/hull'; -import { createContext, sleep, triggerEvent } from './utils'; +import { createContext } from './utils'; +import './utils/useSnapshotMatchers'; -describe('Hull plugin', () => { - beforeEach(() => { - /** - * SVG Snapshot testing will generate a unique id for each element. - * Reset to 0 to keep snapshot consistent. - */ - resetEntityCounter(); - }); +const dir = `${__dirname}/snapshots/plugins/hull`; +describe('Hull plugin', () => { it('should be rendered correctly with round-convex type', (done) => { - const dir = `${__dirname}/snapshots/canvas/plugins/hull`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = hull( { - container, backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, }, @@ -125,16 +124,23 @@ describe('Hull plugin', () => { }); it('should be rendered correctly with bubble type', (done) => { - const dir = `${__dirname}/snapshots/canvas/plugins/hull`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = hull( { - container, backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, }, @@ -157,16 +163,23 @@ describe('Hull plugin', () => { }); it('should be rendered correctly with smooth-convex type', (done) => { - const dir = `${__dirname}/snapshots/canvas/plugins/hull`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = hull( { - container, backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, }, @@ -186,28 +199,4 @@ describe('Hull plugin', () => { done(); }); }); - - xit('should be rendered correctly with SVG', (done) => { - const dir = `${__dirname}/snapshots/svg/plugins/hull`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('svg', 500, 500); - - const graph = activateRelations({ - container, - backgroundCanvas, - canvas, - transientCanvas, - width: 500, - height: 500, - }); - - graph.on('afterlayout', async () => { - await expect(canvas).toMatchSVGSnapshot( - dir, - 'behaviors-activate-relations', - ); - graph.destroy(); - done(); - }); - }); }); diff --git a/packages/g6/tests/bak/plugins-watermarker.spec.ts b/packages/g6/tests/integration/plugins-watermarker.spec.ts similarity index 51% rename from packages/g6/tests/bak/plugins-watermarker.spec.ts rename to packages/g6/tests/integration/plugins-watermarker.spec.ts index 1504b90e593..5e48796a971 100644 --- a/packages/g6/tests/bak/plugins-watermarker.spec.ts +++ b/packages/g6/tests/integration/plugins-watermarker.spec.ts @@ -1,33 +1,33 @@ -import { resetEntityCounter } from '@antv/g'; import watermarker from '../demo/plugins/watermarker'; import { createContext } from './utils'; import { createNodeGCanvas } from './utils/createNodeGCanvas'; import './utils/useSnapshotMatchers'; -const container = document.createElement('div'); -//@ts-ignore -document.querySelector('body').appendChild(container); +const dir = `${__dirname}/snapshots/plugins/watermarker`; describe('plugin', () => { - beforeEach(() => { - /** - * SVG Snapshot testing will generate a unique id for each element. - * Reset to 0 to keep snapshot consistent. - */ - resetEntityCounter(); - }); it('watermarker with text config', (done) => { - const dir = `${__dirname}/snapshots/canvas/plugins/watermarker`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); - const watermarkerCanvas = createNodeGCanvas('canvas', 500, 500); + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); + + const watermarkerContainer = document.createElement('div'); + document.body.appendChild(container); + const watermarkerCanvas = createNodeGCanvas(watermarkerContainer, 500, 500); const graph = watermarker( { - container, backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, }, @@ -36,8 +36,7 @@ describe('plugin', () => { mode: 'text', }, ); - graph.on('afterlayout', async (e) => { - console.log('afterlayout'); + graph.on('afterlayout', async () => { await expect(watermarkerCanvas).toMatchSVGSnapshot( dir, 'plugins-watermarker-text', diff --git a/packages/g6/tests/integration/snapshots/animations/animations-node-build-in-finished.svg b/packages/g6/tests/integration/snapshots/animations/animations-node-build-in-finished.svg new file mode 100644 index 00000000000..a98eb99c4df --- /dev/null +++ b/packages/g6/tests/integration/snapshots/animations/animations-node-build-in-finished.svg @@ -0,0 +1,2083 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/animations/animations-node-build-in-ready.svg b/packages/g6/tests/integration/snapshots/animations/animations-node-build-in-ready.svg new file mode 100644 index 00000000000..bf343293efb --- /dev/null +++ b/packages/g6/tests/integration/snapshots/animations/animations-node-build-in-ready.svg @@ -0,0 +1,2115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/animations/animations-node-build-in-running.svg b/packages/g6/tests/integration/snapshots/animations/animations-node-build-in-running.svg new file mode 100644 index 00000000000..4808c22dc5b --- /dev/null +++ b/packages/g6/tests/integration/snapshots/animations/animations-node-build-in-running.svg @@ -0,0 +1,2115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/api/api-update-mapper-edge-func.svg b/packages/g6/tests/integration/snapshots/api/api-update-mapper-edge-func.svg new file mode 100644 index 00000000000..792bf8100d8 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/api/api-update-mapper-edge-func.svg @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/api/api-update-mapper-edge-json.svg b/packages/g6/tests/integration/snapshots/api/api-update-mapper-edge-json.svg new file mode 100644 index 00000000000..792bf8100d8 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/api/api-update-mapper-edge-json.svg @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/api/api-update-mapper-init.svg b/packages/g6/tests/integration/snapshots/api/api-update-mapper-init.svg new file mode 100644 index 00000000000..792bf8100d8 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/api/api-update-mapper-init.svg @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/api/api-update-mapper-node-func.svg b/packages/g6/tests/integration/snapshots/api/api-update-mapper-node-func.svg new file mode 100644 index 00000000000..792bf8100d8 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/api/api-update-mapper-node-func.svg @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/api/api-update-mapper-node-json.svg b/packages/g6/tests/integration/snapshots/api/api-update-mapper-node-json.svg new file mode 100644 index 00000000000..792bf8100d8 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/api/api-update-mapper-node-json.svg @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/behaivors/behaviors-scroll-canvas-wheel.svg b/packages/g6/tests/integration/snapshots/behaivors/behaviors-scroll-canvas-wheel.svg new file mode 100644 index 00000000000..11f00b5d5dc --- /dev/null +++ b/packages/g6/tests/integration/snapshots/behaivors/behaviors-scroll-canvas-wheel.svg @@ -0,0 +1,240 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/behaivors/behaviors-scroll-canvas-zoom.svg b/packages/g6/tests/integration/snapshots/behaivors/behaviors-scroll-canvas-zoom.svg new file mode 100644 index 00000000000..75eab8a2cbf --- /dev/null +++ b/packages/g6/tests/integration/snapshots/behaivors/behaviors-scroll-canvas-zoom.svg @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/behaivors/behaviors-scroll-canvas.svg b/packages/g6/tests/integration/snapshots/behaivors/behaviors-scroll-canvas.svg new file mode 100644 index 00000000000..bc1496a3a9b --- /dev/null +++ b/packages/g6/tests/integration/snapshots/behaivors/behaviors-scroll-canvas.svg @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/behaviors/behaviors-activate-relations-activate-node1.svg b/packages/g6/tests/integration/snapshots/behaviors/behaviors-activate-relations-activate-node1.svg new file mode 100644 index 00000000000..78e318c180b --- /dev/null +++ b/packages/g6/tests/integration/snapshots/behaviors/behaviors-activate-relations-activate-node1.svg @@ -0,0 +1,498 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + node2 + + + + + + + node3 + + + + + + + node4 + + + + + + + node5 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/behaviors/behaviors-activate-relations-deactivate-node1.svg b/packages/g6/tests/integration/snapshots/behaviors/behaviors-activate-relations-deactivate-node1.svg new file mode 100644 index 00000000000..b6e1201f661 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/behaviors/behaviors-activate-relations-deactivate-node1.svg @@ -0,0 +1,364 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + node2 + + + + + + + node3 + + + + + + + node4 + + + + + + + node5 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/behaviors/behaviors-activate-relations.svg b/packages/g6/tests/integration/snapshots/behaviors/behaviors-activate-relations.svg new file mode 100644 index 00000000000..c476e60da98 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/behaviors/behaviors-activate-relations.svg @@ -0,0 +1,360 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + node2 + + + + + + + node3 + + + + + + + node4 + + + + + + + node5 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/behaviors/behaviors-collapse-expand-collapse-cnode1.svg b/packages/g6/tests/integration/snapshots/behaviors/behaviors-collapse-expand-collapse-cnode1.svg new file mode 100644 index 00000000000..71dcbb5a835 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/behaviors/behaviors-collapse-expand-collapse-cnode1.svg @@ -0,0 +1,468 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + cnode1 + + + + + + + dynamic... + + + + + + + c2 + + + + + + + cnode2 + + + + + + + node2 + + + + + + + t2c1-c1 + + + + + + + t2c2 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/behaviors/behaviors-collapse-expand-collapse-node1.svg b/packages/g6/tests/integration/snapshots/behaviors/behaviors-collapse-expand-collapse-node1.svg new file mode 100644 index 00000000000..e6867bb672e --- /dev/null +++ b/packages/g6/tests/integration/snapshots/behaviors/behaviors-collapse-expand-collapse-node1.svg @@ -0,0 +1,474 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + cnode1 + + + + + + + dynamic... + + + + + + + c2 + + + + + + + cnode2 + + + + + + + node2 + + + + + + + t2c1-c1 + + + + + + + t2c2 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/behaviors/behaviors-collapse-expand-expand-cnode1.svg b/packages/g6/tests/integration/snapshots/behaviors/behaviors-collapse-expand-expand-cnode1.svg new file mode 100644 index 00000000000..f20070851ba --- /dev/null +++ b/packages/g6/tests/integration/snapshots/behaviors/behaviors-collapse-expand-expand-cnode1.svg @@ -0,0 +1,474 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + cnode1 + + + + + + + dynamic... + + + + + + + c2 + + + + + + + cnode2 + + + + + + + node2 + + + + + + + t2c1-c1 + + + + + + + t2c2 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/behaviors/behaviors-collapse-expand-expand-node1.svg b/packages/g6/tests/integration/snapshots/behaviors/behaviors-collapse-expand-expand-node1.svg new file mode 100644 index 00000000000..eefebd7b292 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/behaviors/behaviors-collapse-expand-expand-node1.svg @@ -0,0 +1,474 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + cnode1 + + + + + + + dynamic... + + + + + + + c2 + + + + + + + cnode2 + + + + + + + node2 + + + + + + + t2c1-c1 + + + + + + + t2c2 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/behaviors/behaviors-collapse-expand.svg b/packages/g6/tests/integration/snapshots/behaviors/behaviors-collapse-expand.svg new file mode 100644 index 00000000000..17b1d2670a4 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/behaviors/behaviors-collapse-expand.svg @@ -0,0 +1,465 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + cnode1 + + + + + + + dynamic... + + + + + + + c2 + + + + + + + cnode2 + + + + + + + node2 + + + + + + + t2c1-c1 + + + + + + + t2c2 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-click-begin.svg b/packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-click-begin.svg new file mode 100644 index 00000000000..35e0fa92430 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-click-begin.svg @@ -0,0 +1,427 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + node2 + + + + + + + node3 + + + + + + + node4 + + + + + + + node5 + + + + + + + g6-creat... + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-click-finish.svg b/packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-click-finish.svg new file mode 100644 index 00000000000..56d3bfe778b --- /dev/null +++ b/packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-click-finish.svg @@ -0,0 +1,385 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + node2 + + + + + + + node3 + + + + + + + node4 + + + + + + + node5 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-click-loop.svg b/packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-click-loop.svg new file mode 100644 index 00000000000..fdfbd405040 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-click-loop.svg @@ -0,0 +1,404 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + node2 + + + + + + + node3 + + + + + + + node4 + + + + + + + node5 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-drag-begin.svg b/packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-drag-begin.svg new file mode 100644 index 00000000000..35e0fa92430 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-drag-begin.svg @@ -0,0 +1,427 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + node2 + + + + + + + node3 + + + + + + + node4 + + + + + + + node5 + + + + + + + g6-creat... + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-drag-finish.svg b/packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-drag-finish.svg new file mode 100644 index 00000000000..c476e60da98 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-drag-finish.svg @@ -0,0 +1,360 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + node2 + + + + + + + node3 + + + + + + + node4 + + + + + + + node5 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-drag-loop.svg b/packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-drag-loop.svg new file mode 100644 index 00000000000..c476e60da98 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/behaviors/behaviors-create-edge-drag-loop.svg @@ -0,0 +1,360 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + node2 + + + + + + + node3 + + + + + + + node4 + + + + + + + node5 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/behaviors/behaviors-shortcuts-call-with-fitView.svg b/packages/g6/tests/integration/snapshots/behaviors/behaviors-shortcuts-call-with-fitView.svg new file mode 100644 index 00000000000..3164ed653f8 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/behaviors/behaviors-shortcuts-call-with-fitView.svg @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/behaviors/behaviors-shortcuts-call-with-zoom.svg b/packages/g6/tests/integration/snapshots/behaviors/behaviors-shortcuts-call-with-zoom.svg new file mode 100644 index 00000000000..3164ed653f8 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/behaviors/behaviors-shortcuts-call-with-zoom.svg @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/behaviors/behaviors-shortcuts-call.svg b/packages/g6/tests/integration/snapshots/behaviors/behaviors-shortcuts-call.svg new file mode 100644 index 00000000000..3164ed653f8 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/behaviors/behaviors-shortcuts-call.svg @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-add-edge.svg b/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-add-edge.svg new file mode 100644 index 00000000000..710a59b7a8b --- /dev/null +++ b/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-add-edge.svg @@ -0,0 +1,598 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-loop.svg b/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-loop.svg new file mode 100644 index 00000000000..323ae202724 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-loop.svg @@ -0,0 +1,580 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-quadratic.svg b/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-quadratic.svg new file mode 100644 index 00000000000..ea86213e645 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-quadratic.svg @@ -0,0 +1,400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-remove-edge.svg b/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-remove-edge.svg new file mode 100644 index 00000000000..323ae202724 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-remove-edge.svg @@ -0,0 +1,580 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-update-edge-1.svg b/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-update-edge-1.svg new file mode 100644 index 00000000000..a3ba8f4e8cc --- /dev/null +++ b/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-update-edge-1.svg @@ -0,0 +1,580 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-update-edge-2.svg b/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-update-edge-2.svg new file mode 100644 index 00000000000..cfdbbccc439 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-update-edge-2.svg @@ -0,0 +1,580 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-update-edge-3.svg b/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-update-edge-3.svg new file mode 100644 index 00000000000..88194880cce --- /dev/null +++ b/packages/g6/tests/integration/snapshots/data-parallel/data-parallel-edges-update-edge-3.svg @@ -0,0 +1,580 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/data/data-validate-combo-no-id.svg b/packages/g6/tests/integration/snapshots/data/data-validate-combo-no-id.svg new file mode 100644 index 00000000000..0e70314f01f --- /dev/null +++ b/packages/g6/tests/integration/snapshots/data/data-validate-combo-no-id.svg @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/data/data-validate-duplicate-node-edge-id.svg b/packages/g6/tests/integration/snapshots/data/data-validate-duplicate-node-edge-id.svg new file mode 100644 index 00000000000..1fa9fac628c --- /dev/null +++ b/packages/g6/tests/integration/snapshots/data/data-validate-duplicate-node-edge-id.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/data/data-validate-duplicate-node-id.svg b/packages/g6/tests/integration/snapshots/data/data-validate-duplicate-node-id.svg new file mode 100644 index 00000000000..50db9f0ef36 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/data/data-validate-duplicate-node-id.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/data/data-validate-edge-no-id.svg b/packages/g6/tests/integration/snapshots/data/data-validate-edge-no-id.svg new file mode 100644 index 00000000000..0e70314f01f --- /dev/null +++ b/packages/g6/tests/integration/snapshots/data/data-validate-edge-no-id.svg @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/data/data-validate-edge-no-source.svg b/packages/g6/tests/integration/snapshots/data/data-validate-edge-no-source.svg new file mode 100644 index 00000000000..1fa9fac628c --- /dev/null +++ b/packages/g6/tests/integration/snapshots/data/data-validate-edge-no-source.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/data/data-validate-edge-source-not-exist.svg b/packages/g6/tests/integration/snapshots/data/data-validate-edge-source-not-exist.svg new file mode 100644 index 00000000000..1fa9fac628c --- /dev/null +++ b/packages/g6/tests/integration/snapshots/data/data-validate-edge-source-not-exist.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/data/data-validate-node-no-data.svg b/packages/g6/tests/integration/snapshots/data/data-validate-node-no-data.svg new file mode 100644 index 00000000000..0e70314f01f --- /dev/null +++ b/packages/g6/tests/integration/snapshots/data/data-validate-node-no-data.svg @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/data/data-validate-node-no-id.svg b/packages/g6/tests/integration/snapshots/data/data-validate-node-no-id.svg new file mode 100644 index 00000000000..50db9f0ef36 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/data/data-validate-node-no-id.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/data/data-validate-node-parent-not-exist.svg b/packages/g6/tests/integration/snapshots/data/data-validate-node-parent-not-exist.svg new file mode 100644 index 00000000000..0e70314f01f --- /dev/null +++ b/packages/g6/tests/integration/snapshots/data/data-validate-node-parent-not-exist.svg @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/items/combo/combo-circle-collapsed.svg b/packages/g6/tests/integration/snapshots/items/combo/combo-circle-collapsed.svg new file mode 100644 index 00000000000..5e7c96e861a --- /dev/null +++ b/packages/g6/tests/integration/snapshots/items/combo/combo-circle-collapsed.svg @@ -0,0 +1,397 @@ + + + + + + + + + + + + + + + + + + + + 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/items/combo/combo-circle-expand.svg b/packages/g6/tests/integration/snapshots/items/combo/combo-circle-expand.svg new file mode 100644 index 00000000000..501a2d4dd51 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/items/combo/combo-circle-expand.svg @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/items/combo/combo-circle-selected.svg b/packages/g6/tests/integration/snapshots/items/combo/combo-circle-selected.svg new file mode 100644 index 00000000000..a426ee5defb --- /dev/null +++ b/packages/g6/tests/integration/snapshots/items/combo/combo-circle-selected.svg @@ -0,0 +1,293 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/items/combo/combo-circle.svg b/packages/g6/tests/integration/snapshots/items/combo/combo-circle.svg new file mode 100644 index 00000000000..33b412787ef --- /dev/null +++ b/packages/g6/tests/integration/snapshots/items/combo/combo-circle.svg @@ -0,0 +1,277 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/items/combo/combo-rect-collapsed.svg b/packages/g6/tests/integration/snapshots/items/combo/combo-rect-collapsed.svg new file mode 100644 index 00000000000..4f6d15c312a --- /dev/null +++ b/packages/g6/tests/integration/snapshots/items/combo/combo-rect-collapsed.svg @@ -0,0 +1,389 @@ + + + + + + + + + + + + + + + + + + + + 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/items/combo/combo-rect-expand.svg b/packages/g6/tests/integration/snapshots/items/combo/combo-rect-expand.svg new file mode 100644 index 00000000000..751c8be59d0 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/items/combo/combo-rect-expand.svg @@ -0,0 +1,299 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/items/combo/combo-rect-selected.svg b/packages/g6/tests/integration/snapshots/items/combo/combo-rect-selected.svg new file mode 100644 index 00000000000..9254be4cf42 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/items/combo/combo-rect-selected.svg @@ -0,0 +1,285 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/items/combo/combo-rect.svg b/packages/g6/tests/integration/snapshots/items/combo/combo-rect.svg new file mode 100644 index 00000000000..7a75aeb685b --- /dev/null +++ b/packages/g6/tests/integration/snapshots/items/combo/combo-rect.svg @@ -0,0 +1,271 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/items/node/donut/items-node-donut-custom-attrs.svg b/packages/g6/tests/integration/snapshots/items/node/donut/items-node-donut-custom-attrs.svg new file mode 100644 index 00000000000..9c5a3d24ea3 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/items/node/donut/items-node-donut-custom-attrs.svg @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/items/node/donut/items-node-donut-custom-colors.svg b/packages/g6/tests/integration/snapshots/items/node/donut/items-node-donut-custom-colors.svg new file mode 100644 index 00000000000..0c6f647a37d --- /dev/null +++ b/packages/g6/tests/integration/snapshots/items/node/donut/items-node-donut-custom-colors.svg @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/items/node/donut/items-node-donut-custom-innersize.svg b/packages/g6/tests/integration/snapshots/items/node/donut/items-node-donut-custom-innersize.svg new file mode 100644 index 00000000000..978d6350fe7 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/items/node/donut/items-node-donut-custom-innersize.svg @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/items/node/donut/items-node-donut-selected-style.svg b/packages/g6/tests/integration/snapshots/items/node/donut/items-node-donut-selected-style.svg new file mode 100644 index 00000000000..fc3cdb5c371 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/items/node/donut/items-node-donut-selected-style.svg @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/items/node/donut/items-node-donut.svg b/packages/g6/tests/integration/snapshots/items/node/donut/items-node-donut.svg new file mode 100644 index 00000000000..f2d822bb980 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/items/node/donut/items-node-donut.svg @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/items/node/image/items-node-image.svg b/packages/g6/tests/integration/snapshots/items/node/image/items-node-image.svg new file mode 100644 index 00000000000..16b82d68f97 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/items/node/image/items-node-image.svg @@ -0,0 +1,2211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/edgeFilterLens/plugins-edge-filter-lens-transients.svg b/packages/g6/tests/integration/snapshots/plugins/edgeFilterLens/plugins-edge-filter-lens-transients.svg new file mode 100644 index 00000000000..c7f1aa51235 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/edgeFilterLens/plugins-edge-filter-lens-transients.svg @@ -0,0 +1,416 @@ + + + + + + + + + + + + + + + + + e + + + + + + + + + + + e + + + + + + + + + + + e + + + + + + + + + + + e + + + + + + + + + + + e + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-combo-redo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-combo-redo.svg new file mode 100644 index 00000000000..36a4c410a6e --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-combo-redo.svg @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-combo-undo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-combo-undo.svg new file mode 100644 index 00000000000..1f196ebd67b --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-combo-undo.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-combo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-combo.svg new file mode 100644 index 00000000000..7600a0b486c --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-combo.svg @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-data-redo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-data-redo.svg new file mode 100644 index 00000000000..4f8118d4db1 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-data-redo.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-data-undo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-data-undo.svg new file mode 100644 index 00000000000..d54190a125f --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-data-undo.svg @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-data.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-data.svg new file mode 100644 index 00000000000..2d076f6219c --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-add-data.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-back-item-redo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-back-item-redo.svg new file mode 100644 index 00000000000..29f45f524c8 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-back-item-redo.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-back-item-undo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-back-item-undo.svg new file mode 100644 index 00000000000..337e8ecff3c --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-back-item-undo.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-back-item.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-back-item.svg new file mode 100644 index 00000000000..29f45f524c8 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-back-item.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-clear-item-state-redo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-clear-item-state-redo.svg new file mode 100644 index 00000000000..3b7ac7db226 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-clear-item-state-redo.svg @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-clear-item-state-undo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-clear-item-state-undo.svg new file mode 100644 index 00000000000..d54190a125f --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-clear-item-state-undo.svg @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-clear-item-state.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-clear-item-state.svg new file mode 100644 index 00000000000..3b7ac7db226 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-clear-item-state.svg @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-combo-init.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-combo-init.svg new file mode 100644 index 00000000000..1f196ebd67b --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-combo-init.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-delete-data-redo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-delete-data-redo.svg new file mode 100644 index 00000000000..d54190a125f --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-delete-data-redo.svg @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-delete-data-undo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-delete-data-undo.svg new file mode 100644 index 00000000000..991e3203c56 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-delete-data-undo.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-delete-data.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-delete-data.svg new file mode 100644 index 00000000000..d54190a125f --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-delete-data.svg @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-front-item-redo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-front-item-redo.svg new file mode 100644 index 00000000000..337e8ecff3c --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-front-item-redo.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-front-item-undo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-front-item-undo.svg new file mode 100644 index 00000000000..29f45f524c8 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-front-item-undo.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-front-item.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-front-item.svg new file mode 100644 index 00000000000..337e8ecff3c --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-front-item.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-hide-item-redo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-hide-item-redo.svg new file mode 100644 index 00000000000..e18df1696d6 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-hide-item-redo.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-hide-item-undo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-hide-item-undo.svg new file mode 100644 index 00000000000..d318baecf43 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-hide-item-undo.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-hide-item.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-hide-item.svg new file mode 100644 index 00000000000..e18df1696d6 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-hide-item.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-init.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-init.svg new file mode 100644 index 00000000000..51d1cabf9ba --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-init.svg @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-set-item-state-redo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-set-item-state-redo.svg new file mode 100644 index 00000000000..d54190a125f --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-set-item-state-redo.svg @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-set-item-state-undo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-set-item-state-undo.svg new file mode 100644 index 00000000000..3b7ac7db226 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-set-item-state-undo.svg @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-set-item-state.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-set-item-state.svg new file mode 100644 index 00000000000..d54190a125f --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-set-item-state.svg @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-show-item-redo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-show-item-redo.svg new file mode 100644 index 00000000000..d318baecf43 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-show-item-redo.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-show-item-undo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-show-item-undo.svg new file mode 100644 index 00000000000..e18df1696d6 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-show-item-undo.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-show-item.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-show-item.svg new file mode 100644 index 00000000000..d318baecf43 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-show-item.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-update-data-redo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-update-data-redo.svg new file mode 100644 index 00000000000..5c7f02b32d2 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-update-data-redo.svg @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-update-data-undo.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-update-data-undo.svg new file mode 100644 index 00000000000..379e7cb8842 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-update-data-undo.svg @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-update-data.svg b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-update-data.svg new file mode 100644 index 00000000000..5c7f02b32d2 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/history/plugins-history-update-data.svg @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-add-hull.svg b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-add-hull.svg new file mode 100644 index 00000000000..a311b3984ae --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-add-hull.svg @@ -0,0 +1,57 @@ + + + + + + + + + + + + + hull1-title + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-add-member.svg b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-add-member.svg new file mode 100644 index 00000000000..b83654c137e --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-add-member.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + hull1-title + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-add-node.svg b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-add-node.svg new file mode 100644 index 00000000000..b83654c137e --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-add-node.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + hull1-title + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-add-nonmember.svg b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-add-nonmember.svg new file mode 100644 index 00000000000..812e8b00c38 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-add-nonmember.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + hull1-title + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-remove-hull.svg b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-remove-hull.svg new file mode 100644 index 00000000000..3d83200af24 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-remove-hull.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + hull1-title + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-remove-member.svg b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-remove-member.svg new file mode 100644 index 00000000000..0d30ae973d2 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-remove-member.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + hull1-title + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-remove-node.svg b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-remove-node.svg new file mode 100644 index 00000000000..b025f5d0c2c --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-remove-node.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + hull1-title + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-remove-nonmember.svg b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-remove-nonmember.svg new file mode 100644 index 00000000000..812e8b00c38 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-remove-nonmember.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + hull1-title + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-render-bubble.svg b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-render-bubble.svg new file mode 100644 index 00000000000..85bef5ccfee --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-render-bubble.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + hull1-title + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-render-smooth-convex.svg b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-render-smooth-convex.svg new file mode 100644 index 00000000000..3fb1b4cddff --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-render-smooth-convex.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + hull1-title + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-render.svg b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-render.svg new file mode 100644 index 00000000000..3d83200af24 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-render.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + hull1-title + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-update-config.svg b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-update-config.svg new file mode 100644 index 00000000000..570eb79ae5f --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/hull/plugins-hull-update-config.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + updated-label + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/toolbar/plugins-toolbar-default.svg b/packages/g6/tests/integration/snapshots/plugins/toolbar/plugins-toolbar-default.svg new file mode 100644 index 00000000000..5d54cc48141 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/toolbar/plugins-toolbar-default.svg @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/plugins/watermarker/plugins-watermarker-text.svg b/packages/g6/tests/integration/snapshots/plugins/watermarker/plugins-watermarker-text.svg new file mode 100644 index 00000000000..d7549b10711 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/plugins/watermarker/plugins-watermarker-text.svg @@ -0,0 +1,253 @@ + + + + + + + + + hello + + + antv + + + dasdfasdfaasdfasdfas + + + kjadkja + + + iy32iuhehfka + + + + + + + hello + + + antv + + + dasdfasdfaasdfasdfas + + + kjadkja + + + iy32iuhehfka + + + + + + + hello + + + antv + + + dasdfasdfaasdfasdfas + + + kjadkja + + + iy32iuhehfka + + + + + + + + + hello + + + antv + + + dasdfasdfaasdfasdfas + + + kjadkja + + + iy32iuhehfka + + + + + + + hello + + + antv + + + dasdfasdfaasdfasdfas + + + kjadkja + + + iy32iuhehfka + + + + + + + hello + + + antv + + + dasdfasdfaasdfasdfas + + + kjadkja + + + iy32iuhehfka + + + + + + + + + hello + + + antv + + + dasdfasdfaasdfasdfas + + + kjadkja + + + iy32iuhehfka + + + + + + + hello + + + antv + + + dasdfasdfaasdfasdfas + + + kjadkja + + + iy32iuhehfka + + + + + + + hello + + + antv + + + dasdfasdfaasdfasdfas + + + kjadkja + + + iy32iuhehfka + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-addnode.svg b/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-addnode.svg new file mode 100644 index 00000000000..5cc204c26ef --- /dev/null +++ b/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-addnode.svg @@ -0,0 +1,366 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + cnode1 + + + + + + + cnode2 + + + + + + + node2 + + + + + + + node5 + + + + + + + dynamic... + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-changedata.svg b/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-changedata.svg new file mode 100644 index 00000000000..a62db11ab8d --- /dev/null +++ b/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-changedata.svg @@ -0,0 +1,465 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + cnode1 + + + + + + + dynamic... + + + + + + + c2 + + + + + + + cnode2 + + + + + + + node2 + + + + + + + t2c1-c1 + + + + + + + t2c2 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-changedata2.svg b/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-changedata2.svg new file mode 100644 index 00000000000..a7132c48b4f --- /dev/null +++ b/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-changedata2.svg @@ -0,0 +1,383 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + cnode1 + + + + + + + dynamic... + + + + + + + cnode2 + + + + + + + node2 + + + + + + + node5 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-changelayout.svg b/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-changelayout.svg new file mode 100644 index 00000000000..1c1736b13c7 --- /dev/null +++ b/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-changelayout.svg @@ -0,0 +1,386 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + cnode1 + + + + + + + cnode2 + + + + + + + updated-1 + + + + + + + node5 + + + + + + + dynamic... + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-initial-collapse.svg b/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-initial-collapse.svg new file mode 100644 index 00000000000..17c0d1d138d --- /dev/null +++ b/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-initial-collapse.svg @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-removenode.svg b/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-removenode.svg new file mode 100644 index 00000000000..4ea1321151f --- /dev/null +++ b/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-removenode.svg @@ -0,0 +1,302 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + cnode1 + + + + + + + cnode2 + + + + + + + node2 + + + + + + + node5 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-updatenode.svg b/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-updatenode.svg new file mode 100644 index 00000000000..d83611c9b8f --- /dev/null +++ b/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata-updatenode.svg @@ -0,0 +1,366 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + cnode1 + + + + + + + cnode2 + + + + + + + updated-1 + + + + + + + node5 + + + + + + + dynamic... + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata.svg b/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata.svg new file mode 100644 index 00000000000..6584fb303ce --- /dev/null +++ b/packages/g6/tests/integration/snapshots/treegraph/treegraph-graphdata.svg @@ -0,0 +1,465 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + cnode1 + + + + + + + dynamic... + + + + + + + c2 + + + + + + + cnode2 + + + + + + + node2 + + + + + + + t2c1-c1 + + + + + + + t2c2 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/treegraph/treegraph-treedata-changelayout.svg b/packages/g6/tests/integration/snapshots/treegraph/treegraph-treedata-changelayout.svg new file mode 100644 index 00000000000..6584fb303ce --- /dev/null +++ b/packages/g6/tests/integration/snapshots/treegraph/treegraph-treedata-changelayout.svg @@ -0,0 +1,465 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + cnode1 + + + + + + + dynamic... + + + + + + + c2 + + + + + + + cnode2 + + + + + + + node2 + + + + + + + t2c1-c1 + + + + + + + t2c2 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/treegraph/treegraph-treedata-collapse.svg b/packages/g6/tests/integration/snapshots/treegraph/treegraph-treedata-collapse.svg new file mode 100644 index 00000000000..6584fb303ce --- /dev/null +++ b/packages/g6/tests/integration/snapshots/treegraph/treegraph-treedata-collapse.svg @@ -0,0 +1,465 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + cnode1 + + + + + + + dynamic... + + + + + + + c2 + + + + + + + cnode2 + + + + + + + node2 + + + + + + + t2c1-c1 + + + + + + + t2c2 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/treegraph/treegraph-treedata-expand.svg b/packages/g6/tests/integration/snapshots/treegraph/treegraph-treedata-expand.svg new file mode 100644 index 00000000000..6584fb303ce --- /dev/null +++ b/packages/g6/tests/integration/snapshots/treegraph/treegraph-treedata-expand.svg @@ -0,0 +1,465 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + cnode1 + + + + + + + dynamic... + + + + + + + c2 + + + + + + + cnode2 + + + + + + + node2 + + + + + + + t2c1-c1 + + + + + + + t2c2 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/treegraph/treegraph-treedata-initial-collapse.svg b/packages/g6/tests/integration/snapshots/treegraph/treegraph-treedata-initial-collapse.svg new file mode 100644 index 00000000000..b951048937e --- /dev/null +++ b/packages/g6/tests/integration/snapshots/treegraph/treegraph-treedata-initial-collapse.svg @@ -0,0 +1,270 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/integration/snapshots/treegraph/treegraph-treedata.svg b/packages/g6/tests/integration/snapshots/treegraph/treegraph-treedata.svg new file mode 100644 index 00000000000..6584fb303ce --- /dev/null +++ b/packages/g6/tests/integration/snapshots/treegraph/treegraph-treedata.svg @@ -0,0 +1,465 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node1 + + + + + + + cnode1 + + + + + + + dynamic... + + + + + + + c2 + + + + + + + cnode2 + + + + + + + node2 + + + + + + + t2c1-c1 + + + + + + + t2c2 + + + + + + + \ No newline at end of file diff --git a/packages/g6/tests/bak/timebar-chart.spec.ts b/packages/g6/tests/integration/timebar-chart.spec.ts similarity index 55% rename from packages/g6/tests/bak/timebar-chart.spec.ts rename to packages/g6/tests/integration/timebar-chart.spec.ts index de5af042e72..81799df7e79 100644 --- a/packages/g6/tests/bak/timebar-chart.spec.ts +++ b/packages/g6/tests/integration/timebar-chart.spec.ts @@ -1,24 +1,28 @@ -import { resetEntityCounter } from '@antv/g'; import TimebarTime from '../demo/plugins/timebar-time'; import { createContext } from './utils'; import './utils/useSnapshotMatchers'; -describe('Default Timebar', () => { - beforeEach(() => { - resetEntityCounter(); - }); +const dir = `${__dirname}/snapshots/plugins/timebar`; - it('should be rendered correctly with Canvas2D', (done) => { - const dir = `${__dirname}/snapshots/canvas/plugins/timebar`; - const { backgroundCanvas, canvas, transientCanvas, container } = - createContext('canvas', 500, 500); +describe.skip('Timebar Chart', () => { + it('should be rendered correctly', (done) => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); const graph = TimebarTime({ backgroundCanvas, canvas, + container, + labelCanvas, transientCanvas, + transientLabelCanvas, width: 500, height: 500, - container, }); graph.on('afterlayout', async () => { diff --git a/packages/g6/tests/integration/timebar-timeline.spec.ts b/packages/g6/tests/integration/timebar-timeline.spec.ts new file mode 100644 index 00000000000..3be82b38f6d --- /dev/null +++ b/packages/g6/tests/integration/timebar-timeline.spec.ts @@ -0,0 +1,34 @@ +import TimebarTime from '../demo/plugins/timebar-time'; +import { createContext } from './utils'; +import './utils/useSnapshotMatchers'; + +const dir = `${__dirname}/snapshots/plugins/timebar`; + +describe.skip('Default Timebar', () => { + it('should be rendered correctly', (done) => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); + const graph = TimebarTime({ + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + width: 500, + height: 500, + }); + + graph.on('afterlayout', async () => { + await expect(canvas).toMatchSVGSnapshot(dir, 'plugins-timebar-timeline'); + graph.destroy(); + done(); + }); + }); +}); diff --git a/packages/g6/tests/integration/toolbar-default.spec.ts b/packages/g6/tests/integration/toolbar-default.spec.ts new file mode 100644 index 00000000000..776ffb07f96 --- /dev/null +++ b/packages/g6/tests/integration/toolbar-default.spec.ts @@ -0,0 +1,34 @@ +import toolbar from '../demo/plugins/toolbar'; +import { createContext } from './utils'; +import './utils/useSnapshotMatchers'; + +const dir = `${__dirname}/snapshots/plugins/toolbar`; + +describe('Toolbar', () => { + it('should be rendered correctly', (done) => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); + const graph = toolbar({ + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + width: 500, + height: 500, + }); + + graph.on('afterlayout', async () => { + await expect(canvas).toMatchSVGSnapshot(dir, 'plugins-toolbar-default'); + graph.destroy(); + done(); + }); + }); +}); diff --git a/packages/g6/tests/integration/treegraph-render.spec.ts b/packages/g6/tests/integration/treegraph-render.spec.ts new file mode 100644 index 00000000000..0b0f3b7058e --- /dev/null +++ b/packages/g6/tests/integration/treegraph-render.spec.ts @@ -0,0 +1,220 @@ +import treeGraph from '../demo/tree/treeGraph'; +import { createContext } from './utils'; +import './utils/useSnapshotMatchers'; + +const dir = `${__dirname}/snapshots/treegraph`; + +describe.skip('TreeGraph', () => { + it('graph data with tree layout, remove/add/update node, and change layout', async () => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); + + const graph = treeGraph( + { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + width: 500, + height: 500, + }, + { + dataType: 'graph', + layoutType: 'compactBox', + }, + ); + + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( + dir, + 'treegraph-graphdata', + ); + + // ====== change to tree data ====== + const $changeData = document.getElementById('treegraph-changedata')!; + $changeData.click(); + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( + dir, + 'treegraph-graphdata-changedata', + ); + + $changeData.click(); + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( + dir, + 'treegraph-graphdata-changedata2', + ); + + // ====== remove a node ====== + const $removeNode = document.getElementById('treegraph-removenode')!; + $removeNode.click(); // remove + graph.layout(); + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( + dir, + 'treegraph-graphdata-removenode', + ); + + // ====== add a node ====== + $removeNode.click(); // add + graph.layout(); + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( + dir, + 'treegraph-graphdata-addnode', + ); + + // ====== update a node ====== + const $updateNode = document.getElementById('treegraph-updatenode')!; + $updateNode.click(); // update label + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( + dir, + 'treegraph-graphdata-updatenode', + ); + + // ====== change to graph layout ====== + const $changeLayout = document.getElementById('treegraph-changelayout')!; + $changeLayout.click(); + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( + dir, + 'treegraph-graphdata-changelayout', + ); + + graph.destroy(); + }); + + it('should be rendered correctly with tree data', async () => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); + + const graph = treeGraph( + { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + width: 500, + height: 500, + }, + { + dataType: 'tree', + layoutType: 'compactBox', + }, + ); + + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( + dir, + 'treegraph-treedata', + ); + + // ======= collapse ======= + const $collapse = document.getElementById('treegraph-collapse')!; + $collapse.click(); // collapse + + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( + dir, + 'treegraph-treedata-collapse', + ); + + // ======= expand ======= + $collapse.click(); // expand + + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( + dir, + 'treegraph-treedata-expand', + )!; + + // ======= change layout ======= + const $changeLayout = document.getElementById('treegraph-changelayout')!; + $changeLayout.click(); + + await expect([canvas, labelCanvas]).toMatchSVGSnapshot( + dir, + 'treegraph-treedata-changelayout', + ); + + graph.destroy(); + }); + + it('graph data with initiated collapsed', async () => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); + + const graph = treeGraph( + { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + width: 500, + height: 500, + }, + { + dataType: 'graph', + layoutType: 'compactBox', + defaultCollapse: true, + }, + ); + + await expect(canvas).toMatchSVGSnapshot( + dir, + 'treegraph-graphdata-initial-collapse', + ); + graph.destroy(); + }); + + it('tree data with initiated collapsed', async () => { + const { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + } = createContext(500, 500); + + const graph = treeGraph( + { + backgroundCanvas, + canvas, + container, + labelCanvas, + transientCanvas, + transientLabelCanvas, + width: 500, + height: 500, + }, + { + dataType: 'tree', + layoutType: 'compactBox', + defaultCollapse: true, + }, + ); + + await expect(canvas).toMatchSVGSnapshot( + dir, + 'treegraph-treedata-initial-collapse', + ); + graph.destroy(); + }); +}); diff --git a/packages/g6/tests/integration/utils/toMatchSVGSnapshot.ts b/packages/g6/tests/integration/utils/toMatchSVGSnapshot.ts index cadc50b5659..853bdcfceb0 100644 --- a/packages/g6/tests/integration/utils/toMatchSVGSnapshot.ts +++ b/packages/g6/tests/integration/utils/toMatchSVGSnapshot.ts @@ -6,55 +6,71 @@ import { format } from 'prettier'; import { sleep } from './sleep'; export type ToMatchSVGSnapshotOptions = { - selector?: string; fileFormat?: string; keepSVGElementId?: boolean; }; const formatSVG = (svg: string, keepSVGElementId: boolean) => { - return keepSVGElementId - ? svg - : svg.replace(/id="[^"]*"/g, '').replace(/clip-path="[^"]*"/g, ''); + return ( + keepSVGElementId + ? svg + : svg.replace(/id="[^"]*"/g, '').replace(/clip-path="[^"]*"/g, '') + ).replace('\r\n', '\n'); }; +/** + * Merge multiple svg into one. + */ // @see https://jestjs.io/docs/26.x/expect#expectextendmatchers export async function toMatchSVGSnapshot( - gCanvas: Canvas, + gCanvas: Canvas | Canvas[], dir: string, name: string, options: ToMatchSVGSnapshotOptions = {}, ): Promise<{ message: () => string; pass: boolean }> { await sleep(300); - const { selector, fileFormat = 'svg', keepSVGElementId = true } = options; + const { fileFormat = 'svg', keepSVGElementId = true } = options; const namePath = path.join(dir, name); const actualPath = path.join(dir, `${name}-actual.${fileFormat}`); const expectedPath = path.join(dir, `${name}.${fileFormat}`); - const dom = gCanvas - .getContextService() - .getDomElement() as unknown as SVGElement; + const gCanvases = Array.isArray(gCanvas) ? gCanvas : [gCanvas]; - let actual; - try { - if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true }); + let actual: string = ''; + + // Clone + const svg = ( + gCanvases[0].getContextService().getDomElement() as unknown as SVGElement + ).cloneNode(true) as SVGElement; + const gRoot = svg.querySelector('#g-root'); + + gCanvases.slice(1).forEach((gCanvas) => { + const dom = ( + gCanvas.getContextService().getDomElement() as unknown as SVGElement + ).cloneNode(true) as SVGElement; - actual = dom - ? formatSVG( - format(xmlserializer.serializeToString(dom as any), { - parser: 'babel', - }), - keepSVGElementId, - ) - : 'null'; + gRoot?.append(...(dom.querySelector('#g-root')?.childNodes || [])); + }); - // Remove ';' after format by babel. - if (actual !== 'null') actual = actual.slice(0, -2); + actual += svg + ? formatSVG( + format(xmlserializer.serializeToString(svg as any), { + parser: 'babel', + }), + keepSVGElementId, + ) + : 'null'; + // Remove ';' after format by babel. + if (actual !== 'null') actual = actual.slice(0, -2); + + try { + if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true }); if (!fs.existsSync(expectedPath)) { if (process.env.CI === 'true') { throw new Error(`Please generate golden image for ${namePath}`); } console.warn(`! generate ${namePath}`); - await fs.writeFileSync(expectedPath, actual); + fs.writeFileSync(expectedPath, actual); return { message: () => `generate ${namePath}`, pass: true,