Index: third_party/WebKit/LayoutTests/editing/selection/focus_editable_html_element.html |
diff --git a/third_party/WebKit/LayoutTests/editing/selection/focus_editable_html_element.html b/third_party/WebKit/LayoutTests/editing/selection/focus_editable_html_element.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0225f806b098ffa36a29037ff6a5a9e438c9740a |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/editing/selection/focus_editable_html_element.html |
@@ -0,0 +1,28 @@ |
+<!doctype html> |
+<html contenteditable> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<body> |
+This tests to see where the selection is set when an html element is focused. |
+<br> |
+We set it inside the body because we don't want to allow editing outside the |
+body. |
+<div id="log"></div> |
+</body> |
+</html> |
+<script> |
+var test = async_test('focus to editable should not scroll'); |
+document.documentElement.addEventListener('focus', function() { |
+ var selection = window.getSelection(); |
+ var anchor = document.body.firstChild; |
+ assert_equals(selection.anchorNode, anchor, 'anchorNode'); |
+ assert_equals(selection.anchorOffset, 1, 'anchorOffset'); |
+ assert_equals(selection.focusNode, anchor, 'focusNode'); |
+ assert_equals(selection.focusOffset, 1, 'focusOffset'); |
+ |
+ test.done(); |
+}); |
+test.step(function() { |
+ document.documentElement.focus(); |
+}); |
+</script> |