OLD | NEW |
1 | 1 |
2 let testNumber = 1; | 2 let testNumber = 1; |
3 | 3 |
4 function testNodeConnector(testFunction, name) { | 4 function testNodeConnector(testFunction, name) { |
5 let container = document.createElement('div'); | 5 let container = document.createElement('div'); |
6 container.appendChild(document.createElement('div')); | 6 container.appendChild(document.createElement('div')); |
7 document.body.appendChild(container); | 7 document.body.appendChild(container); |
8 | 8 |
9 test(function () { | 9 test(function () { |
10 var element = define_new_custom_element(); | 10 var element = define_new_custom_element(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 }, name + ' must enqueue a attributeChanged reaction for a newly constructed
custom element'); | 66 }, name + ' must enqueue a attributeChanged reaction for a newly constructed
custom element'); |
67 | 67 |
68 container.parentNode.removeChild(container); | 68 container.parentNode.removeChild(container); |
69 } | 69 } |
70 | 70 |
71 function testParsingMarkup(testFunction, name) { | 71 function testParsingMarkup(testFunction, name) { |
72 test(function () { | 72 test(function () { |
73 var element = define_new_custom_element(['id']); | 73 var element = define_new_custom_element(['id']); |
74 assert_array_equals(element.takeLog().types(), []); | 74 assert_array_equals(element.takeLog().types(), []); |
75 var instance = testFunction(document, `<${element.name} id="hello" class
="foo"></${element.name}>`); | 75 var instance = testFunction(document, `<${element.name} id="hello" class
="foo"></${element.name}>`); |
76 assert_equals(Object.getPrototypeOf(instance.querySelector(element.name)
), element.class); | 76 assert_equals(Object.getPrototypeOf(instance.querySelector(element.name)
), element.class.prototype); |
77 var logEntries = element.takeLog(); | 77 var logEntries = element.takeLog(); |
78 assert_array_equals(logEntries.types(), ['constructed', 'attributeChange
d']); | 78 assert_array_equals(logEntries.types(), ['constructed', 'attributeChange
d']); |
79 assert_attribute_log_entry(logEntries[1], {name: 'id', oldValue: null, n
ewValue: 'hello', namespace: null}); | 79 assert_attribute_log_entry(logEntries[1], {name: 'id', oldValue: null, n
ewValue: 'hello', namespace: null}); |
80 }, name + ' must construct a custom element'); | 80 }, name + ' must construct a custom element'); |
81 } | 81 } |
82 | 82 |
83 function testCloner(testFunction, name) { | 83 function testCloner(testFunction, name) { |
84 let container = document.createElement('div'); | 84 let container = document.createElement('div'); |
85 container.appendChild(document.createElement('div')); | 85 container.appendChild(document.createElement('div')); |
86 document.body.appendChild(container); | 86 document.body.appendChild(container); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 253 |
254 test(function () { | 254 test(function () { |
255 var element = define_new_custom_element([]); | 255 var element = define_new_custom_element([]); |
256 var instance = document.createElement(element.name); | 256 var instance = document.createElement(element.name); |
257 instance.setAttribute('data-lang', 'ja'); | 257 instance.setAttribute('data-lang', 'ja'); |
258 assert_array_equals(element.takeLog().types(), ['constructed']); | 258 assert_array_equals(element.takeLog().types(), ['constructed']); |
259 testFunction(instance, 'data-lang'); | 259 testFunction(instance, 'data-lang'); |
260 assert_array_equals(element.takeLog().types(), []); | 260 assert_array_equals(element.takeLog().types(), []); |
261 }, name + ' must not enqueue an attributeChanged reaction when removing an e
xisting unobserved attribute'); | 261 }, name + ' must not enqueue an attributeChanged reaction when removing an e
xisting unobserved attribute'); |
262 } | 262 } |
OLD | NEW |