-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add test case, update snapshots
- Loading branch information
antv
committed
Nov 11, 2024
1 parent
624dc79
commit 52c7f4c
Showing
48 changed files
with
398 additions
and
334 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
packages/g6/__tests__/bugs/model-add-edge-in-combo.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { createGraph } from '@@/utils'; | ||
|
||
describe('add edge in combo', () => { | ||
it('add edge in combo without zIndex', async () => { | ||
const graph = createGraph({ | ||
data: { | ||
nodes: [ | ||
{ id: 'node-1', combo: 'combo-1', style: { x: 100, y: 100 } }, | ||
{ id: 'node-2', combo: 'combo-1', style: { x: 200, y: 200 } }, | ||
], | ||
combos: [{ id: 'combo-1' }], | ||
}, | ||
}); | ||
|
||
await graph.draw(); | ||
|
||
graph.addEdgeData([{ id: 'edge', source: 'node-1', target: 'node-2' }]); | ||
await graph.draw(); | ||
|
||
expect(graph.getEdgeData('edge').style?.zIndex).toBe(undefined); | ||
// @ts-expect-error skip the type check | ||
expect(graph.context.element?.getElement('edge')?.style.zIndex).toBe(1); | ||
}); | ||
|
||
it('add edge in combo with zIndex', async () => { | ||
const graph = createGraph({ | ||
data: { | ||
nodes: [ | ||
{ id: 'node-1', combo: 'combo-1', style: { x: 100, y: 100 } }, | ||
{ id: 'node-2', combo: 'combo-1', style: { x: 200, y: 200 } }, | ||
{ id: 'node-3', style: { x: 300, y: 300, zIndex: 5 } }, | ||
], | ||
combos: [{ id: 'combo-1' }], | ||
}, | ||
}); | ||
|
||
await graph.draw(); | ||
|
||
expect(graph.getComboData('combo-1').style?.zIndex).toBe(undefined); | ||
|
||
await graph.frontElement('combo-1'); | ||
|
||
expect(graph.getComboData('combo-1').style?.zIndex).toBe(5 + 1); | ||
|
||
graph.addEdgeData([{ id: 'edge', source: 'node-1', target: 'node-2' }]); | ||
await graph.draw(); | ||
|
||
expect(graph.getEdgeData('edge').style?.zIndex).toBe(undefined); | ||
// @ts-expect-error skip the type check | ||
expect(graph.context.element?.getElement('edge')?.style.zIndex).toBe(5 + 1 + 1); | ||
}); | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.