Candidates that don't end in spaces shouldn't have spaces arbitrarily appended to...
[WebKit-https.git] / LayoutTests / editing / mac / spelling / accept-candidate-allows-autocorrect-on-next-word.html
1 <html>
2 <head>
3 <script src=../../editing.js language="javascript" type="text/javascript"></script>
4 <script src="../../../resources/js-test-pre.js"></script>
5 <script>
6
7 function editingTest() {
8     edit = document.getElementById('edit');
9     edit.focus();
10     var s = window.getSelection();
11     typeCharacterCommand('a');
12     typeCharacterCommand(' ');
13     typeCharacterCommand('e');
14     typeCharacterCommand('x');
15     typeCharacterCommand('t');
16     typeCharacterCommand('r');
17     typeCharacterCommand('e');
18     typeCharacterCommand('m');
19     typeCharacterCommand('e');
20     typeCharacterCommand('l');
21     typeCharacterCommand('y');
22     typeCharacterCommand('l');
23     typeCharacterCommand('o');
24     typeCharacterCommand('n');
25     typeCharacterCommand('g');
26     typeCharacterCommand(' ');
27     typeCharacterCommand('m');
28     typeCharacterCommand('e');
29     typeCharacterCommand('s');
30     typeCharacterCommand('a');
31     typeCharacterCommand('g');
32     typeCharacterCommand('e');
33
34     if (window.internals)
35         internals.handleAcceptedCandidate("extremely long", 2, 13);
36
37     // Accepting the candidate is going to cause the selection to move to it, but we want
38     // to type a space after 'mesage' to get it autocorrected.
39     setSelectionCommand(edit.firstChild, 23, edit.firstChild, 23);
40
41     typeCharacterCommand(' ');
42
43     if (window.testRunner)
44         testRunner.dumpAsText(true);
45 }
46
47 </script>
48 </head>
49 <body>
50 <p>This test verifies that accepted candidates don't disable autocorrection on subsequent words. You should see the phrase "a extremely long message" The bug occurs if "mesage" was not corrected to "message".</p>
51 <div contenteditable="true" id="edit"/>
52 <script>
53 runEditingTest();
54 </script>
55 <script src="../../../resources/js-test-post.js"></script>
56 </body>
57 </html>