Bug 1941128 - Turn off network.dns.native_https_query on Mac again
[gecko.git] / dom / svg / test / test_SVGStringList.xhtml
blobfaba904376f811b56a3f77773b4f3d33dd7c326e
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <!--
3 https://bugzilla.mozilla.org/show_bug.cgi?id=724993-->
4 <head>
5 <title>Tests specific to SVGStringList</title>
6 <script src="/tests/SimpleTest/SimpleTest.js"></script>
7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
8 </head>
9 <body>
10 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=724993">Mozilla Bug 724993</a>
11 <p id="display"></p>
12 <div id="content" style="display:none;">
13 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="100" height="100">
14 <g id="g" requiredExtensions="foo bar baz"/>
15 </svg>
16 </div>
17 <pre id="test">
18 <script class="testbody" type="text/javascript">
19 <![CDATA[
21 SimpleTest.waitForExplicitFinish();
24 This file runs a series of SVGStringList specific tests. Generic SVGXxxList
25 tests can be found in test_SVGxxxList.xhtml. Anything that can be generalized
26 to other list types belongs there.
29 function initializeThrowsFor(stringList, value) {
30 try {
31 stringList.initialize(value);
32 } catch (e) {
33 return true;
35 return false;
38 function insertItemBeforeThrowsFor(stringList, value) {
39 try {
40 stringList.insertItemBefore(value, 0);
41 } catch (e) {
42 return true;
44 return false;
47 function replaceItemThrowsFor(stringList, value) {
48 try {
49 stringList.replaceItem(value, 0);
50 } catch (e) {
51 return true;
53 return false;
56 function appendItemThrowsFor(stringList, value) {
57 try {
58 stringList.appendItem(value);
59 } catch (e) {
60 return true;
62 return false;
65 function run_tests() {
66 var g = document.getElementById("g");
67 var strings = g.requiredExtensions;
69 // sanity check:
70 is(strings.numberOfItems, 3, "numberOfItems should be 3");
73 ok(!initializeThrowsFor(strings, null),
74 "SVGStringList.initialize() should not throw when passed null");
75 ok(initializeThrowsFor(strings, ""),
76 "SVGStringList.initialize() should throw when passed the empty string");
77 is(strings.length, 0, "length should be 0");
79 ok(!insertItemBeforeThrowsFor(strings, null),
80 "SVGStringList.insertItemBefore() should not throw when passed null");
81 ok(insertItemBeforeThrowsFor(strings, ""),
82 "SVGStringList.insertItemBefore() should throw when passed the empty string");
83 is(strings.length, 1, "length should be 1");
85 ok(!replaceItemThrowsFor(strings, null),
86 "SVGStringList.replaceItem() should not throw when passed null");
87 ok(replaceItemThrowsFor(strings, ""),
88 "SVGStringList.replaceItem() should throw when passed the empty string");
89 is(strings.length, 1, "length should be 1");
91 ok(!appendItemThrowsFor(strings, null),
92 "SVGStringList.appendItem() should not throw when passed null");
93 ok(appendItemThrowsFor(strings, ""),
94 "SVGStringList.appendItem() should throw when passed the empty string");
95 is(strings.length, 2, "length should be 2");
98 // more sanity checks:
99 ok(!initializeThrowsFor(strings, "valid-string"),
100 "SVGStringList.initialize() should not throw when passed a valid string");
101 ok(!insertItemBeforeThrowsFor(strings, "valid-string"),
102 "SVGStringList.insertItemBefore() should not throw when passed a valid string");
103 ok(!replaceItemThrowsFor(strings, "valid-string"),
104 "SVGStringList.replaceItem() should not throw when passed a valid string");
105 ok(!appendItemThrowsFor(strings, "valid-string"),
106 "SVGStringList.appendItem() should not throw when passed a valid string");
107 is(strings.length, 3, "numberOfItems should be 3");
109 SimpleTest.finish();
112 window.addEventListener("load", run_tests);
115 </script>
116 </pre>
117 </body>
118 </html>