Reorganize some JSX-related tests (#12502)

This commit is contained in:
Mateusz Burzyński
2020-12-15 00:02:23 +01:00
committed by GitHub
parent 1bba1b6da3
commit 581aeb9a23
268 changed files with 16 additions and 612 deletions

View File

@@ -0,0 +1,10 @@
var x = (
<>
<div>
<div key="1" />
<div key="2" meow="wolf" />
<div key="3" />
<div {...props} key="4" />
</div>
</>
);

View File

@@ -0,0 +1,4 @@
{
"plugins": [["transform-react-jsx", { "runtime": "automatic" }]],
"sourceType": "module"
}

View File

@@ -0,0 +1,14 @@
import { createElement as _createElement } from "react";
import { jsxs as _jsxs } from "react/jsx-runtime";
import { jsx as _jsx } from "react/jsx-runtime";
import { Fragment as _Fragment } from "react/jsx-runtime";
var x = /*#__PURE__*/_jsx(_Fragment, {
children: /*#__PURE__*/_jsxs("div", {
children: [/*#__PURE__*/_jsx("div", {}, "1"), /*#__PURE__*/_jsx("div", {
meow: "wolf"
}, "2"), /*#__PURE__*/_jsx("div", {}, "3"), /*#__PURE__*/_createElement("div", { ...props,
key: "4"
})]
})
});

View File

@@ -0,0 +1,10 @@
var x = (
<>
<div>
<div key="1" />
<div key="2" meow="wolf" />
<div key="3" />
<div {...props} key="4" />
</div>
</>
);

View File

@@ -0,0 +1,4 @@
{
"plugins": [["transform-react-jsx", { "runtime": "automatic" }]],
"sourceType": "script"
}

View File

@@ -0,0 +1,13 @@
var _react = require("react");
var _reactJsxRuntime = require("react/jsx-runtime");
var x = /*#__PURE__*/_reactJsxRuntime.jsx(_reactJsxRuntime.Fragment, {
children: /*#__PURE__*/_reactJsxRuntime.jsxs("div", {
children: [/*#__PURE__*/_reactJsxRuntime.jsx("div", {}, "1"), /*#__PURE__*/_reactJsxRuntime.jsx("div", {
meow: "wolf"
}, "2"), /*#__PURE__*/_reactJsxRuntime.jsx("div", {}, "3"), /*#__PURE__*/_react.createElement("div", { ...props,
key: "4"
})]
})
});

View File

@@ -0,0 +1,15 @@
const Bar = () => {
const Foo = () => {
const Component = ({thing, ..._react}) => {
if (!thing) {
var _react2 = "something useless";
var b = _react3();
var c = _react5();
var jsx = 1;
var _jsx = 2;
return <div />;
};
return <span />;
};
}
}

View File

@@ -0,0 +1,4 @@
{
"plugins": [["transform-react-jsx", { "runtime": "automatic" }]],
"sourceType": "module"
}

View File

@@ -0,0 +1,25 @@
import { jsx as _jsx2 } from "react/jsx-runtime";
const Bar = () => {
const Foo = () => {
const Component = ({
thing,
..._react
}) => {
if (!thing) {
var _react2 = "something useless";
var b = _react3();
var c = _react5();
var jsx = 1;
var _jsx = 2;
return /*#__PURE__*/_jsx2("div", {});
}
;
return /*#__PURE__*/_jsx2("span", {});
};
};
};

View File

@@ -0,0 +1,15 @@
const Bar = () => {
const Foo = () => {
const Component = ({thing, ..._react}) => {
if (!thing) {
var _react2 = "something useless";
var b = _react3();
var c = _react5();
var jsx = 1;
var _jsx = 2;
return <div />;
};
return <span />;
};
}
}

View File

@@ -0,0 +1,4 @@
{
"plugins": [["transform-react-jsx", { "runtime": "automatic" }]],
"sourceType": "script"
}

View File

@@ -0,0 +1,25 @@
var _reactJsxRuntime = require("react/jsx-runtime");
const Bar = () => {
const Foo = () => {
const Component = ({
thing,
..._react
}) => {
if (!thing) {
var _react2 = "something useless";
var b = _react3();
var c = _react5();
var jsx = 1;
var _jsx = 2;
return /*#__PURE__*/_reactJsxRuntime.jsx("div", {});
}
;
return /*#__PURE__*/_reactJsxRuntime.jsx("span", {});
};
};
};

View File

@@ -0,0 +1,2 @@
/** @jsxImportSource baz */
var x = (<div><span /></div>);

View File

@@ -0,0 +1,6 @@
import { jsx as _jsx } from "baz/jsx-runtime";
/** @jsxImportSource baz */
var x = _jsx("div", {
children: _jsx("span", {})
});

View File

@@ -0,0 +1 @@
var x = (<div><span /></div>);

View File

@@ -0,0 +1,5 @@
{
"plugins": [
["transform-react-jsx", { "importSource": "foo", "runtime": "automatic" }]
]
}

View File

@@ -0,0 +1,5 @@
import { jsx as _jsx } from "foo/jsx-runtime";
var x = _jsx("div", {
children: _jsx("span", {})
});

View File

@@ -0,0 +1 @@
var foo = "<div></div>";

View File

@@ -0,0 +1 @@
var foo = "<div></div>";

View File

@@ -0,0 +1,4 @@
{
"plugins": [["transform-react-jsx", { "runtime": "automatic" }]],
"sourceType": "module"
}

View File

@@ -0,0 +1,10 @@
import * as react from "react";
var y = react.createElement("div", {foo: 1});
var x = (
<div>
<div key="1" />
<div key="2" meow="wolf" />
<div key="3" />
<div {...props} key="4" />
</div>
);

View File

@@ -0,0 +1,3 @@
{
"plugins": [["transform-react-jsx", { "runtime": "automatic" }]]
}

View File

@@ -0,0 +1,15 @@
import { createElement as _createElement } from "react";
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
import * as react from "react";
var y = react.createElement("div", {
foo: 1
});
var x = /*#__PURE__*/_jsxs("div", {
children: [/*#__PURE__*/_jsx("div", {}, "1"), /*#__PURE__*/_jsx("div", {
meow: "wolf"
}, "2"), /*#__PURE__*/_jsx("div", {}, "3"), /*#__PURE__*/_createElement("div", { ...props,
key: "4"
})]
});