Bug 1943761 - Add class alignment to the mozsearch analysis file. r=asuth
[gecko.git] / dom / svg / test / test_selectSubString.xhtml
blob66038237cb24645591af1121737c356aa3df030e
1 <!DOCTYPE html>
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=398825
5 -->
6 <head>
7 <title>Test for Bug 398825</title>
8 <script src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
10 </head>
11 <body>
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=398825">Mozilla Bug 398825</a>
13 <p id="display"></p>
14 <div id="content" style="display: none"></div>
16 <iframe id="svg" src="selectSubString-helper.svg"></iframe>
18 <pre id="test">
19 <script class="testbody" type="application/javascript">
20 SimpleTest.waitForExplicitFinish();
22 function runTests() {
23 var document = $("svg").contentWindow.document;
24 var text = document.getElementById("text");
26 function expectThrow(charnum, nchars) {
27 try {
28 text.selectSubString(charnum, nchars);
29 ok(false,
30 "text.selectSubString(" + charnum + "," + nchars + ") " +
31 "should have thrown");
32 } catch (e) {
33 is(e.name, "IndexSizeError",
34 "expected an index error for " +
35 "text.selectSubString(" + charnum + "," + nchars + ")");
36 is(e.code, DOMException.INDEX_SIZE_ERR,
37 "expected an index error for " +
38 "text.selectSubString(" + charnum + "," + nchars + ")");
42 function expectNoThrow(charnum, nchars) {
43 try {
44 text.selectSubString(charnum, nchars);
45 ok(true,
46 "text.selectSubString(" + charnum + "," + nchars + ") " +
47 "should not have thrown");
48 } catch (e) {
49 ok(false,
50 "unexpected exception for " +
51 "text.selectSubString(" + charnum + "," + nchars + ")");
55 expectThrow(100, 2);
56 expectThrow(100, 0);
57 expectThrow(3, 0);
58 expectThrow(3, 100);
59 expectThrow(3, 100);
60 expectThrow(100, 100);
62 expectNoThrow(1, 100);
63 expectNoThrow(2, 100);
64 expectNoThrow(1, 3);
65 expectNoThrow(0, 4);
67 SimpleTest.finish();
70 window.addEventListener("load", runTests);
71 </script>
72 </pre>
73 </body>
74 </html>