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

Side by Side Diff: LayoutTests/fast/forms/setrangetext-within-events.html

Issue 548413002: Revert of Fix to keep the selection of the text field in input element after setSelectionRange... (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | LayoutTests/fast/forms/setrangetext-within-events-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script>
3 <script>
4 description("This tests the selection of the text field after setSelectionRa nge is called");
5 window.onload = function() {
6 if (window.eventSender) {
7 doSetSelectionRange('focus');
8 doSetSelectionRange('mousedown');
9 doSetSelectionRange('mouseup');
10 doSetSelectionRange('click');
11 }
12 }
13
14 function doSetSelectionRange(event) {
15 debug(event + ' test :');
16 var textfield = document.getElementById('textfield');
17 textfield.setSelectionRange(0, 1);
18 var tx = textfield.offsetLeft + 4;
19 var ty = textfield.offsetTop + 4;
20
21 textfield.addEventListener(event, setSelectionRange);
22 eventSender.mouseMoveTo(tx, ty);
23 eventSender.mouseDown();
24 eventSender.mouseUp();
25 if (event == 'mousedown') {
26 shouldBe('textfield.selectionStart', '0');
27 shouldBe('textfield.selectionEnd', '0');
28 } else {
29 shouldBe('textfield.selectionStart', '0');
30 shouldBe('textfield.selectionEnd', '5');
31 }
32 eventSender.mouseMoveTo(tx, ty + 30);
33 eventSender.mouseDown();
34 eventSender.mouseUp();
35 debug('the selection should be cleared');
36 shouldBe('textfield.selectionStart', '0');
37 shouldBe('textfield.selectionEnd', '0');
38 textfield.removeEventListener(event, setSelectionRange);
39 }
40
41 function setSelectionRange(e) {
42 var textfield = document.getElementById('textfield');
43 textfield.setSelectionRange(0, textfield.value.length);
44 }
45 </script>
46 <input type="text" value="value" id="textfield"></input>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/forms/setrangetext-within-events-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698