Index: third_party/WebKit/LayoutTests/editing/pasteboard/paste-xml.xhtml |
diff --git a/third_party/WebKit/LayoutTests/editing/pasteboard/paste-xml.xhtml b/third_party/WebKit/LayoutTests/editing/pasteboard/paste-xml.xhtml |
index e815c47d5406d4e05d1e201d74d0dac7954ffd22..5a28c253f16ce9389df03a23bca5fe7ee8d2a96a 100644 |
--- a/third_party/WebKit/LayoutTests/editing/pasteboard/paste-xml.xhtml |
+++ b/third_party/WebKit/LayoutTests/editing/pasteboard/paste-xml.xhtml |
@@ -1,43 +1,33 @@ |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" |
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
-<head> |
- |
-<style> |
-.editing { |
- border: 2px solid red; |
- padding: 12px; |
- font-size: 24px; |
-} |
-</style> |
- |
-<script src="../editing.js" language="JavaScript" type="text/JavaScript" /> |
- |
-<script> |
- |
-function editingTest() { |
- for (i = 0; i != 4; i++) |
- moveSelectionForwardByCharacterCommand(); |
- for (i = 0; i != 3; i++) |
- extendSelectionForwardByCharacterCommand(); |
- copyCommand(); |
- moveSelectionForwardByCharacterCommand(); |
- pasteCommand(); |
-} |
- |
-</script> |
- |
-</head> |
- |
-<body> |
-<div contenteditable="" id="root" class="editing"> |
+<div contenteditable="" id="root"> |
<span id="test">foo bar baz</span> |
</div> |
<script> |
-runDumpAsTextEditingTest(true); |
+test(() => { |
+ assert_not_equals(window.internals, undefined, |
+ 'This test requires clipboard access'); |
+ |
+ const selection = window.getSelection(); |
+ const root = document.getElementById('root'); |
+ const test = document.getElementById('test'); |
+ |
+ selection.setBaseAndExtent(test.firstChild, 4, test.firstChild, 7); // foo ^bar| baz |
+ document.execCommand('copy'); |
+ selection.collapse(test.firstChild, 7); // foo bar| baz |
+ document.execCommand('paste'); |
+ |
+ const expectedText = '\n<span xmlns=\"http://www.w3.org/1999/xhtml\" id=\"test\">foo barbar baz</span>\n'; |
yosin_UTC9
2017/03/01 01:17:24
:-)
|
+ assert_equals(root.innerHTML, expectedText); |
+ assert_equals(selection.anchorNode, test.firstChild); |
+ assert_equals(selection.anchorOffset, 10); |
+ assert_equals(selection.type, 'Caret'); |
+}, 'Paste in XML'); |
</script> |
-</body> |
</html> |