Reorganize some JSX-related tests (#12502)
This commit is contained in:
committed by
GitHub
parent
1bba1b6da3
commit
581aeb9a23
@@ -0,0 +1,10 @@
|
||||
var x = (
|
||||
<>
|
||||
<div>
|
||||
<div key="1" />
|
||||
<div key="2" meow="wolf" />
|
||||
<div key="3" />
|
||||
<div {...props} key="4" />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["transform-react-jsx", { "runtime": "automatic" }]],
|
||||
"sourceType": "module"
|
||||
}
|
||||
@@ -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"
|
||||
})]
|
||||
})
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
var x = (
|
||||
<>
|
||||
<div>
|
||||
<div key="1" />
|
||||
<div key="2" meow="wolf" />
|
||||
<div key="3" />
|
||||
<div {...props} key="4" />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["transform-react-jsx", { "runtime": "automatic" }]],
|
||||
"sourceType": "script"
|
||||
}
|
||||
@@ -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"
|
||||
})]
|
||||
})
|
||||
});
|
||||
@@ -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 />;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["transform-react-jsx", { "runtime": "automatic" }]],
|
||||
"sourceType": "module"
|
||||
}
|
||||
@@ -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", {});
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -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 />;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["transform-react-jsx", { "runtime": "automatic" }]],
|
||||
"sourceType": "script"
|
||||
}
|
||||
@@ -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", {});
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,2 @@
|
||||
/** @jsxImportSource baz */
|
||||
var x = (<div><span /></div>);
|
||||
@@ -0,0 +1,6 @@
|
||||
import { jsx as _jsx } from "baz/jsx-runtime";
|
||||
|
||||
/** @jsxImportSource baz */
|
||||
var x = _jsx("div", {
|
||||
children: _jsx("span", {})
|
||||
});
|
||||
1
packages/babel-plugin-transform-react-jsx/test/fixtures/autoImport/import-source/input.js
vendored
Normal file
1
packages/babel-plugin-transform-react-jsx/test/fixtures/autoImport/import-source/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var x = (<div><span /></div>);
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"plugins": [
|
||||
["transform-react-jsx", { "importSource": "foo", "runtime": "automatic" }]
|
||||
]
|
||||
}
|
||||
5
packages/babel-plugin-transform-react-jsx/test/fixtures/autoImport/import-source/output.mjs
vendored
Normal file
5
packages/babel-plugin-transform-react-jsx/test/fixtures/autoImport/import-source/output.mjs
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { jsx as _jsx } from "foo/jsx-runtime";
|
||||
|
||||
var x = _jsx("div", {
|
||||
children: _jsx("span", {})
|
||||
});
|
||||
1
packages/babel-plugin-transform-react-jsx/test/fixtures/autoImport/no-jsx/input.js
vendored
Normal file
1
packages/babel-plugin-transform-react-jsx/test/fixtures/autoImport/no-jsx/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var foo = "<div></div>";
|
||||
1
packages/babel-plugin-transform-react-jsx/test/fixtures/autoImport/no-jsx/output.mjs
vendored
Normal file
1
packages/babel-plugin-transform-react-jsx/test/fixtures/autoImport/no-jsx/output.mjs
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var foo = "<div></div>";
|
||||
4
packages/babel-plugin-transform-react-jsx/test/fixtures/autoImport/options.json
vendored
Normal file
4
packages/babel-plugin-transform-react-jsx/test/fixtures/autoImport/options.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["transform-react-jsx", { "runtime": "automatic" }]],
|
||||
"sourceType": "module"
|
||||
}
|
||||
10
packages/babel-plugin-transform-react-jsx/test/fixtures/autoImport/react-defined/input.js
vendored
Normal file
10
packages/babel-plugin-transform-react-jsx/test/fixtures/autoImport/react-defined/input.js
vendored
Normal 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>
|
||||
);
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": [["transform-react-jsx", { "runtime": "automatic" }]]
|
||||
}
|
||||
15
packages/babel-plugin-transform-react-jsx/test/fixtures/autoImport/react-defined/output.mjs
vendored
Normal file
15
packages/babel-plugin-transform-react-jsx/test/fixtures/autoImport/react-defined/output.mjs
vendored
Normal 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"
|
||||
})]
|
||||
});
|
||||
Reference in New Issue
Block a user