Index: LayoutTests/fast/forms/setrangetext-out-of-range.html |
diff --git a/LayoutTests/fast/forms/setrangetext-out-of-range.html b/LayoutTests/fast/forms/setrangetext-out-of-range.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..97f99fb6ad2e4ae406fa0a6ff4f405defa96978a |
--- /dev/null |
+++ b/LayoutTests/fast/forms/setrangetext-out-of-range.html |
@@ -0,0 +1,36 @@ |
+<!DOCTYPE html> |
+<script src="../../resources/js-test.js"></script> |
+<script> |
+ description("This tests the selection of the text field when mouse event occurs out of range"); |
+ 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
|
+ runTest(); |
+ } |
+ function runTest() { |
+ var textfield = document.getElementById('textfield'); |
+ textfield.addEventListener('focus', setSelectionRange); |
+ textfield.setSelectionRange(0, 1); |
+ var tx = textfield.offsetLeft + textfield.offsetWidth - 4; |
+ var ty = textfield.offsetTop + 4; |
+ |
+ if (window.eventSender) { |
+ 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
|
+ eventSender.mouseDown(); |
+ eventSender.mouseUp(); |
+ shouldBeZero('textfield.selectionStart'); |
+ shouldBe('textfield.selectionEnd', '5'); |
+ |
+ eventSender.mouseMoveTo(textfield.offsetLeft, ty + 30); |
+ eventSender.mouseDown(); |
+ eventSender.mouseUp(); |
+ debug('\nthe selection should be cleared'); |
+ shouldBeZero('textfield.selectionStart'); |
+ shouldBeZero('textfield.selectionEnd'); |
+ } |
+ } |
+ |
+ function setSelectionRange(e) { |
+ var textfield = document.getElementById('textfield'); |
+ textfield.setSelectionRange(0, 5); |
+ } |
+</script> |
+<input type="text" value="valueeeeeeeeeeeeeeeeeeeeeeeeeeee" id="textfield"></input> |
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
|