fix(language-server): don't self-close tags inside quoted attribute values
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user