Skip to content

Commit

Permalink
Correctly handle arrow function expression arguments when used with n…
Browse files Browse the repository at this point in the history
…on-'on' properties
  • Loading branch information
STRd6 committed Jan 30, 2025
1 parent 5594fac commit 1a4682e
Show file tree
Hide file tree
Showing 32 changed files with 2,730 additions and 41 deletions.
56 changes: 56 additions & 0 deletions packages/core/src/__tests__/__snapshots__/alpine.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1999,6 +1999,34 @@ Auto Width\\":false,\\"Full Width\\":\\"full\\"}}}}} */
"
`;
exports[`Alpine.js > jsx > Javascript Test > functionProps 1`] = `
"<p
x-data=\\"myBasicComponent()\\"
x-bind:f=\\"() => x\\"
x-bind:f1=\\"x => x\\"
x-bind:f2=\\"x => {}\\"
x-bind:f3=\\"function () {
return x;
}\\"
x-bind:f4=\\"function (x) {
return x;
}\\"
x-bind:f5=\\"function (x) {
return;
}\\"
x-bind:f6=\\"function () {
return;
}\\"
x-bind:f7=\\"(a, b, c) => a + b + c\\"
></p>
<script>
document.addEventListener(\\"alpine:init\\", () => {
Alpine.data(\\"myBasicComponent\\", () => ({}));
});
</script>
"
`;
exports[`Alpine.js > jsx > Javascript Test > getterState 1`] = `
"<div x-data=\\"button()\\">
<p><span x-html=\\"foo2\\"></span></p>
Expand Down Expand Up @@ -5143,6 +5171,34 @@ Auto Width\\":false,\\"Full Width\\":\\"full\\"}}}}} */
"
`;
exports[`Alpine.js > jsx > Typescript Test > functionProps 1`] = `
"<p
x-data=\\"myBasicComponent()\\"
x-bind:f=\\"() => x\\"
x-bind:f1=\\"x => x\\"
x-bind:f2=\\"x => {}\\"
x-bind:f3=\\"function () {
return x;
}\\"
x-bind:f4=\\"function (x) {
return x;
}\\"
x-bind:f5=\\"function (x) {
return;
}\\"
x-bind:f6=\\"function () {
return;
}\\"
x-bind:f7=\\"(a, b, c) => a + b + c\\"
></p>
<script>
document.addEventListener(\\"alpine:init\\", () => {
Alpine.data(\\"myBasicComponent\\", () => ({}));
});
</script>
"
`;
exports[`Alpine.js > jsx > Typescript Test > getterState 1`] = `
"<div x-data=\\"button()\\">
<p><span x-html=\\"foo2\\"></span></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4747,6 +4747,53 @@ export class FigmaButtonModule {}
"
`;

exports[`Angular with Preserve Imports and File Extensions > jsx > Javascript Test > functionProps 1`] = `
"import { NgModule } from \\"@angular/core\\";
import { CommonModule } from \\"@angular/common\\";

import { Component } from \\"@angular/core\\";

@Component({
selector: \\"my-basic-component\\",
template: \`
<p
[attr.f]=\\"() => x\\"
[attr.f1]=\\"x => x\\"
[attr.f2]=\\"x => {}\\"
[attr.f3]=\\"function () {
return x;
}\\"
[attr.f4]=\\"function (x) {
return x;
}\\"
[attr.f5]=\\"function (x) {
return;
}\\"
[attr.f6]=\\"function () {
return;
}\\"
[attr.f7]=\\"(a, b, c) => a + b + c\\"
></p>
\`,
styles: [
\`
:host {
display: contents;
}
\`,
],
})
export default class MyBasicComponent {}

@NgModule({
declarations: [MyBasicComponent],
imports: [CommonModule],
exports: [MyBasicComponent],
})
export class MyBasicComponentModule {}
"
`;

exports[`Angular with Preserve Imports and File Extensions > jsx > Javascript Test > getterState 1`] = `
"import { NgModule } from \\"@angular/core\\";
import { CommonModule } from \\"@angular/common\\";
Expand Down Expand Up @@ -12771,6 +12818,57 @@ export class FigmaButtonModule {}
"
`;

exports[`Angular with Preserve Imports and File Extensions > jsx > Typescript Test > functionProps 1`] = `
"import { NgModule } from \\"@angular/core\\";
import { CommonModule } from \\"@angular/common\\";

import { Component } from \\"@angular/core\\";

export interface MyBasicComponentProps {
id: string;
}

@Component({
selector: \\"my-basic-component\\",
template: \`
<p
[attr.f]=\\"() => x\\"
[attr.f1]=\\"x => x\\"
[attr.f2]=\\"x => {}\\"
[attr.f3]=\\"function () {
return x;
}\\"
[attr.f4]=\\"function (x) {
return x;
}\\"
[attr.f5]=\\"function (x) {
return;
}\\"
[attr.f6]=\\"function () {
return;
}\\"
[attr.f7]=\\"(a, b, c) => a + b + c\\"
></p>
\`,
styles: [
\`
:host {
display: contents;
}
\`,
],
})
export default class MyBasicComponent {}

@NgModule({
declarations: [MyBasicComponent],
imports: [CommonModule],
exports: [MyBasicComponent],
})
export class MyBasicComponentModule {}
"
`;

exports[`Angular with Preserve Imports and File Extensions > jsx > Typescript Test > getterState 1`] = `
"import { NgModule } from \\"@angular/core\\";
import { CommonModule } from \\"@angular/common\\";
Expand Down
100 changes: 100 additions & 0 deletions packages/core/src/__tests__/__snapshots__/angular.mapper.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4819,6 +4819,54 @@ export class FigmaButtonModule {}
"
`;

exports[`Angular with Import Mapper Tests > jsx > Javascript Test > functionProps 1`] = `
"import { NgModule } from \\"@angular/core\\";
import { CommonModule } from \\"@angular/common\\";

import { Component } from \\"@angular/core\\";

@Component({
selector: \\"my-basic-component\\",
template: \`
<p
[attr.f]=\\"() => x\\"
[attr.f1]=\\"x => x\\"
[attr.f2]=\\"x => {}\\"
[attr.f3]=\\"function () {
return x;
}\\"
[attr.f4]=\\"function (x) {
return x;
}\\"
[attr.f5]=\\"function (x) {
return;
}\\"
[attr.f6]=\\"function () {
return;
}\\"
[attr.f7]=\\"(a, b, c) => a + b + c\\"
></p>
\`,
styles: [
\`
:host {
display: contents;
}
\`,
],
})
export default class MyBasicComponent {}

@NgModule({
declarations: [MyBasicComponent],
imports: [CommonModule],
exports: [MyBasicComponent],
bootstrap: [SomeOtherComponent],
})
export class MyBasicComponentModule {}
"
`;

exports[`Angular with Import Mapper Tests > jsx > Javascript Test > getterState 1`] = `
"import { NgModule } from \\"@angular/core\\";
import { CommonModule } from \\"@angular/common\\";
Expand Down Expand Up @@ -12973,6 +13021,58 @@ export class FigmaButtonModule {}
"
`;

exports[`Angular with Import Mapper Tests > jsx > Typescript Test > functionProps 1`] = `
"import { NgModule } from \\"@angular/core\\";
import { CommonModule } from \\"@angular/common\\";

import { Component } from \\"@angular/core\\";

export interface MyBasicComponentProps {
id: string;
}

@Component({
selector: \\"my-basic-component\\",
template: \`
<p
[attr.f]=\\"() => x\\"
[attr.f1]=\\"x => x\\"
[attr.f2]=\\"x => {}\\"
[attr.f3]=\\"function () {
return x;
}\\"
[attr.f4]=\\"function (x) {
return x;
}\\"
[attr.f5]=\\"function (x) {
return;
}\\"
[attr.f6]=\\"function () {
return;
}\\"
[attr.f7]=\\"(a, b, c) => a + b + c\\"
></p>
\`,
styles: [
\`
:host {
display: contents;
}
\`,
],
})
export default class MyBasicComponent {}

@NgModule({
declarations: [MyBasicComponent],
imports: [CommonModule],
exports: [MyBasicComponent],
bootstrap: [SomeOtherComponent],
})
export class MyBasicComponentModule {}
"
`;

exports[`Angular with Import Mapper Tests > jsx > Typescript Test > getterState 1`] = `
"import { NgModule } from \\"@angular/core\\";
import { CommonModule } from \\"@angular/common\\";
Expand Down
Loading

0 comments on commit 1a4682e

Please sign in to comment.