Skip to content

Commit 93648c7

Browse files
CopilotAlexzjt
andauthored
fix: legend positioning when resizing with bottom center layout (#7254)
* Initial plan * fix: legend positioning when resizing with bottom center layout Co-authored-by: Alexzjt <9548248+Alexzjt@users.noreply.github.com> * fix: restore accidentally deleted chartChangeSizePolar.svg snapshot Co-authored-by: Alexzjt <9548248+Alexzjt@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Alexzjt <9548248+Alexzjt@users.noreply.github.com> Co-authored-by: huiyu.zjt <Alexzjt@users.noreply.github.com>
1 parent 11fc976 commit 93648c7

File tree

5 files changed

+441
-2
lines changed

5 files changed

+441
-2
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { chartChangeSizeLegendBottomCenter as render } from '../plots/api/chart-change-size-legend-bottom-center';
2+
import { createNodeGCanvas } from './utils/createNodeGCanvas';
3+
import { sleep } from './utils/sleep';
4+
import './utils/useSnapshotMatchers';
5+
6+
describe('chart.changeSize with legend bottom center', () => {
7+
const canvas = createNodeGCanvas(640, 480);
8+
9+
it('chart.changeSize(width, height) should correctly position centered bottom legend', async () => {
10+
const { finished, button, resized } = render({
11+
canvas,
12+
container: document.createElement('div'),
13+
});
14+
await finished;
15+
button.dispatchEvent(new CustomEvent('click'));
16+
await resized;
17+
const dir = `${__dirname}/snapshots/api`;
18+
await sleep(20);
19+
await expect(canvas).toMatchDOMSnapshot(dir, render.name);
20+
});
21+
22+
afterAll(() => {
23+
canvas?.destroy();
24+
});
25+
});

0 commit comments

Comments
 (0)