зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1474902 - Part 5. Add mochitest. r=masayuki
Reviewers: masayuki Reviewed By: masayuki Bug #: 1474902 Differential Revision: https://phabricator.services.mozilla.com/D24842 --HG-- extra : rebase_source : 043a67433d77cd0e57ff4688d277efb85f48cc5d extra : histedit_source : 359060a3a9283da0faa2c613f90159882abcbc9f
This commit is contained in:
Родитель
49372ed79b
Коммит
a653eaefb2
|
@ -1653,6 +1653,17 @@ nsDOMWindowUtils::GetFocusedInputType(nsAString& aType) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::GetFocusedActionHint(nsAString& aType) {
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
if (!widget) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
aType = widget->GetInputContext().mActionHint;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::GetViewId(Element* aElement, nsViewID* aResult) {
|
||||
if (aElement && nsLayoutUtils::FindIDFor(aElement, aResult)) {
|
||||
|
|
|
@ -1466,6 +1466,11 @@ interface nsIDOMWindowUtils : nsISupports {
|
|||
*/
|
||||
readonly attribute AString focusedInputType;
|
||||
|
||||
/**
|
||||
* Get the action hint of the currently focused html input, if any.
|
||||
*/
|
||||
readonly attribute AString focusedActionHint;
|
||||
|
||||
/**
|
||||
* Find the view ID for a given element. This is the reverse of
|
||||
* findElementWithViewId().
|
||||
|
|
|
@ -3,6 +3,7 @@ support-files = utils.js
|
|||
|
||||
[test_AltGr_key_events_in_web_content_on_windows.html]
|
||||
skip-if = toolkit != 'windows' || headless # headless: Bug 1410525
|
||||
[test_actionhint.html]
|
||||
[test_assign_event_data.html]
|
||||
subsuite = clipboard
|
||||
skip-if = toolkit == "cocoa" || (toolkit == 'android' && debug) || android_version == '24' # Mac: Bug 933303, Android bug 1285414
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Tests for action hint that is used by software keyboard</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SpecialPowers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<div>
|
||||
<form><input type="text" id="a1"><input type="text" id="a2"><input type="submit"></form>
|
||||
<form><input type="search" id="b1"><input type="submit"></form>
|
||||
<form><input type="text" id="c1"></form>
|
||||
<form><input type="text" id="d1"><textarea></textarea><input type="submit"></form>
|
||||
<form><input type="text" id="e1"><input type="number"><input type="submit"></form>
|
||||
<form><input type="text" id="f1"><input type="date"><input type="submit"></form>
|
||||
<form><input type="text" id="g1"><input type="radio"><input type="submit"></form>
|
||||
<form><input type="text" id="h1"><input type="text" readonly><input type="submit"></form>
|
||||
<form><input type="text" id="i1"><input type="text" disabled><input type="submit"></form>
|
||||
<input type="text" id="j1"><input type="text"><input type="button">
|
||||
<form><input type="text" id="k1"><a href="#foo">foo</a><input type="text"><input type="submit"></form>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class=testbody" type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
SimpleTest.waitForFocus(() => {
|
||||
const tests = [
|
||||
{ id: "a1", hint: "next", desc: "next element is type=text" },
|
||||
{ id: "a2", hint: "go", desc: "next element is type=submit" },
|
||||
{ id: "b1", hint: "search", desc: "current is type=search" },
|
||||
{ id: "c1", hint: "go", desc: "only this element" },
|
||||
{ id: "d1", hint: "next", desc: "next element is textarea" },
|
||||
{ id: "e1", hint: "next", desc: "next element is type=number" },
|
||||
{ id: "h1", hint: "go", desc: "next element is readonly" },
|
||||
// XXX Feel free to change this result if you get some bugs reports
|
||||
{ id: "i1", hint: "go", desc: "next element is disabled" },
|
||||
{ id: "j1", hint: "", desc: "no form element" },
|
||||
];
|
||||
|
||||
const todo_tests = [
|
||||
{ id: "f1", hint: "next", desc: "next element is type=date" },
|
||||
{ id: "k1", hint: "", desc: "next is anchor link" },
|
||||
];
|
||||
|
||||
for (let test of tests) {
|
||||
document.getElementById(test.id).focus();
|
||||
is(SpecialPowers.DOMWindowUtils.focusedActionHint, test.hint, test.desc);
|
||||
}
|
||||
|
||||
for (let test of todo_tests) {
|
||||
document.getElementById(test.id).focus();
|
||||
todo_is(SpecialPowers.DOMWindowUtils.focusedActionHint, test.hint, test.desc);
|
||||
}
|
||||
|
||||
SimpleTest.finish();
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче