blob: 669adc482378992dd4ac2e5fdc20b990ab7badc5 [file] [log] [blame]
<!DOCTYPE html><!-- webkit-test-runner [ enableEditableImages=true ] -->
<head>
<script src="../../resources/ui-helper.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
addEventListener("load", async () => {
window.getSelection().setPosition(document.body, 0);
document.execCommand("InsertEditableImage");
const initialNumberOfStrokesInEditableImage = (await UIHelper.numberOfStrokesInEditableImage());
await UIHelper.drawSquareInEditableImage();
const numberOfStrokesInEditableImageAfterDrawing = (await UIHelper.numberOfStrokesInEditableImage());
document.execCommand('undo', false, null);
const numberOfStrokesInEditableImageAfterUndo = (await UIHelper.numberOfStrokesInEditableImage());
document.execCommand('redo', false, null);
const numberOfStrokesInEditableImageAfterRedo = (await UIHelper.numberOfStrokesInEditableImage());
await UIHelper.drawSquareInEditableImage();
const numberOfStrokesInEditableImageAfterSecondDrawing = (await UIHelper.numberOfStrokesInEditableImage());
document.getElementById("log").innerHTML = `Had ${initialNumberOfStrokesInEditableImage} strokes in editable image before drawing.<br/>Had ${numberOfStrokesInEditableImageAfterDrawing} stroke in editable image after drawing.<br/>Had ${numberOfStrokesInEditableImageAfterUndo} strokes in editable image after undo.<br/>Had ${numberOfStrokesInEditableImageAfterRedo} stroke in editable image after redo.<br/>Had ${numberOfStrokesInEditableImageAfterSecondDrawing} strokes in editable image after drawing again.`;
testRunner.notifyDone();
});
</script>
</head>
<body contenteditable>
<div id="log"></div>
</body>