-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add parameter config support to layout function (#6762)
* feat: add parameter config support to layout function * chore: optimize default options of layout
- Loading branch information
1 parent
0c818c0
commit a82674b
Showing
9 changed files
with
2,741 additions
and
8 deletions.
There are no files selected for viewing
538 changes: 538 additions & 0 deletions
538
packages/g6/__tests__/snapshots/runtime/layout/empty.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
538 changes: 538 additions & 0 deletions
538
packages/g6/__tests__/snapshots/runtime/layout/extra.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
538 changes: 538 additions & 0 deletions
538
packages/g6/__tests__/snapshots/runtime/layout/layout-array.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
538 changes: 538 additions & 0 deletions
538
packages/g6/__tests__/snapshots/runtime/layout/other-type.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
538 changes: 538 additions & 0 deletions
538
packages/g6/__tests__/snapshots/runtime/layout/recover.svg
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,42 @@ | ||
import { layoutCircularBasic } from '@@/demos'; | ||
import { createDemoGraph } from '@@/utils'; | ||
|
||
describe('layout options', () => { | ||
it('layoutEmptyOptions', async () => { | ||
const graph = await createDemoGraph(layoutCircularBasic); | ||
await expect(graph).toMatchSnapshot(__filename, 'empty'); | ||
graph.destroy(); | ||
}); | ||
|
||
it('layoutExtraOptions', async () => { | ||
const graph = await createDemoGraph(layoutCircularBasic); | ||
await graph.layout({ | ||
type: 'circular', | ||
radius: 1000, | ||
}); | ||
await expect(graph).toMatchSnapshot(__filename, 'extra'); | ||
graph.destroy(); | ||
}); | ||
|
||
it('layoutOtherTypeOptionsAndRecover', async () => { | ||
const graph = await createDemoGraph(layoutCircularBasic); | ||
await graph.layout({ | ||
type: 'concentric', | ||
}); | ||
await expect(graph).toMatchSnapshot(__filename, 'other-type'); | ||
await graph.layout(); | ||
await expect(graph).toMatchSnapshot(__filename, 'recover'); | ||
graph.destroy(); | ||
}); | ||
|
||
it('layoutArrayOptions', async () => { | ||
const graph = await createDemoGraph(layoutCircularBasic); | ||
await graph.layout( | ||
Array.from({ length: 4 }, () => ({ | ||
type: 'circular', | ||
})), | ||
); | ||
await expect(graph).toMatchSnapshot(__filename, 'layout-array'); | ||
graph.destroy(); | ||
}); | ||
}); |
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
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