blob: aa221fb15639b283b261456d23c364200af6a6c9 [file] [log] [blame]
<html>
<head>
<style>
.editing {
border: 2px solid red;
}
.explanation {
border: 2px solid blue;
padding: 12px;
font-size: 24px;
margin-bottom: 24px;
}
.scenario { margin-bottom: 16px;}
.scenario:first-line { font-weight: bold; margin-bottom: 16px;}
</style>
<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
<script>
function sendDeleteWordKey()
{
var deleteWordModifiers;
if (navigator.userAgent.search(/\bMac OS X\b/) != -1)
deleteWordModifiers = ["altKey"];
else
deleteWordModifiers = ["ctrlKey"];
if (window.eventSender)
eventSender.keyDown(String.fromCharCode(8), deleteWordModifiers);
window.setTimeout(undoNow, 100);
}
function undoNow()
{
document.execCommand("Undo");
if (window.testRunner)
testRunner.notifyDone();
}
function editingTest() {
typeCharacterCommand('o');
typeCharacterCommand('n');
typeCharacterCommand('e');
typeCharacterCommand(' ');
typeCharacterCommand('t');
typeCharacterCommand('w');
typeCharacterCommand('o');
typeCharacterCommand(' ');
typeCharacterCommand('t');
typeCharacterCommand('h');
typeCharacterCommand('r');
typeCharacterCommand('e');
typeCharacterCommand('e');
typeCharacterCommand(' ');
typeCharacterCommand('f');
typeCharacterCommand('o');
typeCharacterCommand('u');
typeCharacterCommand('r');
window.setTimeout(sendDeleteWordKey, 100);
}
</script>
<title>Editing Test</title>
</head>
<body>
<div class="explanation">
<div class="scenario">
Tests:
<br>
Undo a delete word after a series of insertText does not wipe out the entire content.
</div>
</div>
<div contenteditable id="root">
<div id="test" class="editing"></div>
</div>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
var selection = window.getSelection();
selection.setPosition(document.getElementById("test"), 0);
editingTest();
</script>
</body>
</html>