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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/sources/pretty-print-css-1.html

Issue 2028863002: DevTools: fix css pretty-print. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script> 3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/debugger-test.js"></script> 4 <script src="../../http/tests/inspector/debugger-test.js"></script>
5 <script src="../../http/tests/inspector/sources-test.js"></script> 5 <script src="../../http/tests/inspector/sources-test.js"></script>
6 <link rel="stylesheet" href="resources/style-formatter-obfuscated.css"> 6 <link rel="stylesheet" href="resources/style-formatter-obfuscated.css">
7 7
8 <script> 8 <script>
9 9
10 function test() 10 function test()
11 { 11 {
12 var testCSSFormatter = InspectorTest.testPrettyPrint.bind(InspectorTest, "te xt/css"); 12 var testCSSFormatter = InspectorTest.testPrettyPrint.bind(InspectorTest, "te xt/css");
13 13
14 InspectorTest.runTestSuite([ 14 InspectorTest.runTestSuite([
15 function testSimpleCSS(next) 15 function testSimpleCSS(next)
16 { 16 {
17 var content = "a { /* pre-comment */ color /* after name */ : /* bef ore value */ red /* post-comment */ }"; 17 var content = "a { /* pre-comment */ color /* after name */ : /* bef ore value */ red /* post-comment */ }";
18 testCSSFormatter(content, [], next); 18 testCSSFormatter(content, ["pre-comment", "post-comment"], next);
19 }, 19 },
20 20
21 function testComplexCSS(next) 21 function testComplexCSS(next)
22 { 22 {
23 InspectorTest.showScriptSource("style-formatter-obfuscated.css", did ShowScriptSource); 23 InspectorTest.showScriptSource("style-formatter-obfuscated.css", did ShowScriptSource);
24 24
25 function didShowScriptSource(sourceFrame) 25 function didShowScriptSource(sourceFrame)
26 { 26 {
27 var mappingQueries = [ 27 var mappingQueries = [
28 "@media", 28 "@media",
29 "screen", 29 "screen",
30 "html", 30 "html",
31 "color", 31 "color",
32 "green", 32 "green",
33 "foo-property", 33 "foo-property",
34 "bar-value", 34 "bar-value",
35 "body", 35 "body",
36 "background", 36 "background",
37 "black", 37 "black",
38 ]; 38 ];
39 testCSSFormatter(sourceFrame._textEditor.text(), mappingQueries, next); 39 testCSSFormatter(sourceFrame._textEditor.text(), mappingQueries, next);
40 } 40 }
41 }, 41 },
42 42
43 function testFormatInlinedStyles(next) 43 function testFormatInlinedStyles(next)
44 { 44 {
45 var content = "<html><body><style>@-webkit-keyframes{from{left: 0} t o{left:100px;}}</style><style>badbraces { }} @media screen{a{color:red;text-deco ration: none}}</style></body></html>"; 45 var content = "<html><body><style>@-webkit-keyframes{from{left: 0} t o{left:100px;}}</style><style>badbraces { }} @media screen{a.b{color:red;text-de coration: none}}</style></body></html>";
46 InspectorTest.testPrettyPrint("text/html", content, [], next); 46 InspectorTest.testPrettyPrint("text/html", content, [], next);
47 }, 47 },
48 48
49 function testNonZeroLineMapping(next) 49 function testNonZeroLineMapping(next)
50 { 50 {
51 var mappingQueries = ["div", "color", "red"]; 51 var mappingQueries = ["div", "color", "red"];
52 testCSSFormatter("\n\ndiv { color: red; }", mappingQueries, next); 52 testCSSFormatter("\n\ndiv { color: red; }", mappingQueries, next);
53 }, 53 },
54
55 function testComplexSelector(next)
56 {
57 var css = "a.b.c:hover,.d.e.f.g::before,h.i{color:red;}";
58 var mappingQueries = ["a",".b",".c",".d",".e",".f",".g","h",".i","co lor","red"];
59 testCSSFormatter(css, mappingQueries, next);
60 },
54 ]); 61 ]);
55 } 62 }
56 63
57 </script> 64 </script>
58 65
59 </head> 66 </head>
60 67
61 <body onload="runTest()"> 68 <body onload="runTest()">
62 <p>Verifies CSS pretty-printing functionality.</p> 69 <p>Verifies CSS pretty-printing functionality.</p>
63 </body> 70 </body>
64 </html> 71 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698