Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(382)

Unified Diff: LayoutTests/inspector/sources/pretty-print-javascript-template-literals.html

Issue 1125143004: DevTools: [PrettyPrint] support template literals in pretty-printing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address comments Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/inspector/sources/pretty-print-javascript-template-literals.html
diff --git a/LayoutTests/inspector/sources/pretty-print-javascript-template-literals.html b/LayoutTests/inspector/sources/pretty-print-javascript-template-literals.html
new file mode 100644
index 0000000000000000000000000000000000000000..b4d55e61bbdb4d0a0a10f07ba7f6582d2658c2bf
--- /dev/null
+++ b/LayoutTests/inspector/sources/pretty-print-javascript-template-literals.html
@@ -0,0 +1,60 @@
+<html>
+<head>
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../http/tests/inspector/debugger-test.js"></script>
+<script src="../../http/tests/inspector/sources-test.js"></script>
+<script src="debugger/resources/obfuscated.js"></script>
+
+<script>
+
+function test()
+{
+ var testJSFormatter = InspectorTest.testPrettyPrint.bind(InspectorTest, "text/javascript");
+
+ InspectorTest.runTestSuite([
+ function simpleLiteral(next)
+ {
+ var mappingQueries = ["foo", "bar"];
+ testJSFormatter("var foo = `bar`;", mappingQueries, next);
+ },
+
+ function multilineLiteral(next)
+ {
+ var mappingQueries = ["foo", "bar"];
+ testJSFormatter("var foo = `this\nbar`;", mappingQueries, next);
+ },
+
+ function stringSubstitution(next)
+ {
+ var mappingQueries = ["credit", "cash"];
+ testJSFormatter("var a=`I have ${credit+cash}$`;", mappingQueries, next);
+ },
+
+ function multipleStringSubstitution(next)
+ {
+ var mappingQueries = ["credit", "cash"];
+ testJSFormatter("var a=`${name} has ${credit+cash}${currency?currency:\"$\"}`;", mappingQueries, next);
+ },
+
+ function taggedTemplate(next)
+ {
+ var mappingQueries = ["escapeHtml", "width"];
+ testJSFormatter("escapeHtml`<div class=${classnName} width=${a+b}/>`;", mappingQueries, next);
+ },
+
+ function escapedApostrophe(next)
+ {
+ var mappingQueries = ["That", "great"];
+ testJSFormatter("var a=`That\`s great!`;", mappingQueries, next);
+ }
+ ]);
+}
+
+</script>
+
+</head>
+
+<body onload="runTest()">
+<p>Verifies JavaScript pretty-printing functionality.</p>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698