- added a test for the names of range exceptions, which were wrong
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Jan 2006 18:11:03 +0000 (18:11 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Jan 2006 18:11:03 +0000 (18:11 +0000)
          in my last commit until I made the fix Alexey suggested

        * fast/dom/Range: Added.
        * fast/dom/Range/range-exceptions.html: Added.
        * fast/dom/Range/resources: Added.
        * fast/dom/Range/resources/range-exceptions.js: Added.
        * fast/dom/Range/resources/TEMPLATE.html: Added.

        * fast/js/resources/js-test-pre.js: Escape & and < characters in the
        output so you can have tests with HTML fragments as expected results.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@12458 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/dom/Range/range-exceptions.html [new file with mode: 0644]
LayoutTests/fast/dom/Range/resources/TEMPLATE.html [new file with mode: 0644]
LayoutTests/fast/dom/Range/resources/range-exceptions.js [new file with mode: 0644]
LayoutTests/fast/js/resources/js-test-pre.js

index 762ab403b2fb772353b2c545102755f04cbe0f41..b00602f5cacd8cf3b3570520383cbe93ed29e3e6 100644 (file)
@@ -1,3 +1,17 @@
+2006-01-20  Darin Adler  <darin@apple.com>
+
+        - added a test for the names of range exceptions, which were wrong
+          in my last commit until I made the fix Alexey suggested
+
+        * fast/dom/Range: Added.
+        * fast/dom/Range/range-exceptions.html: Added.
+        * fast/dom/Range/resources: Added.
+        * fast/dom/Range/resources/range-exceptions.js: Added.
+        * fast/dom/Range/resources/TEMPLATE.html: Added.
+
+        * fast/js/resources/js-test-pre.js: Escape & and < characters in the
+        output so you can have tests with HTML fragments as expected results.
+
 2006-01-29  David Harrison  <harrison@apple.com>
 
         Adding test cases for:
 2006-01-29  David Harrison  <harrison@apple.com>
 
         Adding test cases for:
diff --git a/LayoutTests/fast/dom/Range/range-exceptions.html b/LayoutTests/fast/dom/Range/range-exceptions.html
new file mode 100644 (file)
index 0000000..f3e327e
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/range-exceptions.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Range/resources/TEMPLATE.html b/LayoutTests/fast/dom/Range/resources/TEMPLATE.html
new file mode 100644 (file)
index 0000000..1951c43
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="YOUR_JS_FILE_HERE"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Range/resources/range-exceptions.js b/LayoutTests/fast/dom/Range/resources/range-exceptions.js
new file mode 100644 (file)
index 0000000..6dfe41f
--- /dev/null
@@ -0,0 +1,16 @@
+description(
+"This test checks a few DOM range exceptions."
+);
+
+// Test to be sure the name BAD_BOUNDARYPOINTS_ERR dumps properly.
+var node = document.createElement("DIV");
+node.innerHTML = "<BAR>AB<MOO>C</MOO>DE</BAR>";
+shouldBe("node.innerHTML", "'<BAR>AB<MOO>C</MOO>DE</BAR>'");
+var range = document.createRange();
+range.setStart(node.firstChild, 1);
+range.setEnd(node.firstChild, 2);
+var foo = document.createElement("FOO");
+shouldBe("foo.outerHTML", "'<FOO></FOO>'");
+shouldThrow("range.surroundContents(foo)");
+
+var successfullyParsed = true;
index 034d4c6cbc4c18f0863a2bd16ecfebfd0f74756b..ad7df665e0fd61f85a16106d9f3db5f5f433b32f 100644 (file)
@@ -13,14 +13,19 @@ function debug(msg)
     document.getElementById("console").appendChild(span);
 }
 
     document.getElementById("console").appendChild(span);
 }
 
+function escapeHTML(text)
+{
+    return text.replace(/&/g, "&amp;").replace(/</g, "&lt;");
+}
+
 function testPassed(msg)
 {
 function testPassed(msg)
 {
-    debug('<span class="pass">PASS</span> ' + msg + '</span>');
+    debug('<span class="pass">PASS</span> ' + escapeHTML(msg) + '</span>');
 }
 
 function testFailed(msg)
 {
 }
 
 function testFailed(msg)
 {
-    debug('<span class="fail">FAIL</span> ' + msg + '</span>');
+    debug('<span class="fail">FAIL</span> ' + escapeHTML(msg) + '</span>');
 }
 
 function shouldBe(_a, _b)
 }
 
 function shouldBe(_a, _b)
@@ -104,7 +109,7 @@ function shouldThrow(_a, _e)
     if (typeof _e == "undefined" || exception == _ev)
       testPassed(_a + " threw exception " + exception + ".");
     else
     if (typeof _e == "undefined" || exception == _ev)
       testPassed(_a + " threw exception " + exception + ".");
     else
-      testFailed(_a + " should throw exception " + _e + ". Threw exception " + exception + ".");
+      testFailed(_a + " should throw exception " + _ev + ". Threw exception " + exception + ".");
   } else if (typeof _av == "undefined")
     testFailed(_a + " should throw exception " + _e + ". Was undefined.");
   else
   } else if (typeof _av == "undefined")
     testFailed(_a + " should throw exception " + _e + ". Was undefined.");
   else