Chart builder: discoverable entry points — Build Chart door, dataset picker, no-datasets state

This commit is contained in:
2026-06-12 21:46:25 +03:00
parent dbb4522d78
commit ca70b3e491
22 changed files with 625 additions and 75 deletions
+24 -3
View File
@@ -80,7 +80,7 @@ describe('ChartBuilderModal', () => {
await Promise.resolve();
});
expect(container.textContent).toContain('Building from');
expect(container.textContent).toContain('Nums'); // the dataset picker names the data
expect(container.textContent).toContain('scatter'); // the guidance hint rendered
});
@@ -155,12 +155,33 @@ describe('ChartBuilderModal', () => {
vi.useRealTimers();
});
test('shows the empty state when no dataset is loaded', async () => {
test('shows the no-datasets empty state with its one next step (3D)', async () => {
await act(async () => {
root.render(<ChartBuilderModal />);
await Promise.resolve();
});
expect(container.textContent).toContain('No dataset loaded');
expect(container.textContent).toContain('No datasets yet');
const action = Array.from(container.querySelectorAll('button')).find(
(b) => b.textContent === 'Add a dataset',
);
expect(action).toBeDefined();
});
test('offers a dataset chooser when datasets exist but none is loaded', async () => {
const ds = createDataset({
name: 'Waiting',
data: [{ a: 1 }],
format: 'json',
source: 'inline',
now: T,
});
useDatasetStore.getState().add(ds);
await act(async () => {
root.render(<ChartBuilderModal />);
await Promise.resolve();
});
expect(container.textContent).toContain('Choose a dataset');
});
test('a complete filter row reaches the renderer as a top-level transform (1C)', async () => {