Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / editing / spelling / design-mode-spellcheck-off.html
1 <!DOCTYPE html>
2 <html>
3 <body spellcheck="false">
4 <script src="../editing.js"></script>
5 <script src="../../resources/js-test.js"></script>
6 <div id="misspelled" onmouseup="checkSpellingMarker()">asd is misspelled.</div>
7 <script>
8 description("This tests whether WebKit does not spell check in 'designMode' "
9     + "when spellcheck='false'. To test manually, click 'asd' and move cursor until '.'. "
10     + "There should be no spelling marker for 'asd'.");
11
12 jsTestIsAsync = true;
13
14 if (window.internals) {
15     internals.settings.setUnifiedTextCheckerEnabled(true);
16     internals.settings.setAsynchronousSpellCheckingEnabled(true);
17 }
18
19 document.designMode = "on";
20
21 function checkSpellingMarker()
22 {
23     if (!window.internals)
24         return;
25
26     // First, verify spelling with spellcheck attribute off.
27     // Move selection to the next word to notify WebKit that "asd" has been typed/changed
28     // to give a chance to spellcheck.
29     moveSelectionForwardByWordCommand();
30
31     shouldBecomeEqual('internals.hasSpellingMarker(document, 0, 3)', 'false', function() {
32         evalAndLog('document.body.setAttribute("spellcheck", "true")');
33         // Do any selection change to force spellchecking after attribute change.
34         moveSelectionForwardByLineCommand();
35         shouldBecomeDifferent('internals.hasSpellingMarker(document, 0, 3)', 'false', finishJSTest);
36     });
37 }
38
39 if (window.eventSender) {
40     var misspelledDiv = document.getElementById("misspelled");
41     var x = misspelledDiv.offsetLeft;
42     var y = misspelledDiv.offsetTop;
43     eventSender.mouseMoveTo(x, y);
44     eventSender.mouseDown();
45     eventSender.mouseUp();
46 }
47 </script> 
48 </body>
49 </html>