1 <html xmlns=
"http://www.w3.org/1999/xhtml">
3 https://bugzilla.mozilla.org/show_bug.cgi?id=724993-->
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" />
10 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=724993">Mozilla Bug
724993</a>
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"/>
18 <script class=
"testbody" type=
"text/javascript">
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) {
31 stringList.initialize(value);
38 function insertItemBeforeThrowsFor(stringList, value) {
40 stringList.insertItemBefore(value,
0);
47 function replaceItemThrowsFor(stringList, value) {
49 stringList.replaceItem(value,
0);
56 function appendItemThrowsFor(stringList, value) {
58 stringList.appendItem(value);
65 function run_tests() {
66 var g = document.getElementById(
"g");
67 var strings = g.requiredExtensions;
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");
112 window.addEventListener(
"load", run_tests);