fix(html): do not add extra indent for js template in script (#5527)

This commit is contained in:
Ika authored and GitHub committed 2018-11-23 15:20:30 +08:00
1 parent cdac9552ef
commit 228a8b0782
3 files changed
+53 -1

No files matched your search

+1 -1
View File
@@ -68,7 +68,7 @@ function embed(path, print, textToDoc, options) {
concat([
breakParent,
printOpeningTagPrefix(node, options),
markAsRoot(stripTrailingHardline(textToDoc(value, { parser }))),
stripTrailingHardline(textToDoc(value, { parser })),
printClosingTagSuffix(node, options)
])
]);
@@ -127,6 +127,42 @@ exports[`something-else.html - html-verify 1`] = `
`;
exports[`template-literal.html - html-verify 1`] = `
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<script>
function foo() {
return \`
<div>
<p>Text</p>
</div>
\`;
}
</script>
</body>
</html>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<!DOCTYPE html>
<html lang="en">
<head> </head>
<body>
<script>
function foo() {
return \`
<div>
<p>Text</p>
</div>
\`;
}
</script>
</body>
</html>
`;
exports[`typescript.html - html-verify 1`] = `
<script type="application/x-typescript">
class Student {
+16
View File
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<script>
function foo() {
return `
<div>
<p>Text</p>
</div>
`;
}
</script>
</body>
</html>