-
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
committed
Aug 6, 2024
1 parent
7ce727a
commit 2e80c9f
Showing
7 changed files
with
162 additions
and
6 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
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,61 @@ | ||
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'); | ||
|
||
graph.updateNodeData([ | ||
{ | ||
id: 'node-1', | ||
style: { | ||
iconType: 'text', | ||
iconText: 'Text', | ||
iconSrc: 'https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*AzSISZeq81IAAAAAAAAAAAAADmJ7AQ/original', | ||
}, | ||
}, | ||
]); | ||
|
||
await graph.draw(); | ||
|
||
await expect(graph).toMatchSnapshot(__filename, 'type-text'); | ||
|
||
graph.updateNodeData([ | ||
{ | ||
id: 'node-1', | ||
style: { | ||
iconType: 'image', | ||
}, | ||
}, | ||
]); | ||
|
||
await graph.draw(); | ||
|
||
await expect(graph).toMatchSnapshot(__filename, 'type-image'); | ||
}); | ||
}); |
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.
19 changes: 19 additions & 0 deletions
19
packages/g6/__tests__/snapshots/bugs/element-node-icon-switch/type-image.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/type-text.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