blob: c4a904759e65928d3a9bcc976532dbfc8d3f30df [file] [log] [blame]
<html>
<head>
<script src=../../editing/editing.js language="JavaScript" type="text/JavaScript" ></script>
<script src="../../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="../../resources/js-test-post.js"></script>
</body>
</html>