-
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.
fix: destroy shape after change icon type
- Loading branch information
antv
authored and
Aaron
committed
Aug 6, 2024
1 parent
7ce727a
commit c218dcc
Showing
5 changed files
with
81 additions
and
5 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
packages/g6/__tests__/bugs/element-node-icon-switch.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,33 @@ | ||
import { createGraph } from '@@/utils'; | ||
|
||
describe('bug: element-node-icon-switch', () => { | ||
it('change node icon', async () => { | ||
const graph = createGraph({ | ||
animation: false, | ||
data: { | ||
nodes: [{ id: 'node-1', style: { x: 50, y: 50, iconText: 'Text' } }], | ||
}, | ||
node: { | ||
style: {}, | ||
}, | ||
}); | ||
|
||
await graph.draw(); | ||
|
||
await expect(graph).toMatchSnapshot(__filename, 'text-icon'); | ||
|
||
graph.updateNodeData([ | ||
{ | ||
id: 'node-1', | ||
style: { | ||
iconText: '', | ||
iconSrc: 'https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*AzSISZeq81IAAAAAAAAAAAAADmJ7AQ/original', | ||
}, | ||
}, | ||
]); | ||
|
||
await graph.draw(); | ||
|
||
await expect(graph).toMatchSnapshot(__filename, 'image-icon'); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
packages/g6/__tests__/snapshots/bugs/element-node-icon-switch/image-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
packages/g6/__tests__/snapshots/bugs/element-node-icon-switch/text-icon.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
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