зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1337392 - Update test cases to match new cursor behavior. r=smaug
MozReview-Commit-ID: 4BdZyeqTBAx
This commit is contained in:
Родитель
37de7414cb
Коммит
85536fcfc4
|
@ -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,
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ function testInteractivityOfMaxLength(elem) {
|
|||
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", {});
|
||||
|
@ -47,6 +48,7 @@ function testInteractivityOfMinLength(elem) {
|
|||
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", {});
|
||||
|
|
|
@ -30,6 +30,7 @@ SimpleTest.waitForFocus(() => {
|
|||
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");
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
<script>
|
||||
function focusInput() {
|
||||
var inp = document.getElementById('i');
|
||||
inp.selectionStart = 0;
|
||||
inp.selectionEnd = 0;
|
||||
inp.focus();
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
<script>
|
||||
var textarea = document.querySelector("textarea");
|
||||
function start() {
|
||||
textarea.selectionStart = 0;
|
||||
textarea.selectionEnd = 0;
|
||||
textarea.focus();
|
||||
}
|
||||
function done() {
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
<script>
|
||||
var textarea = document.querySelector("textarea");
|
||||
function start() {
|
||||
textarea.selectionStart = 0;
|
||||
textarea.selectionEnd = 0;
|
||||
textarea.focus();
|
||||
}
|
||||
function done() {
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
<script>
|
||||
var textarea = document.querySelector("textarea");
|
||||
function start() {
|
||||
textarea.selectionStart = 0;
|
||||
textarea.selectionEnd = 0;
|
||||
textarea.focus();
|
||||
}
|
||||
function done() {
|
||||
|
|
|
@ -9,8 +9,6 @@ c</textarea>
|
|||
<script>
|
||||
var textarea = document.querySelector("textarea");
|
||||
function start() {
|
||||
textarea.selectionStart = 0;
|
||||
textarea.selectionEnd = 0;
|
||||
textarea.focus();
|
||||
}
|
||||
function done() {
|
||||
|
|
|
@ -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, {});
|
||||
|
|
|
@ -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
|
||||
|
@ -22,4 +23,3 @@
|
|||
<input id="input" maxlength="2" value="fooo">
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -22,4 +23,3 @@
|
|||
<input id="input" maxlength="2" value="fooo">
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
@ -25,4 +26,3 @@
|
|||
<input id="input" maxlength="3" value="foooo">
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
@ -25,4 +26,3 @@
|
|||
<input id="input" maxlength="3" value="foooo">
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -22,4 +23,3 @@
|
|||
<input id="input" minlength="4" value="fo">
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -22,4 +23,3 @@
|
|||
<input id="input" minlength="4" value="fo">
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
@ -25,4 +26,3 @@
|
|||
<input id="input" minlength="3" value="f">
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
@ -25,4 +26,3 @@
|
|||
<input id="input" minlength="3" value="f">
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -22,4 +23,3 @@
|
|||
<textarea id="textarea" maxlength="2">fooo</textarea>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -22,4 +23,3 @@
|
|||
<textarea id="textarea" maxlength="2">fooo</textarea>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
@ -25,4 +26,3 @@
|
|||
<textarea id="textarea" maxlength="3">foooo</textarea>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
@ -25,4 +26,3 @@
|
|||
<textarea id="textarea" maxlength="3">foooo</textarea>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -22,4 +23,3 @@
|
|||
<textarea id="textarea" minlength="4">fo</textarea>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -22,4 +23,3 @@
|
|||
<textarea id="textarea" minlength="4">fo</textarea>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
@ -25,4 +26,3 @@
|
|||
<textarea id="textarea" minlength="3">f</textarea>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
@ -25,4 +26,3 @@
|
|||
<textarea id="textarea" minlength="3">f</textarea>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=353539
|
|||
</textarea>
|
||||
</p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
@ -38,8 +38,6 @@ addLoadEvent(function() {
|
|||
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");
|
||||
|
|
|
@ -33,7 +33,7 @@ SimpleTest.waitForFocus(function() {
|
|||
|
||||
is(document.activeElement, i, "Should be focused before frame reconstruction");
|
||||
synthesizeKey("1", {});
|
||||
is(i.value, "test1", "Can accept keyboard events before frame reconstruction");
|
||||
is(i.value, "1test", "Can accept keyboard events before frame reconstruction");
|
||||
|
||||
// force frame reconstruction
|
||||
i.style.display = "none";
|
||||
|
@ -43,7 +43,7 @@ SimpleTest.waitForFocus(function() {
|
|||
|
||||
is(document.activeElement, i, "Should be focused after frame reconstruction");
|
||||
synthesizeKey("2", {});
|
||||
is(i.value, "test12", "Can accept keyboard events after frame reconstruction");
|
||||
is(i.value, "12test", "Can accept keyboard events after frame reconstruction");
|
||||
|
||||
// Make sure reframing happens gracefully
|
||||
var reframeDiv = document.getElementById("reframe");
|
||||
|
|
|
@ -12,8 +12,8 @@ abc
|
|||
|
||||
</textarea>
|
||||
|
||||
<div id="coords1">6</div>
|
||||
<div id="coords2">6</div>
|
||||
<div id="coords1">0</div>
|
||||
<div id="coords2">0</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -98,10 +98,6 @@
|
|||
|
||||
let synthesizedKeys = [];
|
||||
let expectations = [];
|
||||
|
||||
let textarea = document.getElementById("textarea");
|
||||
textarea.selectionStart = 0;
|
||||
textarea.selectionEnd = 0;
|
||||
|
||||
// Move to beginning of line
|
||||
synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_LeftArrow,
|
||||
|
|
Загрузка…
Ссылка в новой задаче