Core: classify spec data blocks by Vega-Lite fidelity (spec-data) for dataset refs

This commit is contained in:
2026-06-28 19:48:24 +03:00
parent 31458114fb
commit e69430834a
9 changed files with 385 additions and 142 deletions
+20
View File
@@ -203,6 +203,26 @@ describe('prepareSpecForRender — dataset resolution (spec §04 Rendering Contr
expect(out.data).toEqual({ name: 'local' });
});
test('native Vega-Lite data with a name label is left untouched (not resolved, never throws)', () => {
// A name on inline/url data, or a generator, is native Vega-Lite — even when
// the name is absent from the library. Resolution must not touch or reject it.
const inline = { data: { name: 'pts', values: [{ a: 1 }] }, mark: 'point' };
expect(prepareSpecForRender(inline, { datasets }).data).toEqual({
name: 'pts',
values: [{ a: 1 }],
});
const url = { data: { name: 'remote', url: 'https://x/y.csv' } };
expect(prepareSpecForRender(url, { datasets }).data).toEqual({
name: 'remote',
url: 'https://x/y.csv',
});
const gen = { data: { name: 'seq', sequence: { start: 0, stop: 5 } } };
expect(prepareSpecForRender(gen, { datasets }).data).toEqual({
name: 'seq',
sequence: { start: 0, stop: 5 },
});
});
test('resolution runs before fit-mode: a ref + fit mode produce both transforms', () => {
const spec = { data: { name: 'JsonDs' }, mark: 'bar' };
const out = prepareSpecForRender(spec, { datasets, fitMode: 'full' }) as unknown as {