-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More tests for JSX prop spread expanding
Duplicated keys may be created as per current behaviour, using `@babel/plugin-transform-duplicate-keys` would allow use when transpiling to strict.
- Loading branch information
Showing
6 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
...s/babel-plugin-transform-react-jsx/test/fixtures/react-automatic/duplicate-props/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<p prop prop>text</p>; | ||
|
||
<p {...{prop, prop}}>text</p>; | ||
|
||
<p prop {...{prop}}>text</p>; | ||
|
||
<p {...{prop}} prop>text</p>; |
29 changes: 29 additions & 0 deletions
29
...babel-plugin-transform-react-jsx/test/fixtures/react-automatic/duplicate-props/output.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
|
||
/*#__PURE__*/ | ||
_jsx("p", { | ||
prop: true, | ||
prop: true, | ||
children: "text" | ||
}); | ||
|
||
/*#__PURE__*/ | ||
_jsx("p", { | ||
prop, | ||
prop, | ||
children: "text" | ||
}); | ||
|
||
/*#__PURE__*/ | ||
_jsx("p", { | ||
prop: true, | ||
prop, | ||
children: "text" | ||
}); | ||
|
||
/*#__PURE__*/ | ||
_jsx("p", { | ||
prop, | ||
prop: true, | ||
children: "text" | ||
}); |
11 changes: 11 additions & 0 deletions
11
packages/babel-plugin-transform-react-jsx/test/fixtures/react/avoids-spread/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<E {...props} last />; | ||
|
||
<E first {...props} />; | ||
|
||
<E {...pre} {...suf} />; | ||
|
||
<E first {...pre} mid {...suf} />; | ||
|
||
<E {...pre} mid {...suf} last />; | ||
|
||
<E {...pre} mid1 mid2 {...suf} />; |
32 changes: 32 additions & 0 deletions
32
packages/babel-plugin-transform-react-jsx/test/fixtures/react/avoids-spread/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/*#__PURE__*/ | ||
React.createElement(E, babelHelpers.extends({}, props, { | ||
last: true | ||
})); | ||
|
||
/*#__PURE__*/ | ||
React.createElement(E, babelHelpers.extends({ | ||
first: true | ||
}, props)); | ||
|
||
/*#__PURE__*/ | ||
React.createElement(E, babelHelpers.extends({}, pre, suf)); | ||
|
||
/*#__PURE__*/ | ||
React.createElement(E, babelHelpers.extends({ | ||
first: true | ||
}, pre, { | ||
mid: true | ||
}, suf)); | ||
|
||
/*#__PURE__*/ | ||
React.createElement(E, babelHelpers.extends({}, pre, { | ||
mid: true | ||
}, suf, { | ||
last: true | ||
})); | ||
|
||
/*#__PURE__*/ | ||
React.createElement(E, babelHelpers.extends({}, pre, { | ||
mid1: true, | ||
mid2: true | ||
}, suf)); |
7 changes: 7 additions & 0 deletions
7
packages/babel-plugin-transform-react-jsx/test/fixtures/react/duplicate-props/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<p prop prop>text</p>; | ||
|
||
<p {...{prop, prop}}>text</p>; | ||
|
||
<p prop {...{prop}}>text</p>; | ||
|
||
<p {...{prop}} prop>text</p>; |
23 changes: 23 additions & 0 deletions
23
packages/babel-plugin-transform-react-jsx/test/fixtures/react/duplicate-props/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/*#__PURE__*/ | ||
React.createElement("p", { | ||
prop: true, | ||
prop: true | ||
}, "text"); | ||
|
||
/*#__PURE__*/ | ||
React.createElement("p", { | ||
prop, | ||
prop | ||
}, "text"); | ||
|
||
/*#__PURE__*/ | ||
React.createElement("p", { | ||
prop: true, | ||
prop | ||
}, "text"); | ||
|
||
/*#__PURE__*/ | ||
React.createElement("p", { | ||
prop, | ||
prop: true | ||
}, "text"); |