зеркало из https://github.com/mozilla/gecko-dev.git
Bug 320462 - Send an input event when a value is selected from the autocomple or list dropdown. r=smaug a=sicking
This commit is contained in:
Родитель
ace147b8c4
Коммит
d851c5720d
|
@ -1200,7 +1200,11 @@ nsHTMLInputElement::SetUserInput(const nsAString& aValue)
|
|||
} else {
|
||||
SetValueInternal(aValue, PR_TRUE, PR_TRUE);
|
||||
}
|
||||
return NS_OK;
|
||||
|
||||
return nsContentUtils::DispatchTrustedEvent(GetOwnerDoc(),
|
||||
static_cast<nsIDOMHTMLInputElement*>(this),
|
||||
NS_LITERAL_STRING("input"), PR_TRUE,
|
||||
PR_TRUE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsIEditor*)
|
||||
|
|
|
@ -682,22 +682,39 @@ function runTest(testNum) {
|
|||
doKey("return");
|
||||
checkForm("value");
|
||||
|
||||
if (testNum == 403) {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
if (testNum == 400) {
|
||||
input = $_(9, "field7");
|
||||
} else if (testNum == 401) {
|
||||
input = $_(10, "field8");
|
||||
} else if (testNum == 402) {
|
||||
input = $_(11, "field9");
|
||||
} else if (testNum == 403) {
|
||||
// Go to test 500.
|
||||
fh.addEntry("field1", "value1");
|
||||
input = $_(1, "field1");
|
||||
testNum = 499;
|
||||
}
|
||||
|
||||
restoreForm();
|
||||
doKey("down");
|
||||
break;
|
||||
|
||||
// Check that the input event is fired.
|
||||
case 500:
|
||||
input.addEventListener("input", function(event) {
|
||||
input.removeEventListener("input", arguments.callee, false);
|
||||
ok(true, "oninput should have been received");
|
||||
ok(event.bubbles, "input event should bubble");
|
||||
ok(event.cancelable, "input event should be cancelable");
|
||||
SimpleTest.finish();
|
||||
}, false);
|
||||
|
||||
doKey("down");
|
||||
checkForm("");
|
||||
doKey("return");
|
||||
checkForm("value1");
|
||||
return;
|
||||
|
||||
default:
|
||||
ok(false, "Unexpected invocation of test #" + testNum);
|
||||
SimpleTest.finish();
|
||||
|
|
|
@ -372,10 +372,28 @@ function runTest(testNum) {
|
|||
input.removeAttribute('mozNoFilter');
|
||||
restoreForm();
|
||||
doKey("down");
|
||||
SimpleTest.finish();
|
||||
testNum = 399;
|
||||
setTimeout(runTest, 50, testNum + 1); // XXX 40ms was too slow, why?
|
||||
}, 500);
|
||||
return;
|
||||
break;
|
||||
|
||||
case 400:
|
||||
// Check that the input event is fired.
|
||||
input.addEventListener("input", function(event) {
|
||||
input.removeEventListener("input", arguments.callee, false);
|
||||
ok(true, "oninput should have been received");
|
||||
ok(event.bubbles, "input event should bubble");
|
||||
ok(event.cancelable, "input event should be cancelable");
|
||||
SimpleTest.finish();
|
||||
}, false);
|
||||
|
||||
doKey("down");
|
||||
checkForm("");
|
||||
doKey("return");
|
||||
checkForm("Google");
|
||||
return;
|
||||
|
||||
default:
|
||||
ok(false, "Unexpected invocation of test #" + testNum);
|
||||
SimpleTest.finish();
|
||||
|
|
Загрузка…
Ссылка в новой задаче