chore: add integration snapshots

This commit is contained in:
liujiangyu 2023-09-12 13:26:52 +08:00
parent cb19126a5a
commit c9c2e96fe5
8 changed files with 32 additions and 5 deletions

View File

@ -38,6 +38,7 @@ export default (context: TestCaseContext) => {
{
type: 'scroll-canvas',
enableOptimize: true,
zoomRatio: 0.2,
// scalableRange: 0.5,
// direction: 'y',
// optimizeZoom: 0.5,

View File

@ -1,8 +1,15 @@
import { resetEntityCounter } from '@antv/g';
import scrollCanvas from '../demo/behaviors/activate-relations';
import scrollCanvas from '../demo/behaviors/scroll-canvas';
import './utils/useSnapshotMatchers';
import { createContext, triggerEvent } from './utils';
function sleep(time: number) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(null)
}, time)
})
}
describe('Scroll canvas behavior', () => {
beforeEach(() => {
/**
@ -36,8 +43,16 @@ describe('Scroll canvas behavior', () => {
deltaX: 50,
deltaY: 50,
});
await sleep(2000)
await expect(canvas).toMatchCanvasSnapshot(dir, 'behaviors-scroll-canvas-wheel');
await expect(canvas).toMatchSVGSnapshot(dir, 'behaviors-scroll-canvas-scrolled');
graph.emit('wheel', {
client: { x: 50, y: 50 },
ctrlKey: true
});
await sleep(2000)
await expect(canvas).toMatchCanvasSnapshot(dir, 'behaviors-scroll-canvas-zoom');
graph.destroy();
done();
@ -65,9 +80,18 @@ describe('Scroll canvas behavior', () => {
deltaX: 50,
deltaY: 50,
});
await expect(canvas).toMatchSVGSnapshot(dir, 'behaviors-scroll-canvas-scrolled');
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();
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.1 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.2 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB