Commit 5e92033a authored by yosin's avatar yosin Committed by Commit bot

Convert editing/deleting/delete-to-end-of-paragraph.html to use w3c test harness

This patch converts "editing/deleting/delete-to-end-of-paragraph.html" to use
w3c test harness to simplify test script for improving
code health.

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

Review-Url: https://codereview.chromium.org/2333193002
Cr-Commit-Position: refs/heads/master@{#418777}
parent d5bcb937
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
| "<#selection-caret>four five six"
| <br>
<!DOCTYPE html>
<html>
<head>
<style>
.editing {
font-size: 24px;
width: 600px;
}
</style>
<title>Editing Test</title>
</head>
<body contenteditable id="root">
<div id="test" class="editing">one two three</div><div>four five six</div>
<script src="../../resources/dump-as-markup.js"></script>
<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
test(() => {
assert_not_equals(window.testRunner, undefined,
'This test requires testRunner.');
if (!window.testRunner)
document.write("(cannot run interactively)");
else {
testRunner.dumpEditingCallbacks();
getSelection().collapse(document.getElementById('test'), 0);
// test for 4570218 by using double deleteToEndOfParagraph
testRunner.execCommand("DeleteToEndOfParagraph");
testRunner.execCommand("DeleteToEndOfParagraph");
Markup.dump('test');
}
assert_selection(
[
'<div contenteditable>',
'<div>|one two three</div>',
'<div>four five six</div>',
'</div>',
].join(''),
selection => {
testRunner.execCommand('deleteToEndOfParagraph');
},
[
'<div contenteditable>',
'<div>|<br></div><div>four five six</div>',
'</div>',
].join(''),
'1 Delete a paragraph');
assert_selection(
[
'<div contenteditable>',
'<div>|<br></div>',
'<div>four five six</div>',
'</div>',
].join(''),
selection => {
testRunner.execCommand('deleteToEndOfParagraph');
},
[
'<div contenteditable>',
'<div>|four five six</div>',
'</div>',
].join(''),
'2 Delete an empty paragraph');
}, 'Delete to end of paragraph');
</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