summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/editing/deleting/display-table.html
blob: f7b138621be011e091380fc01d91ca5293151a96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html>
<head>
<style>
#tableDiv {
    display: table;
}
</style>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<div id="tableDiv" contenteditable="true"></div>
<div id="log"></div>
<script>
function runTest(caretPosition, deleteCommand, expectedString)
{
    var testDiv = document.getElementById('tableDiv');
    testDiv.innerText = 'ABCD';

    var selection = window.getSelection();
    selection.collapse(testDiv, caretPosition);

    document.execCommand(deleteCommand);
    shouldBeEqualToString("document.getElementById('tableDiv').textContent", expectedString);
}

description("This test verifies that we are able to successfully delete the first and the last characters of a contenteditable div with display: table.");

runTest(0, "forwardDelete", "BCD");
runTest(1, "Delete", "ABC");

if (window.testRunner)
    document.getElementById('tableDiv').outerHTML = '';

finishJSTest();
</script>
</body>
</html>