Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Unified Diff: LayoutTests/editing/selection/keep-selection-after-set-focus.html

Issue 424973003: Don't clear selection on focus change except for text form control element (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2014-08-13T13:21:11 Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/editing/selection/keep-selection-after-set-focus.html
diff --git a/LayoutTests/editing/selection/keep-selection-after-set-focus.html b/LayoutTests/editing/selection/keep-selection-after-set-focus.html
new file mode 100644
index 0000000000000000000000000000000000000000..55ca2a3d09a1a6d8b6d980aaab4579a30a8e69f9
--- /dev/null
+++ b/LayoutTests/editing/selection/keep-selection-after-set-focus.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<script src="../../resources/js-test.js"></script>
+<div id="container">
+<p contenteditable id="sample">01234567</p>
+<button id="button">This is a button</button>
+</div>
+<script>
+description('Selection should be kept after focus changed.');
+var selection = getSelection();
+var sample = document.getElementById('sample').firstChild;
+selection.collapse(sample, 3);
+selection.extend(sample, 6);
+document.getElementById('button').focus();
+shouldBe('selection.anchorNode', 'sample');
+shouldBe('selection.anchorOffset', '3');
+shouldBe('selection.focusNode', 'sample');
+shouldBe('selection.focusOffset', '6');
+document.getElementById('container').outerHTML = '';
+</script>
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/editing/selection/keep-selection-after-set-focus-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698