Index: third_party/WebKit/LayoutTests/editing/selection/double_click_and_modify.html |
diff --git a/third_party/WebKit/LayoutTests/editing/selection/double_click_and_modify.html b/third_party/WebKit/LayoutTests/editing/selection/double_click_and_modify.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..cc737d09b2c529600d8c4a72e385714b008a9255 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/editing/selection/double_click_and_modify.html |
@@ -0,0 +1,33 @@ |
+<!doctype html> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script src="../assert_selection.js"></script> |
+<script> |
+// TODO(editing-dev): Once http://crbug.com/736253 fixed, we should use |
+// |chrome.pointerActionSequence()| instead of |eventSender|. |
+test(() => { |
+ function doDoubleClickInMiddle(selection, target) { |
+ const document = selection.document; |
+ const clickX = target.offsetLeft + target.offsetWidth / 2; |
+ const clickY = target.offsetTop + target.offsetHeight / 2; |
+ eventSender.mouseMoveTo(document.offsetLeft + clickX, |
+ document.offsetTop + clickY); |
+ eventSender.mouseDown(); |
+ eventSender.mouseUp(); |
+ eventSender.mouseDown(); |
+ eventSender.mouseUp(); |
+ } |
+ |
+ assert_exists(window, 'eventSender', 'This test requires eventSender.'); |
+ |
+ assert_selection( |
+ '<span id="sample">xyz</span>', |
+ selection => { |
+ const sample = selection.document.getElementById('sample'); |
+ doDoubleClickInMiddle(selection, sample); |
+ sample.insertBefore(new Text('abc'), sample.firstChild); |
+ }, |
+ '<span id="sample">abc^xyz|</span>', |
+ 'DOM modification outside selection should not affect selection'); |
+}, 'Double-click and modify text'); |
+</script> |