Web Inspector: Add PrettyPrinter CSS tests
[WebKit-https.git] / Source / WebInspectorUI / Tools / PrettyPrinting / index.html
index 4002852354f680c431e65f711f4809882ede4be8..d4e202076e34775b3f6daa0cf86c16bb3f5a5285 100644 (file)
     // Button helpers.
     var buttons = ["mode", "populate", "run-tests", "clear", "select-output", "run-again"];
     function disableButtons() {
-        console.log("disableButtons");
         buttons.forEach(function(id) {
             document.getElementById(id).disabled = true;
         });
     }
     function enableButtons() {
-        console.log("enableButtons");
         buttons.forEach(function(id) {
             document.getElementById(id).disabled = false;
         });
         ]);
     }
     function runCSSTests(callback) {
-        _runTests(callback, []);
+        _runTests(callback, [
+            "css-tests/basic.css",
+            "css-tests/calc.css",
+            "css-tests/media-query.css",
+            "css-tests/selectors.css",
+        ]);
     }
     function _runTests(callback, manifest) {
         var index = -1;
 
             // Load test and expected results.
             var test = manifest[index];
-            var expected = test.replace(/\.js$/, "-expected.js");
+            var expected = test.replace(/\.([^\.]+)$/, "-expected.$1");
             var xhr1 = new XMLHttpRequest;
             xhr1.open("GET", test, false);
             xhr1.send();
             // Compare results.
             var pass = builder.formattedContent === expectedData;
             results.push("/* " + (pass ? "PASS" : "FAIL") + ": " + test + " */");
+
+            // Output failures to console.
+            if (!pass) {
+                console.log("Test", test, "Expected", expected);
+                console.log("Formatted Output", builder.formattedContent.length);
+                console.log(builder.formattedContent);
+                console.log("Expected Output", expectedData.length);
+                console.log(expectedData);
+            }
+
             runNextTest();
         }