OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Custom Elements: Create an element when definition is non-null and synchr onous flag not set</title> | 2 <title>Custom Elements: Create an element when definition is non-null and synchr onous flag not set</title> |
3 <script src="../../resources/testharness.js"></script> | 3 <script src="../../resources/testharness.js"></script> |
4 <script src="../../resources/testharnessreport.js"></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
5 <script src="resources/custom-elements-helpers.js"></script> | 5 <script src="resources/custom-elements-helpers.js"></script> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 'use strict'; | 8 'use strict'; |
9 | 9 |
10 (() => { | 10 (() => { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 element.setAttribute('y', '2'); | 84 element.setAttribute('y', '2'); |
85 element.setAttribute('x', '9'); | 85 element.setAttribute('x', '9'); |
86 assert_log_is_type(logs, 0, attributeChanged, element, ['y', null, '2', '']) ; | 86 assert_log_is_type(logs, 0, attributeChanged, element, ['y', null, '2', '']) ; |
87 assert_log_is_type(logs, 1, attributeChanged, element, ['x', '1', '9', '']); | 87 assert_log_is_type(logs, 1, attributeChanged, element, ['x', '1', '9', '']); |
88 assert_equals(logs.length, 2); | 88 assert_equals(logs.length, 2); |
89 }, 'setAttribute should enqueue attributeChangedCallback'); | 89 }, 'setAttribute should enqueue attributeChangedCallback'); |
90 | 90 |
91 test_with_window(w => { | 91 test_with_window(w => { |
92 let document = w.document; | 92 let document = w.document; |
93 let element = document.createElement('a-a'); | 93 let element = document.createElement('a-a'); |
94 document.body.appendChild(element); | |
95 let logs = define_logger(w, ['style']); | |
96 | |
97 logs.length = 0; | |
98 element.style.color = 'red'; | |
99 assert_equals(logs.length, 1); | |
100 assert_log_is_type(logs, 0, attributeChanged, element, ['style', null, 'colo r: red;', '']); | |
101 | |
102 logs.length = 0; | |
103 element.style.color = 'green'; | |
104 assert_equals(logs.length, 1); | |
105 assert_log_is_type(logs, 0, attributeChanged, element, ['style', 'color: red ;', 'color: green;', '']); | |
106 | |
107 logs.length = 0; | |
108 element.style.color = ''; | |
109 assert_equals(logs.length, 1); | |
110 assert_log_is_type(logs, 0, attributeChanged, element, ['style', 'color: gre en;', null, '']); | |
111 }, 'style.color should enqueue attributeChangedCallback for style attribute'); | |
112 | |
113 test_with_window(w => { | |
114 let document = w.document; | |
115 let element = document.createElement('a-a'); | |
116 document.body.appendChild(element); | |
117 let logs = define_logger(w, ['style']); | |
118 | |
119 logs.length = 0; | |
120 element.style.cssText = 'color: red'; | |
dominicc (has gone to gerrit)
2016/07/22 01:14:01
Please add cssFloat tests.
| |
121 assert_equals(logs.length, 1); | |
122 assert_log_is_type(logs, 0, attributeChanged, element, ['style', null, 'colo r: red;', '']); | |
123 }, 'style.cssText should enqueue attributeChangedCallback for style attribute' ); | |
124 | |
125 test_with_window(w => { | |
126 let document = w.document; | |
127 let element = document.createElement('a-a'); | |
128 document.body.appendChild(element); | |
129 let logs = define_logger(w, ['style']); | |
130 | |
131 logs.length = 0; | |
132 element.style.setProperty('color', 'red'); | |
133 assert_equals(logs.length, 1); | |
134 assert_log_is_type(logs, 0, attributeChanged, element, ['style', null, 'colo r: red;', '']); | |
135 | |
136 logs.length = 0; | |
137 element.style.removeProperty('color', 'red'); | |
138 assert_equals(logs.length, 1); | |
139 assert_log_is_type(logs, 0, attributeChanged, element, ['style', 'color: red ;', null, '']); | |
140 }, 'style.color should enqueue attributeChangedCallback for style attribute'); | |
dominicc (has gone to gerrit)
2016/07/22 01:14:01
This is really testing setProperty, removeProperty
| |
141 | |
142 test_with_window(w => { | |
143 let document = w.document; | |
144 let element = document.createElement('a-a'); | |
145 document.body.appendChild(element); | |
146 let logs = define_logger(w, ['lang']); | |
147 | |
148 logs.length = 0; | |
149 element.lang = 'ja-jp'; | |
150 assert_equals(logs.length, 1); | |
151 assert_log_is_type(logs, 0, attributeChanged, element, ['lang', null, 'ja-jp ', '']); | |
152 }, 'lang property setter should enqueue attributeChangedCallback for lang attr ibute'); | |
153 | |
154 test_with_window(w => { | |
155 let document = w.document; | |
156 let element = document.createElement('a-a'); | |
94 element.setAttribute('x', '1'); | 157 element.setAttribute('x', '1'); |
95 document.body.appendChild(element); | 158 document.body.appendChild(element); |
96 let logs = define_logger(w, ['x']); | 159 let logs = define_logger(w, ['x']); |
97 | 160 |
98 logs.length = 0; | 161 logs.length = 0; |
99 element.removeAttribute('x'); | 162 element.removeAttribute('x'); |
100 assert_log_is_type(logs, 0, attributeChanged, element, ['x', '1', null, '']) ; | 163 assert_log_is_type(logs, 0, attributeChanged, element, ['x', '1', null, '']) ; |
101 assert_equals(logs.length, 1); | 164 assert_equals(logs.length, 1); |
102 }, 'removeAttribute should enqueue attributeChangedCallback'); | 165 }, 'removeAttribute should enqueue attributeChangedCallback'); |
103 | 166 |
104 test_with_window(w => { | 167 test_with_window(w => { |
105 let document = w.document; | 168 let document = w.document; |
106 let element = document.createElement('a-a'); | 169 let element = document.createElement('a-a'); |
107 document.body.appendChild(element); | 170 document.body.appendChild(element); |
108 let logs = define_logger(w); | 171 let logs = define_logger(w); |
109 | 172 |
110 logs.length = 0; | 173 logs.length = 0; |
111 element.remove(); | 174 element.remove(); |
112 assert_log_is_type(logs, 0, disconnected, element); | 175 assert_log_is_type(logs, 0, disconnected, element); |
113 assert_equals(logs.length, 1); | 176 assert_equals(logs.length, 1); |
114 }, 'remove should enqueue disconnectedCallback'); | 177 }, 'remove should enqueue disconnectedCallback'); |
115 })(); | 178 })(); |
116 </script> | 179 </script> |
117 </body> | 180 </body> |
OLD | NEW |