gecko/layout/base/tests/test_bug1070851.html
Ting-Yu Lin 1a70440095 Bug 1070851 - Make touch caret respect snapshotWindow(). r=roc
Avoid capture touch caret when the argument 'withCaret' is false in
snapshotWindow().
2014-09-24 01:26:00 -04:00

60 lines
1.7 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1070851
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1070851</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
/* Eliminate the blue glow when focusing an element. */
input, textarea, div {
background: none;
border: none;
outline: none;
}
</style>
<script type="application/javascript">
/** Test for Bug 1070851 **/
SimpleTest.waitForExplicitFinish();
function testSnapshot(aElementId)
{
var noTouchCaret = snapshotWindow(window, true);
// Focus the element to make the touch caret show, but do not capture it.
var element = document.getElementById(aElementId);
element.focus();
var notCaptureTouchCaret = snapshotWindow(window, false);
[result, first, second] = compareSnapshots(noTouchCaret, notCaptureTouchCaret,
true);
ok(result, "Both snapshots of " + aElementId + " should have no touch caret." +
"\nFirst snapshot: " + first + "\nSecond snapshot: " + second);
element.blur();
}
SimpleTest.waitForFocus(function() {
testSnapshot('input');
testSnapshot('textarea');
testSnapshot('content');
SimpleTest.finish();
})
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1070851">Mozilla Bug 1070851</a>
<input id="input">
<textarea id="textarea"></textarea>
<div id="content" contenteditable="true">test</div>
</body>
</html>