gecko/content/events/test/test_dom_wheel_event.html

52 lines
1.3 KiB
HTML
Raw Normal View History

<!DOCTYPE HTML>
<html>
<head>
<title>Test for D3E WheelEvent</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(runTests, window);
function testMakingUntrustedEvent()
{
const kCreateEventArgs = [
"WheelEvent", "wheelevent", "wheelEvent", "Wheelevent"
];
for (var i = 0; i < kCreateEventArgs.length; i++) {
try {
// We never support WheelEvent construction with document.createEvent().
var event = document.createEvent(kCreateEventArgs[i]);
ok(false, "document.createEvent(" + kCreateEventArgs[i] + ") should throw an error");
} catch (e) {
ok(true, "document.createEvent(" + kCreateEventArgs[i] + ") threw an error");
}
}
var wheelEvent = new WheelEvent("wheel");
ok(wheelEvent instanceof WheelEvent,
"new WheelEvent() should create an instance of WheelEvent");
ok(typeof(wheelEvent.initWheelEvent) != "function",
"WheelEvent must not have initWheelEvent()");
}
function runTests()
{
testMakingUntrustedEvent();
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>