Commit 1413bab6 authored by yosin's avatar yosin Committed by Commit bot

Convert editing/pasteboard/5065605.html to use w3c test harness

This patch converts "editing/pasteboard/5065605.html" to use w3c test harness to
simplify test script, and renames to "copy_and_paste_with_colored_text.html" to
provide a hint what this test script verifies, for improving code health.

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

Review-Url: https://codereview.chromium.org/2342673003
Cr-Commit-Position: refs/heads/master@{#419117}
parent b5bc3aa8
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
This tests for a bug where text copied with Select All + Copy would lose its color.
| <font>
| color="#ff0000"
| "This text should be red."
| <div>
| <font>
| color="#ff0000"
| "This text should be red."
| <div>
| <font>
| color="#ff0000"
| "This text should be red."
| <div>
| <font>
| color="#ff0000"
| "This text should be red.<#selection-caret>"
<!DOCTYPE html>
<html>
<body>
<div id="div" contenteditable="true"><br></div>
<script src="../../resources/dump-as-markup.js"></script>
<script>
var div = document.getElementById("div");
div.focus();
if (window.testRunner)
testRunner.dumpEditingCallbacks();
document.execCommand("InsertText", false, "This text should be red.");
document.execCommand("InsertParagraph");
document.execCommand("InsertText", false, "This text should be red.");
document.execCommand("SelectAll");
document.execCommand("ForeColor", false, "red");
document.execCommand("Copy");
window.getSelection().modify("move", "forward", "character");
document.execCommand("InsertParagraph");
document.execCommand("Paste");
Markup.description('This tests for a bug where text copied with Select All + Copy would lose its color.');
Markup.dump('div');
</script>
</body>
</html>
<!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.internals, undefined,
'This test requires window.internals to access clipboard');
assert_selection(
[
'<div contenteditable>',
'<font color="red">^abc</font>',
'<div><font color="red">def|</font></div>',
'</div>',
].join(''),
selection => {
selection.document.execCommand('copy');
selection.modify('move', 'forward', 'character');
selection.document.execCommand('insertParagraph');
selection.document.execCommand('paste');
},
[
'<div contenteditable>',
'<font color="red">abc</font>',
'<div><font color="red">def</font></div>',
'<div>',
'<font color="red">abc</font>',
'<div><font color="red">def|</font></div>',
'</div>',
'</div>',
].join(''),
'Copy and paste with colored text');
});
</script>
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