Commit 24e648cb authored by yosin's avatar yosin Committed by Commit bot

Convert editing/pasteboard/paste-table-002.html to use w3c test harness

his patch converts "editing/pasteboard/paste-table-002.html"
to use w3c test harness to simplify test case for improving code helath.

BUG=n/a
TEST=n/a; no behavior changes

Review-Url: https://codereview.chromium.org/2370683002
Cr-Commit-Position: refs/heads/master@{#421149}
parent 8739bc4b
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
Problem: copy/pasting some HTML including tables can give rise to a <div> element as the first child of the table element. This is invalid.
abcdef
foo bar
ghijk
<div id="test" class="editing"> <div>abcdef<div style="text-align: center;"><table><tbody><tr><td>foo</td><td>bar</td></tr></tbody></table>ghijk</div> </div> </div>
<html> <!doctype html>
<head> <script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<style> <script src="../assert_selection.js"></script>
.editing {
border: 2px solid red;
font-size: 24px;
}
.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;}
.expected-results:first-line { font-weight: bold }
</style>
<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
<script>
function log(message) {
var console = document.getElementById("console");
var li = document.createElement("li");
var text = document.createTextNode(message);
li.appendChild(text);
console.appendChild(li);
}
function editingTest() {
execSelectAllCommand();
copyCommand();
execDeleteCommand();
pasteCommand();
}
</script>
<title>Editing Test</title>
</head>
<body>
Problem: copy/pasting some HTML including tables can give rise to a &lt;div&gt; element as the first child of the table element. This is invalid.
<div contenteditable id="root">
<div id="test" class="editing">
<div>
abcdef
<div style="text-align: center" >
<table><tr><td>foo</td><td>bar</td></tr></table>
ghijk
</div>
</div>
</div>
</div>
<ol id="console" />
<script> <script>
runEditingTest(); test(() => {
log(root.innerHTML); assert_not_equals(window.internals, undefined,
if (window.testRunner) 'This test requires window.internals to access clipboard');
testRunner.dumpAsText();
assert_selection(
[
'<div contenteditable>',
'<div>',
'<div>',
'^abcdef',
'<div style="text-align: center;">',
'<table><tr><td>foo</td><td>bar</td></tr></table>',
'ghijk|',
'</div>',
'</div>',
'</div>',
'</div>',
].join(''),
selection => {
selection.document.execCommand('copy');
selection.document.execCommand('delete');
selection.document.execCommand('paste');
},
[
'<div contenteditable>',
'abcdef',
'<div style="text-align: center;">',
'<table><tbody><tr><td>foo</td><td>bar</td></tr></tbody></table>',
'ghijk|',
'</div>',
'</div>',
].join(''));
});
</script> </script>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment