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..48a28ff0c1b3ff7564d4f904646eae7f7f439222 |
--- /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"); |
+ jsTestIsAsync = true; |
+ window.onload = function() { |
+ runTest(); |
+ } |
+ function runTest() { |
+ var textfield = document.getElementById('textfield'); |
+ textfield.addEventListener('focus', setSelectionRange); |
+ textfield.setSelectionRange(0, 1); |
+ |
+ if (window.eventSender) { |
+ eventSender.mouseMoveTo(textfield.offsetLeft + textfield.offsetWidth - 4, textfield.offsetTop + 4); |
+ eventSender.mouseDown(); |
+ eventSender.mouseUp(); |
+ shouldBeZero('textfield.selectionStart'); |
+ shouldBe('textfield.selectionEnd', '5'); |
+ |
+ eventSender.mouseMoveTo(textfield.offsetLeft + textfield.offsetWidth - 4, textfield.offsetTop + 4); |
+ eventSender.mouseDown(); |
+ eventSender.mouseUp(); |
+ debug('\nthe selection should be cleared'); |
+ shouldBeNonZero('textfield.selectionStart'); |
+ shouldBeNonZero('textfield.selectionEnd'); |
+ } |
+ finishJSTest(); |
+ } |
+ |
+ function setSelectionRange(e) { |
+ var textfield = document.getElementById('textfield'); |
+ textfield.setSelectionRange(0, 5); |
+ } |
+</script> |
+<input type="text" value="This text field is for the selection test" id="textfield"></input> |