Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu committed Jul 16, 2022
1 parent 90a28cb commit 95bb3bb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 0 additions & 3 deletions packages/babel-types/src/definitions/core.ts
Expand Up @@ -1977,9 +1977,6 @@ defineType("TemplateElement", {
}),
function templateElementCookedValidator(node: t.TemplateElement) {
const raw = node.value.raw;
if (node.value.cooked != null) {
return;
}

let cooked = null;
try {
Expand Down
Expand Up @@ -59,6 +59,17 @@ Object {
}
`;

exports[`builders es2015 templateElement should validate 8`] = `
Object {
"tail": false,
"type": "TemplateElement",
"value": Object {
"cooked": "B",
"raw": "\\\\x42",
},
}
`;

exports[`builders es2015 templateLiteral should validate 1`] = `
Object {
"expressions": Array [],
Expand Down
4 changes: 4 additions & 0 deletions packages/babel-types/test/builders/es2015/templateElement.js
Expand Up @@ -23,6 +23,10 @@ describe("builders", function () {
expect(t.templateElement({ raw: "\\u" })).toMatchSnapshot();

expect(t.templateElement({ raw: "\\x42" })).toMatchSnapshot();

expect(
t.templateElement({ raw: "\\x42", cooked: "123" }),
).toMatchSnapshot();
});
});
describe("templateLiteral", function () {
Expand Down

0 comments on commit 95bb3bb

Please sign in to comment.