Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1337392 - Update test cases to match new cursor behavior. r=smaug
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 4BdZyeqTBAx
  • Loading branch information
farre committed Mar 8, 2017
1 parent ccaa319 commit 88b5b98
Show file tree
Hide file tree
Showing 32 changed files with 38 additions and 47 deletions.
8 changes: 4 additions & 4 deletions accessible/tests/mochitest/jsat/test_content_text.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@
new ExpectedEditState({
editing: true,
multiline: true,
atStart: false,
atEnd: true
atStart: true,
atEnd: false
}),
new ExpectedCursorChange(
['Please refrain from Mayoneggs during this salmonella scare.',
{string: 'textarea'}]),
new ExpectedTextSelectionChanged(59, 59)
new ExpectedTextSelectionChanged(0, 0)
],
[ContentMessages.activateCurrent(10),
new ExpectedTextCaretChanged(10, 59),
new ExpectedTextCaretChanged(0, 10),
new ExpectedEditState({ editing: true,
multiline: true,
atStart: false,
Expand Down
1 change: 1 addition & 0 deletions accessible/tests/mochitest/states/test_inputs.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
// (per spec, min/maxlength validity is affected by interactive edits)
var mininp = document.getElementById("minlength");
mininp.focus();
mininp.setSelectionRange(mininp.value.length, mininp.value.length);
synthesizeKey("VK_BACK_SPACE", {});
ok(!mininp.validity.valid,
"input should be invalid after interactive edits");
Expand Down
3 changes: 3 additions & 0 deletions devtools/client/netmonitor/test/browser_net_resend.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ add_task(function* () {
let queryFocus = once(query, "focus", false);
// Bug 1195825: Due to some unexplained dark-matter with promise,
// focus only works if delayed by one tick.
query.setSelectionRange(query.value.length, query.value.length);
executeSoon(() => query.focus());
yield queryFocus;

Expand All @@ -115,6 +116,7 @@ add_task(function* () {

let headers = document.getElementById("custom-headers-value");
let headersFocus = once(headers, "focus", false);
headers.setSelectionRange(headers.value.length, headers.value.length);
headers.focus();
yield headersFocus;

Expand All @@ -129,6 +131,7 @@ add_task(function* () {

let postData = document.getElementById("custom-postdata-value");
let postFocus = once(postData, "focus", false);
postData.setSelectionRange(postData.value.length, postData.value.length);
postData.focus();
yield postFocus;

Expand Down
2 changes: 2 additions & 0 deletions dom/html/test/test_bug613019.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
is(elem.value, "Test", "Element has incorrect starting value.");
is(elem.validity.tooLong, false, "Element should not be tooLong.");

elem.setSelectionRange(elem.value.length, elem.value.length)
elem.focus();

synthesizeKey("VK_BACK_SPACE", {});
Expand All @@ -47,6 +48,7 @@
is(elem.value, "Test", "Element has incorrect starting value.");
is(elem.validity.tooLong, false, "Element should not be tooShort.");

elem.setSelectionRange(elem.value.length, elem.value.length)
elem.focus();

synthesizeKey("e", {});
Expand Down
1 change: 1 addition & 0 deletions editor/libeditor/tests/test_bug850043.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
getService(SpecialPowers.Ci.nsIFocusManager);

let element = document.getElementById("textarea");
element.setSelectionRange(element.value.length, element.value.length);
element.focus();
is(SpecialPowers.unwrap(fm.focusedElement), element, "failed to move focus");

Expand Down
2 changes: 0 additions & 2 deletions layout/base/tests/bug1082486-1.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
<script>
function focusInput() {
var inp = document.getElementById('i');
inp.selectionStart = 0;
inp.selectionEnd = 0;
inp.focus();
}
</script>
Expand Down
2 changes: 0 additions & 2 deletions layout/base/tests/bug646382-1-ref.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
<script>
var textarea = document.querySelector("textarea");
function start() {
textarea.selectionStart = 0;
textarea.selectionEnd = 0;
textarea.focus();
}
function done() {
Expand Down
2 changes: 0 additions & 2 deletions layout/base/tests/bug646382-2-ref.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
<script>
var textarea = document.querySelector("textarea");
function start() {
textarea.selectionStart = 0;
textarea.selectionEnd = 0;
textarea.focus();
}
function done() {
Expand Down
2 changes: 0 additions & 2 deletions layout/base/tests/bug664087-1-ref.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
<script>
var textarea = document.querySelector("textarea");
function start() {
textarea.selectionStart = 0;
textarea.selectionEnd = 0;
textarea.focus();
}
function done() {
Expand Down
2 changes: 0 additions & 2 deletions layout/base/tests/bug664087-2-ref.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
<script>
var textarea = document.querySelector("textarea");
function start() {
textarea.selectionStart = 0;
textarea.selectionEnd = 0;
textarea.focus();
}
function done() {
Expand Down
3 changes: 2 additions & 1 deletion layout/base/tests/bug956530-1.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script>
function test() {
focus();
var i = document.querySelector("input");
i.setSelectionRange(i.value.length,i.value.length);
focus();
synthesizeMouseAtCenter(i, {});
setTimeout(function() {
synthesizeMouseAtCenter(document.body, {});
Expand Down
2 changes: 1 addition & 1 deletion layout/base/tests/input-maxlength-invalid-change.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script>
function runTest() {
var input = document.getElementById('input');
input.setSelectionRange(input.value.length, input.value.length)
input.focus();
synthesizeKey('VK_BACK_SPACE', {});
input.blur(); // to hide the caret
Expand All @@ -22,4 +23,3 @@
<input id="input" maxlength="2" value="fooo">
</body>
</html>

2 changes: 1 addition & 1 deletion layout/base/tests/input-maxlength-ui-invalid-change.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script>
function runTest() {
var input = document.getElementById('input');
input.setSelectionRange(input.value.length, input.value.length)
input.focus();
synthesizeKey('VK_BACK_SPACE', {});
input.blur(); // to hide the caret
Expand All @@ -22,4 +23,3 @@
<input id="input" maxlength="2" value="fooo">
</body>
</html>

2 changes: 1 addition & 1 deletion layout/base/tests/input-maxlength-ui-valid-change.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script>
function runTest() {
var input = document.getElementById('input');
input.setSelectionRange(input.value.length, input.value.length)
input.focus();
synthesizeKey('VK_BACK_SPACE', {}); // so that it becomes invalid first
input.blur();
Expand All @@ -25,4 +26,3 @@
<input id="input" maxlength="3" value="foooo">
</body>
</html>

2 changes: 1 addition & 1 deletion layout/base/tests/input-maxlength-valid-change.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script>
function runTest() {
var input = document.getElementById('input');
input.setSelectionRange(input.value.length, input.value.length)
input.focus();
synthesizeKey('VK_BACK_SPACE', {}); // so that it becomes invalid first
input.blur();
Expand All @@ -25,4 +26,3 @@
<input id="input" maxlength="3" value="foooo">
</body>
</html>

2 changes: 1 addition & 1 deletion layout/base/tests/input-minlength-invalid-change.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script>
function runTest() {
var input = document.getElementById('input');
input.setSelectionRange(input.value.length, input.value.length)
input.focus();
synthesizeKey('o', {});
input.blur(); // to hide the caret
Expand All @@ -22,4 +23,3 @@
<input id="input" minlength="4" value="fo">
</body>
</html>

2 changes: 1 addition & 1 deletion layout/base/tests/input-minlength-ui-invalid-change.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script>
function runTest() {
var input = document.getElementById('input');
input.setSelectionRange(input.value.length, input.value.length)
input.focus();
synthesizeKey('o', {});
input.blur(); // to hide the caret
Expand All @@ -22,4 +23,3 @@
<input id="input" minlength="4" value="fo">
</body>
</html>

2 changes: 1 addition & 1 deletion layout/base/tests/input-minlength-ui-valid-change.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script>
function runTest() {
var input = document.getElementById('input');
input.setSelectionRange(input.value.length, input.value.length)
input.focus();
synthesizeKey('o', {}); // so that it becomes invalid first
input.blur();
Expand All @@ -25,4 +26,3 @@
<input id="input" minlength="3" value="f">
</body>
</html>

2 changes: 1 addition & 1 deletion layout/base/tests/input-minlength-valid-change.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script>
function runTest() {
var input = document.getElementById('input');
input.setSelectionRange(input.value.length, input.value.length)
input.focus();
synthesizeKey('o', {}); // so that it becomes invalid first
input.blur();
Expand All @@ -25,4 +26,3 @@
<input id="input" minlength="3" value="f">
</body>
</html>

2 changes: 1 addition & 1 deletion layout/base/tests/textarea-maxlength-invalid-change.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script>
function runTest() {
var textarea = document.getElementById('textarea');
textarea.setSelectionRange(textarea.value.length, textarea.value.length)
textarea.focus();
synthesizeKey('VK_BACK_SPACE', {});
textarea.blur(); // to hide the caret
Expand All @@ -22,4 +23,3 @@
<textarea id="textarea" maxlength="2">fooo</textarea>
</body>
</html>

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script>
function runTest() {
var textarea = document.getElementById('textarea');
textarea.setSelectionRange(textarea.value.length, textarea.value.length)
textarea.focus();
synthesizeKey('VK_BACK_SPACE', {});
textarea.blur(); // to hide the caret
Expand All @@ -22,4 +23,3 @@
<textarea id="textarea" maxlength="2">fooo</textarea>
</body>
</html>

2 changes: 1 addition & 1 deletion layout/base/tests/textarea-maxlength-ui-valid-change.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script>
function runTest() {
var textarea = document.getElementById('textarea');
textarea.setSelectionRange(textarea.value.length, textarea.value.length)
textarea.focus();
synthesizeKey('VK_BACK_SPACE', {}); // so that it becomes invalid first
textarea.blur();
Expand All @@ -25,4 +26,3 @@
<textarea id="textarea" maxlength="3">foooo</textarea>
</body>
</html>

2 changes: 1 addition & 1 deletion layout/base/tests/textarea-maxlength-valid-change.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script>
function runTest() {
var textarea = document.getElementById('textarea');
textarea.setSelectionRange(textarea.value.length, textarea.value.length)
textarea.focus();
synthesizeKey('VK_BACK_SPACE', {}); // so that it becomes invalid first
textarea.blur();
Expand All @@ -25,4 +26,3 @@
<textarea id="textarea" maxlength="3">foooo</textarea>
</body>
</html>

2 changes: 1 addition & 1 deletion layout/base/tests/textarea-minlength-invalid-change.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script>
function runTest() {
var textarea = document.getElementById('textarea');
textarea.setSelectionRange(textarea.value.length, textarea.value.length)
textarea.focus();
synthesizeKey('o', {});
textarea.blur(); // to hide the caret
Expand All @@ -22,4 +23,3 @@
<textarea id="textarea" minlength="4">fo</textarea>
</body>
</html>

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script>
function runTest() {
var textarea = document.getElementById('textarea');
textarea.setSelectionRange(textarea.value.length, textarea.value.length)
textarea.focus();
synthesizeKey('o', {});
textarea.blur(); // to hide the caret
Expand All @@ -22,4 +23,3 @@
<textarea id="textarea" minlength="4">fo</textarea>
</body>
</html>

2 changes: 1 addition & 1 deletion layout/base/tests/textarea-minlength-ui-valid-change.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script>
function runTest() {
var textarea = document.getElementById('textarea');
textarea.setSelectionRange(textarea.value.length, textarea.value.length)
textarea.focus();
synthesizeKey('o', {}); // so that it becomes invalid first
textarea.blur();
Expand All @@ -25,4 +26,3 @@
<textarea id="textarea" minlength="3">f</textarea>
</body>
</html>

2 changes: 1 addition & 1 deletion layout/base/tests/textarea-minlength-valid-change.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script>
function runTest() {
var textarea = document.getElementById('textarea');
textarea.setSelectionRange(textarea.value.length, textarea.value.length)
textarea.focus();
synthesizeKey('o', {}); // so that it becomes invalid first
textarea.blur();
Expand All @@ -25,4 +26,3 @@
<textarea id="textarea" minlength="3">f</textarea>
</body>
</html>

9 changes: 4 additions & 5 deletions layout/forms/test/bug287446_subframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,21 @@
doIs(t.value, "Test", "Shouldn't have lost our initial value");
t.focus();
sendString("Foo");
doIs(t.value, "TestFoo", "Typing should work");
doIs(t.value, "FooTest", "Typing should work");
window.parent.postMessage("c", "*");
} else {
doIs(evt.data, "continue", "Unexpected message");
doIs(t.value, "TestFoo", "Shouldn't have lost our typed value");
doIs(t.value, "FooTest", "Shouldn't have lost our typed value");
sendString("Bar");
doIs(t.value, "TestFooBar", "Typing should still work");
doIs(t.value, "FooBarTest", "Typing should still work");
window.parent.postMessage("f", "*");
}
},
"false");

</script>
</head>
<body>
<input id="target" value="Test">
</body>
</html>

4 changes: 1 addition & 3 deletions layout/forms/test/test_bug353539.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</textarea>
</p>
<div id="content" style="display: none">

</div>
<pre id="test">
<script type="application/javascript">
Expand All @@ -38,8 +38,6 @@
var area = document.getElementById("area");

is(area.scrollTop, 0, "The textarea should not be scrolled initially");
area.selectionStart = 0;
area.selectionEnd = 0;
area.focus();
setTimeout(function() {
is(area.scrollTop, 0, "The textarea's insertion point should not be scrolled into view");
Expand Down
Loading

0 comments on commit 88b5b98

Please sign in to comment.