blob: 516f1602e1443001000617413cf8eeebe2bb5edd [file] [log] [blame]
commit-queue@webkit.org0d93acf2013-01-31 02:07:58 +00001<!DOCTYPE html>
2<html>
3<head>
mark.lam@apple.com3a182c72013-09-08 02:36:06 +00004<script src="../../resources/js-test-pre.js"></script>
commit-queue@webkit.org0d93acf2013-01-31 02:07:58 +00005<script src="resources/util.js"></script>
6</head>
7<body>
8<div id="container">
9 <div id="destination" contentEditable></div>
10</div>
11
12<script>
13
g.czajkowski@samsung.comb1599d52014-01-14 07:48:38 +000014description("Spelling should ignore whitespace. "
15 + "To test manually, type 'hello, wellcome home.', select ' wellcome '. "
16 + "The test succeeds when 'wellcome' has spelling marker.");
commit-queue@webkit.org0d93acf2013-01-31 02:07:58 +000017
18initSpellTest("destination", "hello, wellcome home.", function(textNode) {
19 spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0);
20 shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome");
21
22 // Select the text " wellcome " with surrounding whitespace.
23 var rangeWithWhitespace = document.createRange();
24 rangeWithWhitespace.setStart(textNode, 6);
25 rangeWithWhitespace.setEnd(textNode, 16);
26 window.getSelection().removeAllRanges();
27 window.getSelection().addRange(rangeWithWhitespace);
28
29 shouldBeEqualToString("window.getSelection().toString()", " wellcome ");
30
commit-queue@webkit.org0d93acf2013-01-31 02:07:58 +000031 spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0);
g.czajkowski@samsung.comb1599d52014-01-14 07:48:38 +000032 shouldBecomeEqualToString("spellingMarkerRange.toString()", "wellcome", finishJSTest);
commit-queue@webkit.org0d93acf2013-01-31 02:07:58 +000033});
34
35</script>
mark.lam@apple.com3a182c72013-09-08 02:36:06 +000036<script src="../../resources/js-test-post.js"></script>
commit-queue@webkit.org0d93acf2013-01-31 02:07:58 +000037</body>
38</html>