File tree Expand file tree Collapse file tree 2 files changed +74
-0
lines changed
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler Expand file tree Collapse file tree 2 files changed +74
-0
lines changed Original file line number Diff line number Diff line change 1+
2+ ## Input
3+
4+ ``` javascript
5+ /**
6+ * Fixture showing `@babel/generator` bug with jsx attribute strings containing
7+ * escape sequences. Note that this is only a problem when generating jsx
8+ * literals.
9+ *
10+ * When using the jsx transform to correctly lower jsx into
11+ * `React.createElement` calls, the escape sequences are preserved correctly
12+ * (see evaluator output).
13+ */
14+ function MyApp () {
15+ return < input pattern= " \w " / > ;
16+ }
17+
18+ export const FIXTURE_ENTRYPOINT = {
19+ fn: MyApp,
20+ params: [],
21+ };
22+
23+ ```
24+
25+ ## Code
26+
27+ ``` javascript
28+ import { c as _c } from " react/compiler-runtime" ; /**
29+ * Fixture showing `@babel/generator` bug with jsx attribute strings containing
30+ * escape sequences. Note that this is only a problem when generating jsx
31+ * literals.
32+ *
33+ * When using the jsx transform to correctly lower jsx into
34+ * `React.createElement` calls, the escape sequences are preserved correctly
35+ * (see evaluator output).
36+ */
37+ function MyApp () {
38+ const $ = _c (1 );
39+ let t0;
40+ if ($[0 ] === Symbol .for (" react.memo_cache_sentinel" )) {
41+ t0 = < input pattern= " \\ w" / > ;
42+ $[0 ] = t0;
43+ } else {
44+ t0 = $[0 ];
45+ }
46+ return t0;
47+ }
48+
49+ export const FIXTURE_ENTRYPOINT = {
50+ fn: MyApp,
51+ params: [],
52+ };
53+
54+ ```
55+
56+ ### Eval output
57+ (kind: ok) <input pattern =" \w " >
Original file line number Diff line number Diff line change 1+ /**
2+ * Fixture showing `@babel/generator` bug with jsx attribute strings containing
3+ * escape sequences. Note that this is only a problem when generating jsx
4+ * literals.
5+ *
6+ * When using the jsx transform to correctly lower jsx into
7+ * `React.createElement` calls, the escape sequences are preserved correctly
8+ * (see evaluator output).
9+ */
10+ function MyApp ( ) {
11+ return < input pattern = "\w" /> ;
12+ }
13+
14+ export const FIXTURE_ENTRYPOINT = {
15+ fn : MyApp ,
16+ params : [ ] ,
17+ } ;
You can’t perform that action at this time.
0 commit comments