Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test that the result of createEvent has its attributes initialized corre... #295

Merged
merged 2 commits into from
Aug 19, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions dom/nodes/Document-createEvent.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,39 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Document.createEvent</title>
<link rel=help href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-document-createevent">
<link rel=help href="http://dom.spec.whatwg.org/#dom-document-createevent">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
// TODO: values of attributes
function testAlias(arg, iface) {
var ev;
test(function() {
if (iface === "Event" || iface in window) {
var ev = document.createEvent(arg);
assert_true(ev instanceof window[iface]);
assert_true(ev instanceof Event);
}
ev = document.createEvent(arg);
assert_true(ev instanceof window[iface]);
assert_true(ev instanceof Event);
}, arg + " should be an alias for " + iface + ".");
test(function() {
assert_equals(ev.type, "",
"type should be initialized to the empty string");
assert_equals(ev.target, null,
"target should be initialized to null");
assert_equals(ev.currentTarget, null,
"currentTarget should be initialized to null");
assert_equals(ev.eventPhase, 0,
"eventPhase should be initialized to NONE (0)");
assert_equals(ev.bubbles, false,
"bubbles should be initialized to false");
assert_equals(ev.cancelable, false,
"cancelable should be initialized to false");
assert_equals(ev.defaultPrevented, false,
"defaultPrevented should be initialized to false");
assert_equals(ev.isTrusted, false,
"isTrusted should be initialized to false");
}, "createEvent('" + arg + "') should be initialized correctly.");
}
[
["CustomEvent", "CustomEvent"],
["Event", "Event"],
["Events", "Event"],
["HTMLEvents", "Event"],
Expand All @@ -38,5 +55,9 @@
// 'LATIN CAPITAL LETTER I WITH DOT ABOVE' (U+0130)
var evt = document.createEvent("U\u0130Event");
});
assert_throws("NOT_SUPPORTED_ERR", function() {
// 'LATIN SMALL LETTER DOTLESS I' (U+0131)
var evt = document.createEvent("U\u0131Event");
});
}, "Should throw NOT_SUPPORTED_ERR for unrecognized arguments");
</script>