Luna Ruan 748897be07
Add experimental version of the `babel-plugin-transform-react-… (#11154)
* add next option for babel-plugin-transform-react-jsx

* address review comments

* chore: update test fixtures

* Update fixture

* Add "columnNumber" to the new React transform

* Update windows fixtures

* Delete unused output.js

* Update windows tests

* Fix windows again

* fix comments

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Moti Zilberman <motiz88@gmail.com>
2020-03-17 09:16:53 +01:00

32 lines
723 B
JavaScript

var actual = transform(
`/** @jsxRuntime classic */
var x = (
<>
<div>
<div key="1" />
<div key="2" meow="wolf" />
<div key="3" />
<div {...props} key="4" />
</div>
</>
);`,
Object.assign({}, opts, { filename: 'C:\\fake\\path\\mock.js' })
).code;
var expected =
`var _jsxFileName = "C:\\\\fake\\\\path\\\\mock.js";
/** @jsxRuntime classic */
var x = React.createElement(React.Fragment, null, React.createElement("div", null, React.createElement("div", {
key: "1"
}), React.createElement("div", {
key: "2",
meow: "wolf"
}), React.createElement("div", {
key: "3"
}), React.createElement("div", { ...props,
key: "4"
})));`;
expect(actual).toBe(expected);