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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/selection/selection-update-range-after-addrange.html

Issue 2687273002: Selection API: Mutating a Range object after adding it to Selection should update Selection attribu… (Closed)
Patch Set: . 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
(Empty)
1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <p>abcdef</p>
5 <script>
6 test(() => {
7 let selection = getSelection();
8 selection.removeAllRanges();
9 let range = document.createRange();
10 let text = document.querySelector('p').firstChild;
11 range.setStart(text, 1);
12 range.setEnd(text, 2);
13
14 selection.addRange(range);
15 assert_equals(selection.anchorNode, text);
yosin_UTC9 2017/02/10 10:26:27 Could you use assesrt_selection()? It is easier to
tkent 2017/02/13 07:31:40 We can't test Range-Selection relationship behavio
16 assert_equals(selection.anchorOffset, 1);
17 assert_equals(selection.focusNode, text);
18 assert_equals(selection.focusOffset, 2);
19
20 range.setStart(text, 0);
21 assert_equals(selection.anchorOffset, 0);
22 }, 'Mutation of Range after adding it to Selection should update Selection attri butes.');
23 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698