blob: a48e7b25ebbc6f8617d1a28a42927e4cadee59d8 [file] [log] [blame]
<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');
</script>
<script src="../js/resources/js-test-post.js"></script>
</body>
</html>