[compiler][fixtures] Repro for fbt + non-ascii strings

ghstack-source-id: 0521198056
Pull Request resolved: https://github.com/facebook/react/pull/30386
This commit is contained in:
Mofei Zhang
2024-07-18 16:18:36 -04:00
parent e15c5b15c6
commit 378ab81522
6 changed files with 147 additions and 0 deletions
@@ -0,0 +1,36 @@
## Input
```javascript
import fbt from "fbt";
function Component(props) {
const element = (
<fbt desc={"Dialog to show to user"}>
Hello{" "}
<fbt:param
name="a really long description
that got split into multiple lines"
>
{props.name}
</fbt:param>
</fbt>
);
return element.toString();
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{ name: "Jason" }],
};
```
## Error
```
Cannot read properties of undefined (reading 'replace')
```
@@ -0,0 +1,21 @@
import fbt from "fbt";
function Component(props) {
const element = (
<fbt desc={"Dialog to show to user"}>
Hello{" "}
<fbt:param
name="a really long description
that got split into multiple lines"
>
{props.name}
</fbt:param>
</fbt>
);
return element.toString();
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{ name: "Jason" }],
};
@@ -0,0 +1,30 @@
## Input
```javascript
import fbt from "fbt";
function Component(props) {
const element = (
<fbt desc={"Dialog to show to user"}>
Hello <fbt:param name='"user" name'>{props.name}</fbt:param>
</fbt>
);
return element.toString();
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{ name: "Jason" }],
};
```
## Error
```
Property arguments[0] of CallExpression expected node to be of a type ["Expression","SpreadElement","JSXNamespacedName","ArgumentPlaceholder"] but instead got "JSXExpressionContainer"
```
@@ -0,0 +1,15 @@
import fbt from "fbt";
function Component(props) {
const element = (
<fbt desc={"Dialog to show to user"}>
Hello <fbt:param name='"user" name'>{props.name}</fbt:param>
</fbt>
);
return element.toString();
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{ name: "Jason" }],
};
@@ -0,0 +1,30 @@
## Input
```javascript
import fbt from "fbt";
function Component(props) {
const element = (
<fbt desc={"Dialog to show to user"}>
Hello <fbt:param name="user name ☺">{props.name}</fbt:param>
</fbt>
);
return element.toString();
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{ name: "Jason" }],
};
```
## Error
```
Property arguments[0] of CallExpression expected node to be of a type ["Expression","SpreadElement","JSXNamespacedName","ArgumentPlaceholder"] but instead got "JSXExpressionContainer"
```
@@ -0,0 +1,15 @@
import fbt from "fbt";
function Component(props) {
const element = (
<fbt desc={"Dialog to show to user"}>
Hello <fbt:param name="user name ☺">{props.name}</fbt:param>
</fbt>
);
return element.toString();
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{ name: "Jason" }],
};