-
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: combo combined layout test (#5535)
- Loading branch information
Showing
8 changed files
with
676 additions
and
193 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,41 @@ | ||
import { Graph } from '@/src'; | ||
import data from '@@/dataset/combo.json'; | ||
import type { STDTestCase } from '../types'; | ||
|
||
type Item = { | ||
id: string; | ||
data: { | ||
size?: number; | ||
color?: string; | ||
}; | ||
}; | ||
|
||
export const layoutComboCombined: STDTestCase = async (context) => { | ||
const graph = new Graph({ | ||
...context, | ||
data, | ||
layout: { | ||
type: 'combo-combined', | ||
comboPadding: 2, | ||
}, | ||
node: { | ||
style: { | ||
size: 20, | ||
labelText: (d: Item) => d.id, | ||
}, | ||
}, | ||
edge: { | ||
// @ts-expect-error | ||
style: (model: Item) => { | ||
const { size, color } = model.data; | ||
return { stroke: color || '#99ADD1', lineWidth: size || 1 }; | ||
}, | ||
}, | ||
behaviors: ['drag-combo', 'drag-node', 'drag-canvas', 'zoom-canvas'], | ||
autoFit: 'view', | ||
}); | ||
|
||
await graph.render(); | ||
|
||
return graph; | ||
}; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,11 @@ | ||
import { layoutComboCombined } from '@@/demo/case'; | ||
import { createDemoGraph } from '@@/utils'; | ||
|
||
describe('combo layout', () => { | ||
/** ComboCombinedLayout 在当前环境下运行异常 */ | ||
it.skip('combined', async () => { | ||
const graph = await createDemoGraph(layoutComboCombined); | ||
await expect(graph).toMatchSnapshot(__filename, 'combined'); | ||
graph.destroy(); | ||
}); | ||
}); |
Oops, something went wrong.