Bug 1248128 - Test for spurious propagation of failed selection-move command to the root, causing unwanted scrolling. r=roc

This commit is contained in:
Jonathan Kew 2016-02-17 12:05:10 +00:00
Родитель ed3d3edf14
Коммит 53139fc8bb
2 изменённых файлов: 53 добавлений и 0 удалений

Просмотреть файл

@ -28,6 +28,7 @@ skip-if = buildapp == 'mulet'
[test_bug1140617.xul]
[test_bug1153237.html]
[test_bug1154791.html]
[test_bug1248128.html]
[test_composition_event_created_in_chrome.html]
[test_contenteditable_text_input_handling.html]
[test_dragdrop.html]

Просмотреть файл

@ -0,0 +1,52 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1248128
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1248128</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
var outer = document.querySelector("html");
ok(outer.scrollTop == 0, "scrollTop is zero: got " + outer.scrollTop);
var input = document.getElementById("testInput");
input.focus();
var scroll = outer.scrollTop;
ok(scroll > 0, "element has scrolled: new value " + scroll);
const kMoveLeft = "cmd_moveLeft";
var controller =
top.document.commandDispatcher.getControllerForCommand(kMoveLeft);
ok((controller && controller.isCommandEnabled(kMoveLeft)),
"have " + kMoveLeft + " command");
try {
controller.doCommand(kMoveLeft);
ok(false, "should not be able to do kMoveLeft");
}
catch (e) {
ok(true, "unable to perform kMoveLeft");
}
ok(outer.scrollTop == scroll,
"scroll is unchanged: got " + outer.scrollTop + ", expected " + scroll);
SimpleTest.finish();
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1248128">Mozilla Bug 1248128</a>
<div style="height: 2000px;"></div>
<input type="text" id="testInput"></input>
<div style="height: 200px;"></div>
</body>
</html>