Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(label): implement label color inheritance from dependent elements #6536

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions __tests__/integration/issue-5474.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { issue5474 as render } from '../plots/bugfix/issue-5474';
import { createNodeGCanvas } from './utils/createNodeGCanvas';
import { sleep } from './utils/sleep';
import './utils/useSnapshotMatchers';

describe('issue5474', () => {
const canvas = createNodeGCanvas(800, 500);

it('issue5474.render() should render chart with labels matching element colors', async () => {
const { chart } = render({
canvas,
container: document.createElement('div'),
});

await chart.render();
await sleep(20);

const labels = canvas.document.getElementsByClassName('label');
expect(labels.length).toBeGreaterThan(0);

labels.forEach((label) => {
expect(label.style.fill).toBe(
// @ts-ignore
label.__data__.dependentElement.attributes.fill,
);
});

const dir = `${__dirname}/snapshots/bugfix`;
await expect(canvas).toMatchDOMSnapshot(dir, render.name);
});

afterAll(() => {
canvas?.destroy();
});
});
Loading
Loading