Bug 661293 - add mochitest for content alert() relations, r=marcoz

This commit is contained in:
Alexander Surkov 2012-03-13 13:01:26 -04:00
parent fa72c6374d
commit 50ebc05cd6
2 changed files with 96 additions and 0 deletions

View File

@ -52,6 +52,7 @@ _TEST_FILES =\
test_general.xul \
test_tabbrowser.xul \
test_tree.xul \
test_ui_modalprompt.html \
test_update.html \
$(NULL)

View File

@ -0,0 +1,95 @@
<html>
<head>
<title>Modal prompts</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../relations.js"></script>
<script type="application/javascript"
src="../role.js"></script>
<script type="application/javascript"
src="../events.js"></script>
<script type="application/javascript"
src="../browser.js"></script>
<script type="application/javascript">
function showAlert()
{
this.eventSeq = [
{
type: EVENT_SHOW,
match: function(aEvent)
{
return aEvent.accessible.role == ROLE_DIALOG;
}
}
];
this.invoke = function showAlert_invoke()
{
window.setTimeout(
function()
{
currentTabDocument().defaultView.alert("hello");
}, 0);
}
this.check = function showAlert_finalCheck(aEvent)
{
var dialog = aEvent.accessible.DOMNode;
var info = dialog.ui.infoBody;
testRelation(info, RELATION_DESCRIPTION_FOR, dialog);
testRelation(dialog, RELATION_DESCRIBED_BY, info);
}
this.getID = function showAlert_getID()
{
return "show alert";
}
}
//gA11yEventDumpToConsole = true; // debug
var gQueue = null;
function doTests()
{
gQueue = new eventQueue();
gQueue.push(new showAlert());
gQueue.onFinish = function()
{
synthesizeKey("VK_RETURN", {}, browserWindow());
closeBrowserWindow();
}
gQueue.invoke(); // will call SimpleTest.finish()
}
SimpleTest.waitForExplicitFinish();
openBrowserWindow(doTests);
</script>
</head>
<body id="body">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=661293"
title="The tabmodalprompt dialog's prompt label doesn't get the text properly associated for accessibility">
Mozilla Bug 661293
</a>
<br>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
</body>
</html>