fix(editor): type nested attribute expressions
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { expect, test } from "bun:test";
|
||||
import { diagnose, formatDiagnostic, parse } from "../src/index.ts";
|
||||
import { diagnose, extractInterpolations, formatDiagnostic, parse } from "../src/index.ts";
|
||||
|
||||
test("parses explicit rendering modes and the never hydration alias", () => {
|
||||
const ast = parse(`page Marketing {
|
||||
@@ -337,3 +337,14 @@ test("a block comment inside props is still refused with its own message", () =>
|
||||
`;
|
||||
expect(() => parse(source)).toThrow("Block comments are not allowed inside props");
|
||||
});
|
||||
|
||||
test("extracts nested object and array interpolation as one expression", () => {
|
||||
const value = `prefix {[{ label: 'One', meta: { count: 1 } }, { label: "Two" }]} suffix`;
|
||||
expect(extractInterpolations(value)).toEqual([
|
||||
{
|
||||
expression: `[{ label: 'One', meta: { count: 1 } }, { label: "Two" }]`,
|
||||
start: 7,
|
||||
end: value.length - 7,
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user