mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 611182 - Backspace key does not work without typing something first (test cases); r=bzbarsky a=blocking-beta8+
This commit is contained in:
parent
ae907fe71a
commit
81e5001ae0
@ -67,6 +67,7 @@ _TEST_FILES = \
|
||||
test_bug597784.html \
|
||||
test_bug599322.html \
|
||||
test_bug607584.html \
|
||||
test_bug611182.html \
|
||||
test_CF_HTML_clipboard.html \
|
||||
test_contenteditable_focus.html \
|
||||
test_contenteditable_text_input_handling.html \
|
||||
|
100
editor/libeditor/html/tests/test_bug611182.html
Normal file
100
editor/libeditor/html/tests/test_bug611182.html
Normal file
@ -0,0 +1,100 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=611182
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 611182</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=611182">Mozilla Bug 611182</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<iframe></iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 611182 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(function() {
|
||||
var iframe = document.querySelector("iframe");
|
||||
|
||||
function findTextNode(doc) {
|
||||
var body = doc.body;
|
||||
var result = findTextNodeWorker(body);
|
||||
ok(result, "Failed to find the text node");
|
||||
return result;
|
||||
}
|
||||
|
||||
function findTextNodeWorker(root) {
|
||||
for (var i = 0; i < root.childNodes.length; ++i) {
|
||||
var node = root.childNodes[i];
|
||||
if (node.nodeType == node.TEXT_NODE &&
|
||||
node.nodeValue == "fooz bar") {
|
||||
root.focus();
|
||||
return node;
|
||||
}
|
||||
if (node.nodeType == node.ELEMENT_NODE) {
|
||||
node = findTextNodeWorker(node);
|
||||
if (node) {
|
||||
root.focus();
|
||||
return node;
|
||||
}
|
||||
}
|
||||
}
|
||||
ok(false, "Failed to find the text node");
|
||||
return null;
|
||||
}
|
||||
|
||||
function testBackspace(src, callback) {
|
||||
iframe.addEventListener("load", function() {
|
||||
iframe.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
var doc = iframe.contentDocument;
|
||||
var win = iframe.contentWindow;
|
||||
iframe.focus();
|
||||
var textNode = findTextNode(doc);
|
||||
var sel = win.getSelection();
|
||||
sel.collapse(textNode, 4);
|
||||
synthesizeKey("VK_BACK_SPACE", {});
|
||||
is(textNode.textContent, "foo bar", "Backspace should work correctly");
|
||||
|
||||
// TODO: compare screenshots to make sure that no bogus node exists in the document
|
||||
|
||||
callback();
|
||||
}, false);
|
||||
iframe.src = src;
|
||||
}
|
||||
|
||||
const TEST_URIS = [
|
||||
"data:text/html,<html contenteditable>fooz bar</html>",
|
||||
"data:text/html,<html contenteditable><body>fooz bar</body></html>",
|
||||
"data:text/html,<body contenteditable>fooz bar</body>",
|
||||
"data:text/html,<body contenteditable><p>fooz bar</p></body>",
|
||||
"data:text/html,<body contenteditable><div>fooz bar</div></body>",
|
||||
"data:text/html,<body contenteditable><span>fooz bar</span></body>",
|
||||
"data:text/html,<p contenteditable>fooz bar</p>",
|
||||
"data:text/html,<!DOCTYPE html><html><body contenteditable>fooz bar</body></html>",
|
||||
'data:application/xhtml+xml,<html xmlns="http://www.w3.org/1999/xhtml"><body contenteditable="true">fooz bar</body></html>',
|
||||
"data:text/html,<body onload=\"document.designMode='on'\">fooz bar</body>",
|
||||
];
|
||||
var currentTest = 0;
|
||||
function runAllTests() {
|
||||
if (currentTest == TEST_URIS.length) {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
testBackspace(TEST_URIS[currentTest++], runAllTests);
|
||||
}
|
||||
runAllTests();
|
||||
});
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
6
layout/reftests/editor/nobogusnode-1.html
Normal file
6
layout/reftests/editor/nobogusnode-1.html
Normal file
@ -0,0 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body contenteditable>
|
||||
This is a test.
|
||||
</body>
|
||||
</html>
|
5
layout/reftests/editor/nobogusnode-2.html
Normal file
5
layout/reftests/editor/nobogusnode-2.html
Normal file
@ -0,0 +1,5 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body contenteditable="true">
|
||||
This is a test.
|
||||
</body>
|
||||
</html>
|
6
layout/reftests/editor/nobogusnode-ref.html
Normal file
6
layout/reftests/editor/nobogusnode-ref.html
Normal file
@ -0,0 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
This is a test.
|
||||
</body>
|
||||
</html>
|
@ -23,3 +23,5 @@ asserts(1) == passwd-4.html passwd-ref.html # bug 596901
|
||||
== input-text-onfocus-reframe.html input-text-onfocus-reframe-ref.html
|
||||
== input-text-notheme-onfocus-reframe.html input-text-notheme-onfocus-reframe-ref.html
|
||||
== caret_after_reframe.html caret_after_reframe-ref.html
|
||||
== nobogusnode-1.html nobogusnode-ref.html
|
||||
== nobogusnode-2.html nobogusnode-ref.html
|
||||
|
Loading…
Reference in New Issue
Block a user