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 <body> | 4 <body> |
5 <script> | 5 <script> |
6 test(function () { | 6 test(function () { |
7 var attributeChangedInvocations = 0; | 7 var attributeChangedInvocations = 0; |
8 function attributeChanged(_, _, _) { | 8 function attributeChanged(_, _, _) { |
9 attributeChangedInvocations++; | 9 attributeChangedInvocations++; |
10 } | 10 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 assert_array_equals(invocations, ['class: null => u'], 'adding a class attri
bute through classList should invoke the attributeChangedCallback'); | 64 assert_array_equals(invocations, ['class: null => u'], 'adding a class attri
bute through classList should invoke the attributeChangedCallback'); |
65 | 65 |
66 b.setAttribute('data-v', 'w'); | 66 b.setAttribute('data-v', 'w'); |
67 invocations = []; | 67 invocations = []; |
68 b.setAttribute('data-v', 'x'); | 68 b.setAttribute('data-v', 'x'); |
69 assert_array_equals(invocations, ['data-v: w => x'], 'changing an attribute
with setAttribute should invoke the attributeChangedCallback'); | 69 assert_array_equals(invocations, ['data-v: w => x'], 'changing an attribute
with setAttribute should invoke the attributeChangedCallback'); |
70 | 70 |
71 invocations = []; | 71 invocations = []; |
72 b.setAttribute('data-v', 'x'); | 72 b.setAttribute('data-v', 'x'); |
73 assert_array_equals(invocations, [], 'setting an attribute to the existing v
alue with setAttribute should not invoke the attributeChangedCallback'); | 73 assert_array_equals(invocations, [], 'setting an attribute to the existing v
alue with setAttribute should not invoke the attributeChangedCallback'); |
| 74 |
| 75 invocations = []; |
| 76 b.style.color = 'red'; |
| 77 assert_array_equals(invocations, ['style: null => color: red;'], 'changing a
n attribute with the styles object\'s named setter should invoke the attributeCh
angedCallback'); |
| 78 |
| 79 invocations = []; |
| 80 b.style.color = ''; |
| 81 assert_array_equals(invocations, ['style: color: red; => null'], 'changing a
n attribute with the styles object\'s named setter should invoke the attributeCh
angedCallback'); |
| 82 |
| 83 invocations = []; |
| 84 b.style.cssText = 'color: pink;'; |
| 85 assert_array_equals(invocations, ['style: null => color: pink;'], 'changing
an attribute with the styles object\'s cssText setter should invoke the attribut
eChangedCallback'); |
| 86 |
| 87 invocations = []; |
| 88 b.style.setProperty('color', 'red'); |
| 89 assert_array_equals(invocations, ['style: color: pink; => color: red;'], 'ch
anging an attribute with the styles object\'s setProperty method should invoke t
he attributeChangedCallback'); |
| 90 |
| 91 invocations = []; |
| 92 b.style.removeProperty('color'); |
| 93 assert_array_equals(invocations, ['style: color: red; => null'], 'changing a
n attribute with the styles object\'s removeProperty method should invoke the at
tributeChangedCallback'); |
74 }, 'add, change and remove an attribute'); | 94 }, 'add, change and remove an attribute'); |
75 </script> | 95 </script> |
OLD | NEW |