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> |