Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="../../resources/testharness.js"></script> | |
| 3 <script src="../../resources/testharnessreport.js"></script> | |
| 4 <link id="import1" rel="import" href="resources/attribute-upgrade.html"> | |
| 5 <script> | |
| 6 'use strict'; | |
| 7 | |
| 8 let reactions = []; | |
| 9 | |
| 10 customElements.define('a-a', class extends HTMLElement { | |
| 11 static get observedAttributes() { return ['attr']; } | |
| 12 attributeChangedCallback() { | |
| 13 reactions.push(this); | |
| 14 } | |
| 15 }); | |
| 16 </script> | |
| 17 <link id="import2" rel="import" href="resources/attribute-parsercreate.html"> | |
| 18 <script> | |
| 19 'use strict'; | |
| 20 | |
| 21 test(() => { | |
| 22 let importDoc1 = import1.import; | |
| 23 let importDoc2 = import2.import; | |
| 24 | |
| 25 let a = importDoc1.querySelector('#a'); | |
| 26 let b = importDoc1.querySelector('#b'); | |
| 27 let c = importDoc2.querySelector('#c'); | |
| 28 let d = importDoc2.querySelector('#d'); | |
| 29 | |
| 30 assert_array_equals(reactions, [b, d], | |
| 31 'attributeChangedCallback should have called for both upgr ade and create.'); | |
|
dominicc (has gone to gerrit)
2016/09/02 01:01:55
grammar: have called -> have been called (have cal
kochi
2016/09/02 02:59:15
Done.
| |
| 32 | |
| 33 a.setAttribute('attr', 'a'); | |
| 34 b.setAttribute('attr', 'b'); | |
| 35 c.setAttribute('attr', 'c'); | |
| 36 d.setAttribute('attr', 'd'); | |
| 37 | |
| 38 assert_array_equals(reactions, [b, d, a, b, c, d], | |
| 39 'attributeChangedCallback should have called for setAttrib ute().'); | |
| 40 | |
| 41 d.removeAttribute('attr', 'd'); | |
| 42 c.removeAttribute('attr', 'c'); | |
| 43 b.removeAttribute('attr', 'b'); | |
| 44 a.removeAttribute('attr', 'a'); | |
| 45 | |
| 46 assert_array_equals(reactions, [b, d, a, b, c, d, d, c, b, a], | |
|
dominicc (has gone to gerrit)
2016/09/02 01:01:55
This list is getting long. What do you think about
kochi
2016/09/02 02:59:15
That makes sense.
Done.
| |
| 47 'attributeChangedCallback should have called for removeAtt ribute().'); | |
| 48 }, 'attributeChangedCallback should be invoked for elements in import'); | |
| 49 </script> | |
| OLD | NEW |