OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/testharness.js"></script> | 2 <script src="../../../resources/testharness.js"></script> |
3 <script src="../../../resources/testharnessreport.js"></script> | 3 <script src="../../../resources/testharnessreport.js"></script> |
4 <script src="test-harness-utils.js"></script> | 4 <script src="test-harness-utils.js"></script> |
5 <body> | 5 <body> |
6 <script> | 6 <script> |
7 function TestRegistrationContextSharing(window, documentA, documentB) { | 7 function TestRegistrationContextSharing(window, documentA, documentB) { |
8 this.window = window; | 8 this.window = window; |
9 this.documentA = documentA; | 9 this.documentA = documentA; |
10 this.documentB = documentB; | 10 this.documentB = documentB; |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 var invocations = []; | 27 var invocations = []; |
28 function created() { | 28 function created() { |
29 invocations.push('created ' + this.dataset.name + ' with prototype ' + | 29 invocations.push('created ' + this.dataset.name + ' with prototype ' + |
30 'tagged ' + this.prototypeTag); | 30 'tagged ' + this.prototypeTag); |
31 } | 31 } |
32 | 32 |
33 var protoU = Object.create(this.window.HTMLElement.prototype); | 33 var protoU = Object.create(this.window.HTMLElement.prototype); |
34 protoU.prototypeTag = 'U'; | 34 protoU.prototypeTag = 'U'; |
35 protoU.createdCallback = created; | 35 protoU.createdCallback = created; |
36 this.documentB.register('x-u', {prototype: protoU}); | 36 this.documentB.registerElement('x-u', {prototype: protoU}); |
37 | 37 |
38 assert_array_equals( | 38 assert_array_equals( |
39 invocations, | 39 invocations, |
40 ['created document A upgrade candidate with prototype tagged U', | 40 ['created document A upgrade candidate with prototype tagged U', |
41 'created document B upgrade candidate with prototype tagged U'], | 41 'created document B upgrade candidate with prototype tagged U'], |
42 'the created callback should have been called for both elements ' + | 42 'the created callback should have been called for both elements ' + |
43 'in creation order'); | 43 'in creation order'); |
44 }; | 44 }; |
45 | 45 |
46 TestRegistrationContextSharing.prototype. | 46 TestRegistrationContextSharing.prototype. |
47 testRegisterInAInstantiateInB_shouldActivateDefinition = function () { | 47 testRegisterInAInstantiateInB_shouldActivateDefinition = function () { |
48 var invocations = []; | 48 var invocations = []; |
49 function created() { | 49 function created() { |
50 invocations.push('created ' + this.dataset.name + ' with prototype ' + | 50 invocations.push('created ' + this.dataset.name + ' with prototype ' + |
51 'tagged ' + this.prototypeTag); | 51 'tagged ' + this.prototypeTag); |
52 } | 52 } |
53 | 53 |
54 var protoV = Object.create(this.window.HTMLElement.prototype); | 54 var protoV = Object.create(this.window.HTMLElement.prototype); |
55 protoV.prototypeTag = 'V'; | 55 protoV.prototypeTag = 'V'; |
56 protoV.createdCallback = created; | 56 protoV.createdCallback = created; |
57 this.documentA.register('x-v', {prototype: protoV}); | 57 this.documentA.registerElement('x-v', {prototype: protoV}); |
58 | 58 |
59 var div = this.documentB.createElement('div'); | 59 var div = this.documentB.createElement('div'); |
60 div.innerHTML = '<x-v data-name="document B element V"></x-v>'; | 60 div.innerHTML = '<x-v data-name="document B element V"></x-v>'; |
61 assert_array_equals( | 61 assert_array_equals( |
62 invocations, | 62 invocations, |
63 ['created document B element V with prototype tagged V'], | 63 ['created document B element V with prototype tagged V'], |
64 'the created callback should have been called for the x-v element'); | 64 'the created callback should have been called for the x-v element'); |
65 }; | 65 }; |
66 | 66 |
67 (function () { | 67 (function () { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 tester.testRegistrationContextIsShared(); | 136 tester.testRegistrationContextIsShared(); |
137 t.done(); | 137 t.done(); |
138 }); | 138 }); |
139 | 139 |
140 documentA.head.appendChild(link); | 140 documentA.head.appendChild(link); |
141 }); | 141 }); |
142 | 142 |
143 })(); | 143 })(); |
144 | 144 |
145 </script> | 145 </script> |
OLD | NEW |