Commit faa16b56 authored by yosin's avatar yosin Committed by Commit bot

Convert editing/inserting/insert-paragraph-at-end-of-line.html to use w3c test harness

This patch converts "editing/inserting/insert-paragraph-at-end-of-line.html" to
use w3c test harness to simplify test script for improving readability.

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

Review-Url: https://codereview.chromium.org/2284353002
Cr-Commit-Position: refs/heads/master@{#415246}
parent aeeadb3e
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
This tests the fix for <rdar://problem/6633727> - Hitting return at the end of a line with an anchor jumps me to the bottom of the message.
If the test has passed, the numbers should be in order, and only "1" should be a link.
| <a>
| href="#"
| id="anchor"
| "1"
| <div>
| "2<#selection-caret>"
| <br>
| <div>
| "3"
<!DOCTYPE html>
<html>
<body>
<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>
<div id="log"></div>
<script>
if (window.testRunner)
testRunner.dumpEditingCallbacks();
// Set up the div
var editable = document.createElement('div');
editable.contentEditable = true;
editable.innerHTML = '<a href="#" id="anchor">1</a><div>3</div>';
document.body.appendChild(editable);
editable.focus();
// Edit it with execCommand
var sel = window.getSelection();
sel.collapse(document.getElementById('anchor'), 1);
document.execCommand("InsertParagraph");
document.execCommand("InsertText", false, "2");
Markup.description('This tests the fix for <rdar://problem/6633727> - Hitting return at the end of a line with an anchor jumps me to the bottom of the message.\n'+
'If the test has passed, the numbers should be in order, and only "1" should be a link.');
Markup.dump(editable);
test(() => assert_selection(
[
'<div contenteditable>',
'<a href="#">1|</a><div>3</div>',
'</div>',
].join(''),
selection => {
selection.document.execCommand('insertParagraph');
selection.document.execCommand('insertText', false, '2');
},
[
'<div contenteditable>',
'<a href="#">1</a>',
'<div>2|<br>',
'<div>3</div>',
'</div>',
'</div>',
].join('')),
'Simulate hitting return at the end of line');
</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