[compiler][fixtures] Repro for fbt + non-ascii strings
ghstack-source-id: 05211980566f8c061ac2ca8ce51e442d234beacc Pull Request resolved: https://github.com/facebook/react/pull/30386
Mofei Zhang committed
Jul 18, 2024 at 15:33 UTC
378ab81522c3da436943980cbb537c9ce523fbf8
6 files changed
+147
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-newline.expect.md
new
+36
@@ -0,0 +1,36 @@
1
+
2
+## Input
3
+
4
+```javascript
5
+import fbt from "fbt";
6
+
7
+function Component(props) {
8
+ const element = (
9
+ <fbt desc={"Dialog to show to user"}>
10
+ Hello{" "}
11
+ <fbt:param
12
+ name="a really long description
13
+ that got split into multiple lines"
14
+ >
15
+ {props.name}
16
+ </fbt:param>
17
+ </fbt>
18
+ );
19
+ return element.toString();
20
+}
21
+
22
+export const FIXTURE_ENTRYPOINT = {
23
+ fn: Component,
24
+ params: [{ name: "Jason" }],
25
+};
26
+
27
+```
28
+
29
+
30
+## Error
31
+
32
+```
33
+Cannot read properties of undefined (reading 'replace')
34
+```
35
+
36
+
\ No newline at end of file
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-newline.js
new
+21
@@ -0,0 +1,21 @@
1
+import fbt from "fbt";
2
+
3
+function Component(props) {
4
+ const element = (
5
+ <fbt desc={"Dialog to show to user"}>
6
+ Hello{" "}
7
+ <fbt:param
8
+ name="a really long description
9
+ that got split into multiple lines"
10
+ >
11
+ {props.name}
12
+ </fbt:param>
13
+ </fbt>
14
+ );
15
+ return element.toString();
16
+}
17
+
18
+export const FIXTURE_ENTRYPOINT = {
19
+ fn: Component,
20
+ params: [{ name: "Jason" }],
21
+};
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-quotes.expect.md
new
+30
@@ -0,0 +1,30 @@
1
+
2
+## Input
3
+
4
+```javascript
5
+import fbt from "fbt";
6
+
7
+function Component(props) {
8
+ const element = (
9
+ <fbt desc={"Dialog to show to user"}>
10
+ Hello <fbt:param name='"user" name'>{props.name}</fbt:param>
11
+ </fbt>
12
+ );
13
+ return element.toString();
14
+}
15
+
16
+export const FIXTURE_ENTRYPOINT = {
17
+ fn: Component,
18
+ params: [{ name: "Jason" }],
19
+};
20
+
21
+```
22
+
23
+
24
+## Error
25
+
26
+```
27
+Property arguments[0] of CallExpression expected node to be of a type ["Expression","SpreadElement","JSXNamespacedName","ArgumentPlaceholder"] but instead got "JSXExpressionContainer"
28
+```
29
+
30
+
\ No newline at end of file
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-quotes.js
new
+15
@@ -0,0 +1,15 @@
1
+import fbt from "fbt";
2
+
3
+function Component(props) {
4
+ const element = (
5
+ <fbt desc={"Dialog to show to user"}>
6
+ Hello <fbt:param name='"user" name'>{props.name}</fbt:param>
7
+ </fbt>
8
+ );
9
+ return element.toString();
10
+}
11
+
12
+export const FIXTURE_ENTRYPOINT = {
13
+ fn: Component,
14
+ params: [{ name: "Jason" }],
15
+};
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-unicode.expect.md
new
+30
@@ -0,0 +1,30 @@
1
+
2
+## Input
3
+
4
+```javascript
5
+import fbt from "fbt";
6
+
7
+function Component(props) {
8
+ const element = (
9
+ <fbt desc={"Dialog to show to user"}>
10
+ Hello <fbt:param name="user name ☺">{props.name}</fbt:param>
11
+ </fbt>
12
+ );
13
+ return element.toString();
14
+}
15
+
16
+export const FIXTURE_ENTRYPOINT = {
17
+ fn: Component,
18
+ params: [{ name: "Jason" }],
19
+};
20
+
21
+```
22
+
23
+
24
+## Error
25
+
26
+```
27
+Property arguments[0] of CallExpression expected node to be of a type ["Expression","SpreadElement","JSXNamespacedName","ArgumentPlaceholder"] but instead got "JSXExpressionContainer"
28
+```
29
+
30
+
\ No newline at end of file
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-unicode.js
new
+15
@@ -0,0 +1,15 @@
1
+import fbt from "fbt";
2
+
3
+function Component(props) {
4
+ const element = (
5
+ <fbt desc={"Dialog to show to user"}>
6
+ Hello <fbt:param name="user name ☺">{props.name}</fbt:param>
7
+ </fbt>
8
+ );
9
+ return element.toString();
10
+}
11
+
12
+export const FIXTURE_ENTRYPOINT = {
13
+ fn: Component,
14
+ params: [{ name: "Jason" }],
15
+};