931569b945c4b9886e6324f9f941914833be848a
[WebKit-https.git] / LayoutTests / fast / forms / input-paste-undo.html
1 <html>
2 <head>
3 <script src=../../editing/editing.js language="JavaScript" type="text/JavaScript" ></script>
4 <script src="../js/resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9
10 <br></br>
11 <div contenteditable id="source">Text to copy-paste-undo.</div>
12 <input type="text" id="destination"></input>
13
14 <script>
15 description("This test checks that undoing a paste into an empty text field doesn't cause it to collapse vertically.");
16
17 var selection = window.getSelection();
18 var source = document.getElementById('source');
19 selection.selectAllChildren(source);
20
21 var initialClientHeight = source.clientHeight;
22 var initialClientComputedHeight = window.getComputedStyle(source).height;
23
24 copyCommand();
25 document.getElementById('destination').focus();
26 shouldBeEqualToString('document.getElementById("destination").value', '');
27
28 pasteCommand();
29 shouldBeEqualToString('document.getElementById("destination").value', 'Text to copy-paste-undo.');
30 shouldBeTrue('document.getElementById("source").clientHeight == initialClientHeight');
31 shouldBeTrue('window.getComputedStyle(document.getElementById("source")).height == initialClientComputedHeight');
32
33 undoCommand();
34 shouldBeEqualToString('document.getElementById("destination").value', '');
35 shouldBeTrue('document.getElementById("source").clientHeight == initialClientHeight');
36 shouldBeTrue('window.getComputedStyle(document.getElementById("source")).height == initialClientComputedHeight');
37
38 successfullyParsed = true;
39
40 </script>
41 <script src="../js/resources/js-test-post.js"></script>
42 </body>
43 </html>