Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="../../resources/js-test.js"></script> | |
| 3 <script> | |
| 4 description("This tests the selection of the text field when mouse event occ urs out of range"); | |
| 5 window.onload = function() { | |
|
yosin_UTC9
2014/12/03 01:07:00
nit: Please add |jsTestIsAsync = true| and call |T
Miyoung Shin(g)
2014/12/03 03:39:10
Ok, I will update to use |jsTestIsAsync = true| an
| |
| 6 runTest(); | |
| 7 } | |
| 8 function runTest() { | |
| 9 var textfield = document.getElementById('textfield'); | |
| 10 textfield.addEventListener('focus', setSelectionRange); | |
| 11 textfield.setSelectionRange(0, 1); | |
| 12 var tx = textfield.offsetLeft + textfield.offsetWidth - 4; | |
| 13 var ty = textfield.offsetTop + 4; | |
| 14 | |
| 15 if (window.eventSender) { | |
| 16 eventSender.mouseMoveTo(tx, ty); | |
|
yosin_UTC9
2014/12/03 01:06:59
nit: Please use four spaces indentation.
Miyoung Shin(g)
2014/12/03 03:39:10
OK. I will update
| |
| 17 eventSender.mouseDown(); | |
| 18 eventSender.mouseUp(); | |
| 19 shouldBeZero('textfield.selectionStart'); | |
| 20 shouldBe('textfield.selectionEnd', '5'); | |
| 21 | |
| 22 eventSender.mouseMoveTo(textfield.offsetLeft, ty + 30); | |
| 23 eventSender.mouseDown(); | |
| 24 eventSender.mouseUp(); | |
| 25 debug('\nthe selection should be cleared'); | |
| 26 shouldBeZero('textfield.selectionStart'); | |
| 27 shouldBeZero('textfield.selectionEnd'); | |
| 28 } | |
| 29 } | |
| 30 | |
| 31 function setSelectionRange(e) { | |
| 32 var textfield = document.getElementById('textfield'); | |
| 33 textfield.setSelectionRange(0, 5); | |
| 34 } | |
| 35 </script> | |
| 36 <input type="text" value="valueeeeeeeeeeeeeeeeeeeeeeeeeeee" id="textfield"></inp ut> | |
|
yosin_UTC9
2014/12/03 01:07:00
nit: It is better to use different characters rath
Miyoung Shin(g)
2014/12/03 03:39:10
OK. I will update
| |
| OLD | NEW |