Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/custom-elements/reactions/DOMTokenList.html

Issue 2446483002: Import wpt@c5a14f553cba5f197743b9af605a84eddd8692a2 (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Custom Elements: CEReactions on DOMTokenList interface</title> 4 <title>Custom Elements: CEReactions on DOMTokenList interface</title>
5 <meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org"> 5 <meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
6 <meta name="assert" content="add, remove, toggle, replace, and the stringifier o f DOMTokenList interface must have CEReactions"> 6 <meta name="assert" content="add, remove, toggle, replace, and the stringifier o f DOMTokenList interface must have CEReactions">
7 <meta name="help" content="https://dom.spec.whatwg.org/#node"> 7 <meta name="help" content="https://dom.spec.whatwg.org/#node">
8 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharness.js"></script>
9 <script src="/resources/testharnessreport.js"></script> 9 <script src="/resources/testharnessreport.js"></script>
10 <script src="../resources/custom-elements-helpers.js"></script> 10 <script src="../resources/custom-elements-helpers.js"></script>
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 assert_array_equals(logEntries.types(), ['attributeChanged']); 82 assert_array_equals(logEntries.types(), ['attributeChanged']);
83 assert_attribute_log_entry(logEntries.last(), {name: 'class', oldValue: 'hel lo foo world bar', newValue: 'foo bar', namespace: null}); 83 assert_attribute_log_entry(logEntries.last(), {name: 'class', oldValue: 'hel lo foo world bar', newValue: 'foo bar', namespace: null});
84 }, 'remove on DOMTokenList must enqueue exactly one attributeChanged reaction wh en removing multiple values to an attribute'); 84 }, 'remove on DOMTokenList must enqueue exactly one attributeChanged reaction wh en removing multiple values to an attribute');
85 85
86 test(function () { 86 test(function () {
87 var element = define_new_custom_element(['class']); 87 var element = define_new_custom_element(['class']);
88 var instance = document.createElement(element.name); 88 var instance = document.createElement(element.name);
89 instance.setAttribute('class', 'hello world'); 89 instance.setAttribute('class', 'hello world');
90 assert_array_equals(element.takeLog().types(), ['constructed', 'attributeCha nged']); 90 assert_array_equals(element.takeLog().types(), ['constructed', 'attributeCha nged']);
91 instance.classList.remove('foo'); 91 instance.classList.remove('foo');
92 assert_array_equals(element.takeLog().types(), []); 92 var logEntries = element.takeLog();
93 }, 'remove on DOMTokenList must not enqueue an attributeChanged reaction when re moving a non-existent value from an attribute'); 93 assert_array_equals(logEntries.types(), ['attributeChanged']);
94 assert_attribute_log_entry(logEntries.last(), {name: 'class', oldValue: 'hel lo world', newValue: 'hello world', namespace: null});
95 }, 'remove on DOMTokenList must enqueue an attributeChanged reaction even when r emoving a non-existent value from an attribute');
94 96
95 test(function () { 97 test(function () {
96 var element = define_new_custom_element(['title']); 98 var element = define_new_custom_element(['title']);
97 var instance = document.createElement(element.name); 99 var instance = document.createElement(element.name);
98 instance.setAttribute('class', 'hello world'); 100 instance.setAttribute('class', 'hello world');
99 assert_array_equals(element.takeLog().types(), ['constructed']); 101 assert_array_equals(element.takeLog().types(), ['constructed']);
100 instance.classList.remove('world'); 102 instance.classList.remove('world');
101 assert_array_equals(element.takeLog().types(), []); 103 assert_array_equals(element.takeLog().types(), []);
102 }, 'remove on DOMTokenList must not enqueue an attributeChanged reaction when re moving a value from an unobserved attribute'); 104 }, 'remove on DOMTokenList must not enqueue an attributeChanged reaction when re moving a value from an unobserved attribute');
103 105
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 assert_array_equals(element.takeLog().types(), ['constructed', 'attributeCha nged']); 210 assert_array_equals(element.takeLog().types(), ['constructed', 'attributeCha nged']);
209 instance.classList = 'hello'; 211 instance.classList = 'hello';
210 var logEntries = element.takeLog(); 212 var logEntries = element.takeLog();
211 assert_array_equals(logEntries.types(), ['attributeChanged']); 213 assert_array_equals(logEntries.types(), ['attributeChanged']);
212 assert_attribute_log_entry(logEntries.last(), {name: 'class', oldValue: 'hel lo', newValue: 'hello', namespace: null}); 214 assert_attribute_log_entry(logEntries.last(), {name: 'class', oldValue: 'hel lo', newValue: 'hello', namespace: null});
213 }, 'the stringifier of DOMTokenList must enqueue an attributeChanged reaction wh en the setter is called with the original value of the attribute'); 215 }, 'the stringifier of DOMTokenList must enqueue an attributeChanged reaction wh en the setter is called with the original value of the attribute');
214 216
215 </script> 217 </script>
216 </body> 218 </body>
217 </html> 219 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698