fix(language-server): don't self-close tags inside quoted attribute values

This commit is contained in:
2026-08-18 20:47:19 +05:30
parent 609224591c
commit d77638131b
2 changed files with 57 additions and 2 deletions
@@ -96,6 +96,36 @@ test("completes a self-closing component tag", () => {
expect(htmlTagComplete(doc(text), positionOf(text, "<Card /"))).toBe(">");
});
test("does not misfire inside a quoted attribute value containing a slash", () => {
const doubleQuoted = `page A {
view {
<a href="https:/
}
}
`;
expect(htmlTagComplete(doc(doubleQuoted), positionOf(doubleQuoted, `href="https:/`))).toBeNull();
const singleQuoted = `page A {
view {
<img src='/assets/
}
}
`;
expect(
htmlTagComplete(doc(singleQuoted), positionOf(singleQuoted, `src='/assets/`)),
).toBeNull();
});
test("still completes a self-close after a preceding attribute", () => {
const text = `page A {
view {
<Card title="x" /
}
}
`;
expect(htmlTagComplete(doc(text), positionOf(text, `title="x" /`))).toBe(">");
});
test("returns no tag completion outside a view block", () => {
const text = `page A {
functions {