Skip to content

Commit 39e7050

Browse files
committed
fix(vega-lite): Improve test util types for test keys
1 parent 98eba15 commit 39e7050

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

test-runtime/util.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,19 +306,25 @@ export function clear(idx: number, parent?: string, targetBrush?: boolean) {
306306
return `pureClear(${idx}, ${stringValue(parent)}, ${!!targetBrush})`;
307307
}
308308

309-
export function clearRegion(idx: number, parent?: string, targetBrush?: boolean) {
309+
export function clearRegion(idx: number | {
310+
id: number;
311+
count?: number;
312+
}, parent?: string, targetBrush?: boolean) {
310313
return `clear(${idx}, ${stringValue(parent)}, ${!!targetBrush})`;
311314
}
312315

313-
export function circleRegion(idx: number, parent?: string, targetBrush?: boolean, radius = 40, segments = 20) {
316+
export function circleRegion(idx: number | {
317+
id: number;
318+
count?: number;
319+
}, parent?: string, targetBrush?: boolean, radius = 40, segments = 20) {
314320
return `circleRegion(${idx}, ${radius}, ${segments}, ${stringValue(parent)}, ${!!targetBrush})`;
315321
}
316322

317323
export function polygonRegion(idx: number, polygon: number[][], parent?: string, targetBrush?: boolean) {
318324
return `polygonRegion(${idx}, ${JSON.stringify(polygon)}, ${stringValue(parent)}, ${!!targetBrush})`;
319325
}
320326

321-
export function multiviewRegion(key: string, idx: number, parent?: string, targetBrush?: boolean) {
327+
export function multiviewRegion(key: keyof typeof hits.region, idx: number, parent?: string, targetBrush?: boolean) {
322328
return key.match('_clear')
323329
? clearRegion(hits.region[key][idx], parent, targetBrush)
324330
: circleRegion(hits.region[key][idx], parent, targetBrush, 10);
@@ -329,7 +335,7 @@ export function brush(key: BrushKeys, idx: number, parent?: string, targetBrush?
329335
return `${fn}(${hits.interval[key][idx].join(', ')}, ${stringValue(parent)}, ${!!targetBrush})`;
330336
}
331337

332-
export function pt(key: string, idx: number, parent?: string) {
338+
export function pt(key: keyof typeof hits.point, idx: number, parent?: string) {
333339
const fn = key.match('_clear') ? 'clear' : 'pt';
334340
return `${fn}(${hits.point[key][idx]}, ${stringValue(parent)})`;
335341
}

0 commit comments

Comments
 (0)