blob: 5ec23efc7a668a353f3c5f09887b15d6bd634162 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/dump-as-markup.js"></script>
<div id="test" contenteditable>
<pre>
hello
world
webkit
</pre>
</div>
<script>
Markup.description('This tests ensures formatBlock removes a pre when formatting multiple paragraphs inside the pre.');
var test = document.getElementById('test');
var original = test.innerHTML;
window.getSelection().selectAllChildren(test);
document.execCommand('formatBlock', false, 'h3');
Markup.dump(test, 'Formatting all paragraphs by h3 yields');
document.execCommand('undo', false, null);
Markup.dump(test, 'Undo yields');
window.getSelection().setPosition(test, 0);
window.getSelection().modify('extend', 'forward', 'line');
window.getSelection().modify('extend', 'forward', 'line');
window.getSelection().modify('extend', 'forward', 'line');
window.getSelection().modify('extend', 'forward', 'line');
document.execCommand('formatBlock', false, 'h3');
Markup.dump(test, 'Formatting all but the last paragraph by h3 yields');
document.execCommand('undo', false, null);
Markup.dump(test, 'Undo yields');
window.getSelection().setPosition(test, 0);
window.getSelection().modify('move', 'forward', 'line');
window.getSelection().modify('extend', 'forward', 'line');
window.getSelection().modify('extend', 'forward', 'line');
window.getSelection().modify('extend', 'forward', 'line');
window.getSelection().modify('extend', 'forward', 'line');
document.execCommand('formatBlock', false, 'h3');
Markup.dump(test, 'Formatting all but the first paragraph by h3 yields');
</script>
</body>
</html>