Skip to content

Commit

Permalink
docs: add sub graph demo (#6242)
Browse files Browse the repository at this point in the history
* fix(elements): correct html bounds shape position

* fix(elements): html node only forward event in canvas renderer

* refactor(utils): createPluginContainer support style param

* fix(plugins): set contextmenu container in a high zIndex

* refactor: adjust comment and export effect

* fix: fix expanded elements with wrong z-index

* docs: add sub graph demo

---------

Co-authored-by: antv <[email protected]>
  • Loading branch information
Aarebecca and antv authored Aug 29, 2024
1 parent 35d917c commit aa87ec6
Show file tree
Hide file tree
Showing 17 changed files with 907 additions and 86 deletions.
35 changes: 35 additions & 0 deletions packages/g6/__tests__/bugs/api-expand-element-z-index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { createGraph } from '@@/utils';

describe('api expand element z-index', () => {
it('when expand element, the z-index of descendant elements should be updated', async () => {
const graph = createGraph({
animation: false,
data: {
nodes: [{ id: 'node-1' }, { id: 'node-2', combo: 'combo-2' }],
combos: [
{ id: 'combo-1', style: { collapsed: true } },
{ id: 'combo-2', combo: 'combo-1', style: { collapsed: true } },
],
},
});

await graph.draw();

// @ts-expect-error context is private
const context = graph.context;

graph.frontElement('node-1');

expect(context.element!.getElement('node-1')!.style.zIndex).toBe(1);

graph.frontElement('combo-1');

expect(context.element!.getElement('combo-1')!.style.zIndex).toBe(2);

await graph.expandElement('combo-1', false);

await graph.expandElement('combo-2', false);

expect(context.element!.getElement('node-2')!.style.zIndex).toBe(2);
});
});
Loading

0 comments on commit aa87ec6

Please sign in to comment.