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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/selection/collapse/collapse_before_select.html

Issue 2697313005: Selection API: collapse() should recreate an internal Range. (Closed)
Patch Set: Add NeedsRebaseline for platform-dependent tests Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <script src="../../../resources/testharness.js"></script> 2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script> 3 <script src="../../../resources/testharnessreport.js"></script>
4 <div contenteditable id="anchor"><select><option>One</option></select>blaa</div> 4 <div contenteditable id="anchor"><select><option>One</option></select>blaa</div>
5 <div id="log"></div> 5 <div id="log"></div>
6 <script> 6 <script>
7 test(function() { 7 test(function() {
8 var selection = window.getSelection(); 8 var selection = window.getSelection();
9 var select = document.querySelector('select'); 9 var select = document.querySelector('select');
10 selection.collapse(select, 0); 10 selection.collapse(select, 0);
11 11
12 var anchor = document.getElementById('anchor'); 12 var anchor = document.getElementById('anchor');
13 assert_equals(selection.anchorNode, anchor, 'anchorNode'); 13 assert_equals(selection.anchorNode, select, 'DOM anchorNode');
14 assert_equals(selection.anchorOffset, 0, 'anchorOffset'); 14 assert_equals(selection.anchorOffset, 0, 'DOM anchorOffset');
15 assert_equals(selection.focusNode, anchor, 'focusNode'); 15 assert_equals(selection.focusNode, select, 'DOM focusNode');
16 assert_equals(selection.focusOffset, 0, 'focusOffset'); 16 assert_equals(selection.focusOffset, 0, 'DOM focusOffset');
17 }, 'can not place caret inside SELECT element'); 17
18 assert_exists(window, 'internals');
19 assert_equals(internals.visibleSelectionAnchorNode, anchor, 'Canonicalized a nchorNode');
20 assert_equals(internals.visibleSelectionAnchorOffset, 0, 'Canonicalized anch orOffset');
21 assert_equals(internals.visibleSelectionFocusNode, anchor, 'Canonicalized fo cusNode');
22 assert_equals(internals.visibleSelectionFocusOffset, 0, 'Canonicalized focus Offset');
23 }, 'can not place canonicalized caret inside SELECT element');
18 </script> 24 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698