Support Angular v21.2 (#18722)

This commit is contained in:
fisker Cheung authored and GitHub committed 2026-04-10 10:03:27 +08:00
1 parent e4944b2c7a
commit 384cf33671
9 files changed
+231 -14

No files matched your search

@@ -1,5 +1,63 @@
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
exports[`arrow-function.html format 1`] = `
====================================options=====================================
parsers: ["angular"]
printWidth: 80 (default) |
=====================================input======================================
@let fn = (a, b) => componentValue + a + b;
One: {{fn(0, 1)}}
@if (true) {
Two: {{fn(1, 1)}}
<button (click)=" componentValue = fn(2, 1)"></button>
<button (click)=" componentValue => fn(2, 1)"></button>
}
{{[(a) => a + 1][0](1000)}}
{{[(a ) => a + 1 + componentProp][0](1000)}}
@let a = 1;
@if (true) {
@let b = 2;
@if (true) {
@let c = 3;
{{(() => a + b + c)()}}
}
}
=====================================output=====================================
@let fn = (a, b) => componentValue + a + b; One: {{ fn(0, 1) }}
@if (true) {
Two: {{ fn(1, 1) }}
<button (click)="componentValue = fn(2, 1)"></button>
<button (click)="(componentValue) => fn(2, 1)"></button>
}
{{ [(a) => a + 1][0](1000) }}
{{ [(a) => a + 1 + componentProp][0](1000) }}
@let a = 1;
@if (true) {
@let b = 2;
@if (true) {
@let c = 3;
{{ (() => a + b + c)() }}
}
}
================================================================================
`;
exports[`exponentiation-operators.html format 1`] = `
====================================options=====================================
parsers: ["angular"]
@@ -31,6 +89,22 @@ parsers: ["angular"]
================================================================================
`;
exports[`instanceof-operator.html format 1`] = `
====================================options=====================================
parsers: ["angular"]
printWidth: 80 (default) |
=====================================input======================================
{{
( (a instanceof (b)))
}}
=====================================output=====================================
{{ a instanceof b }}
================================================================================
`;
exports[`spread-element.html format 1`] = `
====================================options=====================================
parsers: ["angular"]
@@ -0,0 +1,49 @@
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
exports[`snippet: #0 - {"arrowParens":"avoid"} format 1`] = `
====================================options=====================================
arrowParens: "avoid"
parsers: ["angular"]
printWidth: 80 (default) |
=====================================input======================================
@let fn = ( oneArgument) => 1;
=====================================output=====================================
@let fn = oneArgument => 1;
================================================================================
`;
exports[`snippet: #0 - {"printWidth":1,"trailingComma":"all"} format 1`] = `
====================================options=====================================
parsers: ["angular"]
printWidth: 1
trailingComma: "all"
| printWidth: 1
=====================================input======================================
@let fn = ( should, not, print,trailing, comma) => 1;
=====================================output=====================================
@let fn =
(
should,
not,
print,
trailing,
comma
) =>
1;
================================================================================
`;
exports[`snippet: #1 - {"arrowParens":"avoid"} format 1`] = `
====================================options=====================================
arrowParens: "avoid"
parsers: ["angular"]
printWidth: 80 (default) |
=====================================input======================================
@let fn = oneArgument => 1;
=====================================output=====================================
@let fn = oneArgument => 1;
================================================================================
`;
@@ -0,0 +1,20 @@
runFormatTest(
{
importMeta: import.meta,
snippets: ["@let fn = ( should, not, print,trailing, comma) => 1;"],
},
["angular"],
{ printWidth: 1, trailingComma: "all" },
);
runFormatTest(
{
importMeta: import.meta,
snippets: [
"@let fn = ( oneArgument) => 1;",
"@let fn = oneArgument => 1;",
],
},
["angular"],
{ arrowParens: "avoid" },
);
@@ -0,0 +1,25 @@
@let fn = (a, b) => componentValue + a + b;
One: {{fn(0, 1)}}
@if (true) {
Two: {{fn(1, 1)}}
<button (click)=" componentValue = fn(2, 1)"></button>
<button (click)=" componentValue => fn(2, 1)"></button>
}
{{[(a) => a + 1][0](1000)}}
{{[(a ) => a + 1 + componentProp][0](1000)}}
@let a = 1;
@if (true) {
@let b = 2;
@if (true) {
@let c = 3;
{{(() => a + b + c)()}}
}
}
@@ -0,0 +1,4 @@
{{
( (a instanceof (b)))
}}