2012-09-15 00:00:21 +04:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Test for Layout of Form History Autocomplete: Bug 787624</title>
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
2018-01-30 16:05:44 +03:00
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
2016-03-11 18:42:01 +03:00
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
|
2012-09-15 00:00:21 +04:00
|
|
|
<script type="text/javascript" src="satchel_common.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
<style>
|
|
|
|
.container {
|
|
|
|
border: 1px solid #333;
|
|
|
|
width: 80px;
|
|
|
|
height: 26px;
|
|
|
|
position: absolute;
|
|
|
|
z-index: 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
.subcontainer {
|
|
|
|
width: 100%;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
.subcontainer input {
|
|
|
|
width: 120px;
|
|
|
|
margin: 2px 6px;
|
|
|
|
padding-right: 4px;
|
|
|
|
border: none;
|
|
|
|
height: 22px;
|
|
|
|
z-index: 1;
|
|
|
|
outline: 1px dashed #555
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
Form History Layout test: form field autocomplete: Bug 787624
|
|
|
|
<p id="display"></p>
|
|
|
|
|
|
|
|
<!-- we presumably can't hide the content for this test. -->
|
2016-03-11 18:42:01 +03:00
|
|
|
<div id="content">
|
|
|
|
<!-- in this form, the input field is partially hidden and can scroll -->
|
2012-09-15 00:00:21 +04:00
|
|
|
<div class="container">
|
|
|
|
<div class="subcontainer">
|
|
|
|
<form id="form1" onsubmit="return false;">
|
|
|
|
<input type="text" name="field1">
|
|
|
|
<button type="submit">Submit</button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
2016-12-23 19:00:46 +03:00
|
|
|
/* import-globals-from satchel_common.js */
|
2012-09-15 00:00:21 +04:00
|
|
|
|
|
|
|
/** Test for Form History autocomplete Layout: Bug 787624 **/
|
|
|
|
|
2016-03-11 18:42:01 +03:00
|
|
|
var resolvePopupShownListener;
|
|
|
|
registerPopupShownListener(() => resolvePopupShownListener());
|
|
|
|
|
|
|
|
function waitForNextPopup() {
|
|
|
|
return new Promise(resolve => { resolvePopupShownListener = resolve; });
|
|
|
|
}
|
2012-09-15 00:00:21 +04:00
|
|
|
|
2017-05-12 15:42:39 +03:00
|
|
|
add_task(async function test_popup_not_move_input() {
|
2017-06-15 03:30:32 +03:00
|
|
|
let input = $_(1, "field1");
|
|
|
|
let rect = input.getBoundingClientRect();
|
2012-09-15 00:00:21 +04:00
|
|
|
|
2017-05-12 15:42:39 +03:00
|
|
|
await new Promise(resolve => updateFormHistory([
|
2017-03-21 21:29:43 +03:00
|
|
|
{ op: "remove" },
|
|
|
|
{ op: "add", fieldname: "field1", value: "value1" },
|
|
|
|
{ op: "add", fieldname: "field1", value: "value2" },
|
2016-03-11 18:42:01 +03:00
|
|
|
], resolve));
|
2012-09-15 00:00:21 +04:00
|
|
|
|
2016-03-11 18:42:01 +03:00
|
|
|
let popupShown = waitForNextPopup();
|
|
|
|
input.focus();
|
2018-02-09 13:17:26 +03:00
|
|
|
synthesizeKey("KEY_ArrowDown", {});
|
2017-05-12 15:42:39 +03:00
|
|
|
await popupShown;
|
2012-09-15 00:00:21 +04:00
|
|
|
|
2017-06-15 03:30:32 +03:00
|
|
|
let newRect = input.getBoundingClientRect();
|
2016-03-11 18:42:01 +03:00
|
|
|
is(newRect.left, rect.left,
|
2017-06-13 01:45:00 +03:00
|
|
|
"autocomplete popup does not disturb the input position");
|
2016-03-11 18:42:01 +03:00
|
|
|
is(newRect.top, rect.top,
|
2017-06-13 01:45:00 +03:00
|
|
|
"autocomplete popup does not disturb the input position");
|
2016-03-11 18:42:01 +03:00
|
|
|
});
|
2012-09-15 00:00:21 +04:00
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|