JS Test Harness: Remove successfullyParsed from more tests
[WebKit-https.git] / LayoutTests / platform / mac / accessibility / misspelled-attributed-string.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../../fast/js/resources/js-test-pre.js"></script>
5 <script>
6 if (window.layoutTestController)
7    layoutTestController.dumpAsText();
8 </script>
9 </head>
10 <body>
11
12 <div contenteditable=true id="content" role="textbox">
13 wrods is misspelled aa lotsi nowadays. euep.
14 </div>
15
16
17 <p id="description"></p>
18 <div id="console"></div>
19
20 <script>
21
22     description("This tests that misspelled words are correctly marked when asking for an attributed string.");
23
24     if (window.accessibilityController) {
25         var content = document.getElementById("content");
26         content.focus();
27
28         // Iterate all the words so that misspelled markings get generated.
29         var length = content.innerText.length;
30         var s = window.getSelection();
31         s.setPosition(content, 0);
32         for (var k = 0; k < length; k++) {
33             s.modify("move", "forward", "character");
34         }
35         
36         var text = accessibilityController.focusedElement;
37         // wrods
38         shouldBe("text.stringForRange(0, 5)", "'wrods'");
39         shouldBeTrue("text.attributedStringRangeIsMisspelled(0, 5)");
40
41         // is
42         shouldBe("text.stringForRange(6, 2)", "'is'");
43         shouldBeFalse("text.attributedStringRangeIsMisspelled(6, 2)");
44
45         // misspelled
46         shouldBe("text.stringForRange(9, 10)", "'misspelled'");
47         shouldBeFalse("text.attributedStringRangeIsMisspelled(9, 10)");
48
49         // aa
50         shouldBe("text.stringForRange(20, 2)", "'aa'");
51         shouldBeTrue("text.attributedStringRangeIsMisspelled(20, 2)");
52    
53         // lotsi
54         shouldBe("text.stringForRange(23, 5)", "'lotsi'");
55         shouldBeTrue("text.attributedStringRangeIsMisspelled(23, 5)");
56
57         // nowadays
58         shouldBe("text.stringForRange(29, 8)", "'nowadays'");
59         shouldBeFalse("text.attributedStringRangeIsMisspelled(29, 8)");
60
61         // eue9
62         shouldBe("text.stringForRange(39, 5)", "'euep.'");
63         shouldBeTrue("text.attributedStringRangeIsMisspelled(39, 5)");
64     }
65
66 </script>
67
68 <script src="../../../fast/js/resources/js-test-post.js"></script>
69
70 </body>
71 </html>
72