Merge pull request babel/babel-eslint#101 from hzoo/more-jsx
add JSXText type, more tests
This commit is contained in:
parent
54adf244dd
commit
82f3fe4147
@ -34,6 +34,8 @@ exports.toToken = function (token) {
|
|||||||
token.value = ">";
|
token.value = ">";
|
||||||
} else if (type === tt.jsxName) {
|
} else if (type === tt.jsxName) {
|
||||||
token.type = "JSXIdentifier";
|
token.type = "JSXIdentifier";
|
||||||
|
} else if (type === tt.jsxText) {
|
||||||
|
token.type = "JSXText";
|
||||||
} else if (type.keyword === "null") {
|
} else if (type.keyword === "null") {
|
||||||
token.type = "Null";
|
token.type = "Null";
|
||||||
} else if (type.keyword === "false" || type.keyword === "true") {
|
} else if (type.keyword === "false" || type.keyword === "true") {
|
||||||
|
|||||||
@ -154,6 +154,22 @@ describe("acorn-to-esprima", function () {
|
|||||||
parseAndAssertSame("<foo.bar />");
|
parseAndAssertSame("<foo.bar />");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("jsx expression with spread", function () {
|
||||||
|
parseAndAssertSame("var myDivElement = <div {...this.props} />;");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("empty jsx text", function () {
|
||||||
|
parseAndAssertSame("<a></a>");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("jsx text with content", function () {
|
||||||
|
parseAndAssertSame("<a>Hello, world!</a>");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("nested jsx", function () {
|
||||||
|
parseAndAssertSame("<div>\n<h1>Wat</h1>\n</div>");
|
||||||
|
});
|
||||||
|
|
||||||
it("default import", function () {
|
it("default import", function () {
|
||||||
parseAndAssertSame('import foo from "foo";');
|
parseAndAssertSame('import foo from "foo";');
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user