Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / editing / undo / undo-deleteWord.html
1 <html> 
2 <head>
3
4 <style>
5 .editing { 
6     border: 2px solid red; 
7 }
8 .explanation { 
9     border: 2px solid blue; 
10     padding: 12px; 
11     font-size: 24px; 
12     margin-bottom: 24px;
13 }
14 .scenario { margin-bottom: 16px;}
15 .scenario:first-line { font-weight: bold; margin-bottom: 16px;}
16 </style>
17 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
18
19 <script>
20
21 function sendDeleteWordKey()
22 {
23     var deleteWordModifiers;
24     if (navigator.userAgent.search(/\bMac OS X\b/) != -1)
25         deleteWordModifiers = ["altKey"];
26     else
27         deleteWordModifiers = ["ctrlKey"];
28
29     if (window.eventSender)
30         eventSender.keyDown(String.fromCharCode(8), deleteWordModifiers);
31     window.setTimeout(undoNow, 100);
32 }
33
34 function undoNow()
35 {
36     document.execCommand("Undo");
37
38     if (window.testRunner)
39         testRunner.notifyDone();
40 }
41
42 function editingTest() {
43     typeCharacterCommand('o');
44     typeCharacterCommand('n');
45     typeCharacterCommand('e');
46     typeCharacterCommand(' ');
47     typeCharacterCommand('t');
48     typeCharacterCommand('w');
49     typeCharacterCommand('o');
50     typeCharacterCommand(' ');
51     typeCharacterCommand('t');
52     typeCharacterCommand('h');
53     typeCharacterCommand('r');
54     typeCharacterCommand('e');
55     typeCharacterCommand('e');
56     typeCharacterCommand(' ');
57     typeCharacterCommand('f');
58     typeCharacterCommand('o');
59     typeCharacterCommand('u');
60     typeCharacterCommand('r');
61
62     window.setTimeout(sendDeleteWordKey, 100);
63 }
64
65 </script>
66
67 <title>Editing Test</title> 
68 </head> 
69 <body>
70
71 <div class="explanation">
72 <div class="scenario">
73 Tests: 
74 <br>
75 Undo a delete word after a series of insertText does not wipe out the entire content.
76 </div>
77 </div>
78
79 <div contenteditable id="root">
80 <div id="test" class="editing"></div>
81 </div>
82
83 <script>
84 if (window.testRunner) {
85     testRunner.dumpAsText();
86     testRunner.waitUntilDone();
87 }
88
89 var selection = window.getSelection();
90 selection.collapse(document.getElementById("test"), 0);
91 editingTest();
92 </script>
93
94 </body>
95 </html>