OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <script src="../../resources/js-test.js"></script> | |
3 <script> | |
4 window.onload = function() { | |
Rick Byers
2014/08/28 18:16:41
please add a description() call
Miyoung Shin(g)
2014/08/29 14:18:52
OK, I will
| |
5 if (window.eventSender) { | |
6 doSetSelectionRange('focus'); | |
7 doSetSelectionRange('mousedown'); | |
8 doSetSelectionRange('mouseup'); | |
9 doSetSelectionRange('click'); | |
10 } | |
11 } | |
12 | |
13 function doSetSelectionRange(event) { | |
14 debug(event + ' :'); | |
15 var textfield = document.getElementById('textfield'); | |
16 var tx = textfield.offsetLeft + 4; | |
17 var ty = textfield.offsetTop + 4; | |
18 | |
19 textfield.addEventListener(event, setSelectionRange); | |
20 eventSender.mouseMoveTo(tx, ty); | |
21 if (event == 'mousedown') { | |
Rick Byers
2014/08/28 18:16:41
is this behavior of clearing for changes in moused
Miyoung Shin(g)
2014/08/29 14:18:52
This is intended to work like it.
I referred tota
Rick Byers
2014/08/29 15:48:05
Sounds reasonable, thanks.
| |
22 eventSender.mouseDown(); | |
23 eventSender.mouseUp(); | |
24 shouldBe('textfield.selectionStart', '0'); | |
25 shouldBe('textfield.selectionEnd', '0'); | |
26 } else { | |
27 eventSender.mouseDown(); | |
28 eventSender.mouseUp(); | |
Rick Byers
2014/08/28 18:16:41
The first three lines here are duplicated with abo
Miyoung Shin(g)
2014/08/29 14:18:52
OK, I will
| |
29 shouldBe('textfield.selectionStart', '0'); | |
30 shouldBe('textfield.selectionEnd', '5'); | |
31 } | |
32 eventSender.mouseMoveTo(tx, ty + 100); | |
Rick Byers
2014/08/28 18:16:41
Is this click here to clear the selection? If so
Miyoung Shin(g)
2014/08/29 14:18:52
OK, I will
| |
33 eventSender.mouseDown(); | |
34 eventSender.mouseUp(); | |
35 textfield.removeEventListener(event, setSelectionRange); | |
36 } | |
37 | |
38 function setSelectionRange(e) { | |
39 var textfield = document.getElementById('textfield'); | |
Rick Byers
2014/08/28 18:16:41
perhaps this function should output a log entry to
Miyoung Shin(g)
2014/08/29 14:18:52
If I try to output here, we may lost focus of inpu
Rick Byers
2014/08/29 15:48:05
Ok, even better then - how about resetting the sel
| |
40 textfield.setSelectionRange(0, textfield.value.length); | |
41 } | |
42 </script> | |
43 <input type="text" value="value" id="textfield"></input> | |
OLD | NEW |