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

Side by Side Diff: LayoutTests/fast/events/constructors/related-event-constructor.html

Issue 443053002: Add support for RelatedEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Done Created 6 years, 4 months 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
« no previous file with comments | « no previous file | LayoutTests/fast/events/constructors/related-event-constructor-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script>
8
9 description("This tests the constructor for the RelatedEvent DOM class.");
10
11 var testObject = {nyannyan: 123};
12 var testDiv = document.createElement("div");
13
14 // No initializer is passed.
15 shouldBeFalse("new RelatedEvent('eventType').bubbles");
16 shouldBeFalse("new RelatedEvent('eventType').cancelable");
17 shouldBeNull("new RelatedEvent('eventType').relatedTarget");
18
19 // bubbles is passed.
20 shouldBeFalse("new RelatedEvent('eventType', { bubbles: false }).bubbles");
21 shouldBeTrue("new RelatedEvent('eventType', { bubbles: true }).bubbles");
22
23 // cancelable is passed.
24 shouldBeFalse("new RelatedEvent('eventType', { cancelable: false }).cancelable") ;
25 shouldBeTrue("new RelatedEvent('eventType', { cancelable: true }).cancelable");
26
27 // relatedTarget is passed.
28 // Valid objects.
29 shouldBe("new RelatedEvent('eventType', { relatedTarget: testDiv }).relatedTarge t", "testDiv");
30 shouldBe("new RelatedEvent('eventType', { relatedTarget: document }).relatedTarg et", "document");
31 shouldBe("new RelatedEvent('eventType', { relatedTarget: window }).relatedTarget ", "window");
32
33 // Invalid objects.
34 shouldThrow("new RelatedEvent('eventType', { relatedTarget: testObject }).relate dTarget");
35 shouldBeNull("new RelatedEvent('eventType', { relatedTarget: undefined }).relate dTarget", "null");
36 shouldBeNull("new RelatedEvent('eventType', { relatedTarget: null }).relatedTarg et", "null");
37 shouldThrow("new RelatedEvent('eventType', { relatedTarget: false }).relatedTarg et");
38 shouldThrow("new RelatedEvent('eventType', { relatedTarget: true }).relatedTarge t");
39 shouldThrow("new RelatedEvent('eventType', { relatedTarget: '' }).relatedTarget" );
40 shouldThrow("new RelatedEvent('eventType', { relatedTarget: 'chocolate' }).relat edTarget");
41 shouldThrow("new RelatedEvent('eventType', { relatedTarget: 12345 }).relatedTarg et");
42 shouldThrow("new RelatedEvent('eventType', { relatedTarget: 18446744073709551615 }).relatedTarget");
43 shouldThrow("new RelatedEvent('eventType', { relatedTarget: NaN }).relatedTarget ");
44 // Note that valueOf() is not called, when the left hand side is evaluated.
45 shouldThrow("new RelatedEvent('eventType', { relatedTarget: {valueOf: function ( ) { return testDiv; } } }).relatedTarget == testDiv");
46 shouldBeTrue("new RelatedEvent('eventType', { get relatedTarget() { return testD iv; } }).relatedTarget == testDiv");
47 shouldThrow("new RelatedEvent('eventType', { get relatedTarget() { return 123; } }).relatedTarget");
48 shouldThrow("new RelatedEvent('eventType', { get relatedTarget() { throw 'Relate dEvent Error'; } })");
49
50 // All initializers are passed.
51 shouldBeTrue("new RelatedEvent('eventType', { bubbles: true, cancelable: true, r elatedTarget: testDiv }).bubbles", "true");
52 shouldBeTrue("new RelatedEvent('eventType', { bubbles: true, cancelable: true, r elatedTarget: testDiv }).cancelable", "true");
53 shouldBe("new RelatedEvent('eventType', { bubbles: true, cancelable: true, relat edTarget: testDiv }).relatedTarget", "testDiv");
54 </script>
55 </body>
56 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/events/constructors/related-event-constructor-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698