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

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

Issue 2697453005: Import wpt@758b3b4cfa805067f36121333ba031e583d3a62c (Closed)
Patch Set: Add -expected.txt files. Created 3 years, 10 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 var instance = document.createElement(element.name); 119 var instance = document.createElement(element.name);
120 instance.setAttribute('class', 'hello world'); 120 instance.setAttribute('class', 'hello world');
121 assert_array_equals(element.takeLog().types(), ['constructed', 'attributeCha nged']); 121 assert_array_equals(element.takeLog().types(), ['constructed', 'attributeCha nged']);
122 instance.classList.toggle('world'); 122 instance.classList.toggle('world');
123 var logEntries = element.takeLog(); 123 var logEntries = element.takeLog();
124 assert_array_equals(logEntries.types(), ['attributeChanged']); 124 assert_array_equals(logEntries.types(), ['attributeChanged']);
125 assert_attribute_log_entry(logEntries.last(), {name: 'class', oldValue: 'hel lo world', newValue: 'hello', namespace: null}); 125 assert_attribute_log_entry(logEntries.last(), {name: 'class', oldValue: 'hel lo world', newValue: 'hello', namespace: null});
126 }, 'toggle on DOMTokenList must enqueue an attributeChanged reaction when removi ng a value from an attribute'); 126 }, 'toggle on DOMTokenList must enqueue an attributeChanged reaction when removi ng a value from an attribute');
127 127
128 test(function () { 128 test(function () {
129 var element = define_new_custom_element(['lang']);
130 var instance = document.createElement(element.name);
131 instance.setAttribute('class', 'hello world');
132 assert_array_equals(element.takeLog().types(), ['constructed']);
133 instance.classList.toggle('world');
134 assert_array_equals(element.takeLog().types(), []);
135 }, 'remove on DOMTokenList must not enqueue an attributeChanged reaction when re moving a value from an unobserved attribute');
136
137 test(function () {
138 var element = define_new_custom_element(['class']); 129 var element = define_new_custom_element(['class']);
139 var instance = document.createElement(element.name); 130 var instance = document.createElement(element.name);
140 instance.setAttribute('class', 'hello'); 131 instance.setAttribute('class', 'hello');
141 assert_array_equals(element.takeLog().types(), ['constructed', 'attributeCha nged']); 132 assert_array_equals(element.takeLog().types(), ['constructed', 'attributeCha nged']);
142 instance.classList.replace('hello', 'world'); 133 instance.classList.replace('hello', 'world');
143 var logEntries = element.takeLog(); 134 var logEntries = element.takeLog();
144 assert_array_equals(logEntries.types(), ['attributeChanged']); 135 assert_array_equals(logEntries.types(), ['attributeChanged']);
145 assert_attribute_log_entry(logEntries.last(), {name: 'class', oldValue: 'hel lo', newValue: 'world', namespace: null}); 136 assert_attribute_log_entry(logEntries.last(), {name: 'class', oldValue: 'hel lo', newValue: 'world', namespace: null});
146 }, 'replace on DOMTokenList must enqueue an attributeChanged reaction when repla cing a value in an attribute'); 137 }, 'replace on DOMTokenList must enqueue an attributeChanged reaction when repla cing a value in an attribute');
147 138
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 assert_array_equals(element.takeLog().types(), ['constructed', 'attributeCha nged']); 201 assert_array_equals(element.takeLog().types(), ['constructed', 'attributeCha nged']);
211 instance.classList = 'hello'; 202 instance.classList = 'hello';
212 var logEntries = element.takeLog(); 203 var logEntries = element.takeLog();
213 assert_array_equals(logEntries.types(), ['attributeChanged']); 204 assert_array_equals(logEntries.types(), ['attributeChanged']);
214 assert_attribute_log_entry(logEntries.last(), {name: 'class', oldValue: 'hel lo', newValue: 'hello', namespace: null}); 205 assert_attribute_log_entry(logEntries.last(), {name: 'class', oldValue: 'hel lo', newValue: 'hello', namespace: null});
215 }, 'the stringifier of DOMTokenList must enqueue an attributeChanged reaction wh en the setter is called with the original value of the attribute'); 206 }, 'the stringifier of DOMTokenList must enqueue an attributeChanged reaction wh en the setter is called with the original value of the attribute');
216 207
217 </script> 208 </script>
218 </body> 209 </body>
219 </html> 210 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698