tizen beta release
[framework/web/webkit-efl.git] / LayoutTests / fast / forms / input-paste-undo.html
index d10faba..a48e7b2 100755 (executable)
@@ -1,27 +1,42 @@
 <html>
 <head>
 <script src=../../editing/editing.js language="JavaScript" type="text/JavaScript" ></script>
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<br></br>
+<div contenteditable id="source">Text to copy-paste-undo.</div>
+<input type="text" id="destination"></input>
+
 <script>
+description("This test checks that undoing a paste into an empty text field doesn't cause it to collapse vertically.");
+
+var selection = window.getSelection();
+var source = document.getElementById('source');
+selection.selectAllChildren(source);
+
+var initialClientHeight = source.clientHeight;
+var initialClientComputedHeight = window.getComputedStyle(source).height;
+
+copyCommand();
+document.getElementById('destination').focus();
+shouldBeEqualToString('document.getElementById("destination").value', '');
+
+pasteCommand();
+shouldBeEqualToString('document.getElementById("destination").value', 'Text to copy-paste-undo.');
+shouldBeTrue('document.getElementById("source").clientHeight == initialClientHeight');
+shouldBeTrue('window.getComputedStyle(document.getElementById("source")).height == initialClientComputedHeight');
+
+undoCommand();
+shouldBeEqualToString('document.getElementById("destination").value', '');
+shouldBeTrue('document.getElementById("source").clientHeight == initialClientHeight');
+shouldBeTrue('window.getComputedStyle(document.getElementById("source")).height == initialClientComputedHeight');
 
-function test()
-{ 
-    var res = "";
-    
-    document.getElementById('dv').focus();
-    copyCommand();
-    document.getElementById('tf').focus();
-    pasteCommand();
-    undoCommand();
-}
 
 </script>
-</head>
-<body onload="test()">
-This test checks that undoing a paste into an empty text field doesn't cause it to collapse vertically. When running manually, you have to paste and undo by hand.
-<br><br>
-<input type="text" id="tf"></input>
-<div contenteditable id="dv">Text to paste</div>
-<div id="result">
-</div>
+<script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>