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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/forms/selection-setSelectionRange-frameselection.html

Issue 2270663002: Selection API of INPUT/TEXTAREA should not update FrameSelection without focusing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust more tests Created 4 years, 3 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 <body>
3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script>
5 <input id="notFocused" value="foo">
6 <input id="focused" value="a">
7 <script>
8 test(() => {
9 var notFocused = document.getElementById('notFocused');
10 var focused = document.getElementById('focused');
11 var selection = window.getSelection();
12 selection.removeAllRanges();
13 focused.focus();
14
15 var originalAnchorNode = selection.anchorNode;
16 var originalAnchorOffset = selection.anchorOffset;
17 notFocused.setSelectionRange(3, 3);
18 assert_equals(selection.anchorNode, originalAnchorNode);
19 assert_equals(selection.anchorOffset, originalAnchorOffset);
20 }, 'setSelectionRange() should not update FrameSelection if the target element i s not focused.');
21
22 test(() => {
23 var notFocused = document.getElementById('notFocused');
24 var focused = document.getElementById('focused');
25 var selection = window.getSelection();
26 selection.removeAllRanges();
27 focused.focus();
28
29 var originalAnchorNode = selection.anchorNode;
30 var originalAnchorOffset = selection.anchorOffset;
31 notFocused.setRangeText('barrr', 0, 3, 'select');
32 assert_equals(selection.anchorNode, originalAnchorNode);
33 assert_equals(selection.anchorOffset, originalAnchorOffset);
34 }, 'setRangeText() should not update FrameSelection if the target element is not focused.');
35 </script>
36 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698