Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/Document-createEvent.html

Issue 1529523002: Import dom/ from web-platform-tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweak W3CImportExpectations Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <meta charset=utf-8>
3 <title>Document.createEvent</title>
4 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-createevent">
5 <script src="../../../../resources/testharness.js"></script>
6 <script src="../../../../resources/testharnessreport.js"></script>
7 <script src="Document-createEvent.js"></script>
8 <div id="log"></div>
9 <script>
10 function testAlias(arg, iface) {
11 var ev;
12 test(function() {
13 ev = document.createEvent(arg);
14 assert_true(ev instanceof window[iface]);
15 assert_true(ev instanceof Event);
16 }, arg + " should be an alias for " + iface + ".");
17 test(function() {
18 assert_equals(ev.type, "",
19 "type should be initialized to the empty string");
20 assert_equals(ev.target, null,
21 "target should be initialized to null");
22 assert_equals(ev.currentTarget, null,
23 "currentTarget should be initialized to null");
24 assert_equals(ev.eventPhase, 0,
25 "eventPhase should be initialized to NONE (0)");
26 assert_equals(ev.bubbles, false,
27 "bubbles should be initialized to false");
28 assert_equals(ev.cancelable, false,
29 "cancelable should be initialized to false");
30 assert_equals(ev.defaultPrevented, false,
31 "defaultPrevented should be initialized to false");
32 assert_equals(ev.isTrusted, false,
33 "isTrusted should be initialized to false");
34 }, "createEvent('" + arg + "') should be initialized correctly.");
35 }
36 aliases.forEach(function(alias) {
37 testAlias(alias[0], alias[1]);
38 testAlias(alias[0].toLowerCase(), alias[1]);
39 testAlias(alias[0].toUpperCase(), alias[1]);
40 });
41
42 test(function() {
43 assert_throws("NOT_SUPPORTED_ERR", function() {
44 var evt = document.createEvent("foo");
45 });
46 assert_throws("NOT_SUPPORTED_ERR", function() {
47 // 'LATIN CAPITAL LETTER I WITH DOT ABOVE' (U+0130)
48 var evt = document.createEvent("U\u0130Event");
49 });
50 assert_throws("NOT_SUPPORTED_ERR", function() {
51 // 'LATIN SMALL LETTER DOTLESS I' (U+0131)
52 var evt = document.createEvent("U\u0131Event");
53 });
54 }, "Should throw NOT_SUPPORTED_ERR for unrecognized arguments");
55 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698