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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/shadow-dom/HTMLSlotElement-interface.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>Shadow DOM: HTMLSlotElement interface</title> 4 <title>Shadow DOM: HTMLSlotElement 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="HTMLSlotElement must exist on window with name attr ibute and getAssignedNode() method"> 6 <meta name="assert" content="HTMLSlotElement must exist on window with name attr ibute and getAssignedNode() method">
7 <link rel="help" href="https://w3c.github.io/webcomponents/spec/shadow/#the-slot -element"> 7 <link rel="help" href="https://w3c.github.io/webcomponents/spec/shadow/#the-slot -element">
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 </head> 10 </head>
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 var shadowRoot = shadowHost.attachShadow({mode: 'open'}); 132 var shadowRoot = shadowHost.attachShadow({mode: 'open'});
133 var slotElement = document.createElement('slot'); 133 var slotElement = document.createElement('slot');
134 slotElement.name = 'foo'; 134 slotElement.name = 'foo';
135 shadowRoot.appendChild(slotElement); 135 shadowRoot.appendChild(slotElement);
136 136
137 assert_array_equals(slotElement.assignedNodes(options), [], 'assignedNod es must be empty when there are no matching elements for the slot name'); 137 assert_array_equals(slotElement.assignedNodes(options), [], 'assignedNod es must be empty when there are no matching elements for the slot name');
138 138
139 slotElement.removeAttribute('name'); 139 slotElement.removeAttribute('name');
140 assert_array_equals(slotElement.assignedNodes(options), [child], 'assign edNodes must be empty when there are no matching elements for the slot name'); 140 assert_array_equals(slotElement.assignedNodes(options), [child], 'assign edNodes must be empty when there are no matching elements for the slot name');
141 141
142 }, 'assignedNodes must update when a default slot is introduced dynamically by a slot rename'); 142 }, 'assignedNodes(' + (options ? JSON.stringify(options) : '') + ') must upd ate when a default slot is introduced dynamically by a slot rename');
143 } 143 }
144 144
145 testMutatingSlotName(null); 145 testMutatingSlotName(null);
146 testMutatingSlotName({flattened: false}); 146 testMutatingSlotName({flattened: false});
147 testMutatingSlotName({flattened: true}); 147 testMutatingSlotName({flattened: true});
148 148
149 function testInsertingAndRemovingSlots(options) 149 function testInsertingAndRemovingSlots(options)
150 { 150 {
151 test(function () { 151 test(function () {
152 var shadowHost = document.createElement('div'); 152 var shadowHost = document.createElement('div');
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 'Removing and re-inserting a default slot must not change the result of assignedNodes on a detached slot'); 186 'Removing and re-inserting a default slot must not change the result of assignedNodes on a detached slot');
187 assert_array_equals(secondSlotElement.assignedNodes(options), [p, text, b], 187 assert_array_equals(secondSlotElement.assignedNodes(options), [p, text, b],
188 'Removing and re-inserting a default slot must not change the result of assignedNodes'); 188 'Removing and re-inserting a default slot must not change the result of assignedNodes');
189 189
190 shadowRoot.insertBefore(firstSlotElement, secondSlotElement); 190 shadowRoot.insertBefore(firstSlotElement, secondSlotElement);
191 assert_array_equals(firstSlotElement.assignedNodes(options), [p, text, b ], 191 assert_array_equals(firstSlotElement.assignedNodes(options), [p, text, b ],
192 'assignedNodes on a newly inserted unnamed slot element must return the elements without slot attributes and text nodes'); 192 'assignedNodes on a newly inserted unnamed slot element must return the elements without slot attributes and text nodes');
193 assert_array_equals(secondSlotElement.assignedNodes(options), [], 193 assert_array_equals(secondSlotElement.assignedNodes(options), [],
194 'assignedNodes on formerly-first but now second unnamed slot element must return an empty array'); 194 'assignedNodes on formerly-first but now second unnamed slot element must return an empty array');
195 195
196 }, 'assignedNodes must update when slot elements are inserted or removed'); 196 }, 'assignedNodes(' + (options ? JSON.stringify(options) : '') + ') must upd ate when slot elements are inserted or removed');
197 } 197 }
198 198
199 testInsertingAndRemovingSlots(null); 199 testInsertingAndRemovingSlots(null);
200 testInsertingAndRemovingSlots({flattened: false}); 200 testInsertingAndRemovingSlots({flattened: false});
201 testInsertingAndRemovingSlots({flattened: true}); 201 testInsertingAndRemovingSlots({flattened: true});
202 202
203 test(function () { 203 test(function () {
204 var outerHost = document.createElement('div'); 204 var outerHost = document.createElement('div');
205 var outerChild = document.createElement('span'); 205 var outerChild = document.createElement('span');
206 outerHost.appendChild(outerChild); 206 outerHost.appendChild(outerChild);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 260
261 assert_array_equals(innerSlot.assignedNodes(), [outerSlot, innerChild], 'ass ignedNodes() on a default slot must return the assigned nodes'); 261 assert_array_equals(innerSlot.assignedNodes(), [outerSlot, innerChild], 'ass ignedNodes() on a default slot must return the assigned nodes');
262 assert_array_equals(innerSlot.assignedNodes({flatten: false}), [outerSlot, i nnerChild], 'assignedNodes({flatten: false}) on a default slot must return the a ssigned nodes'); 262 assert_array_equals(innerSlot.assignedNodes({flatten: false}), [outerSlot, i nnerChild], 'assignedNodes({flatten: false}) on a default slot must return the a ssigned nodes');
263 assert_array_equals(innerSlot.assignedNodes({flatten: true}), [outerChild, i nnerChild], 'assignedNodes({flatten: true}) on a default slot must return the di stributed nodes'); 263 assert_array_equals(innerSlot.assignedNodes({flatten: true}), [outerChild, i nnerChild], 'assignedNodes({flatten: true}) on a default slot must return the di stributed nodes');
264 264
265 }, 'assignedNodes({flatten: true}) must return the distributed nodes, and assign edNodes() and assignedNodes({flatten: false}) must returned the assigned nodes') ; 265 }, 'assignedNodes({flatten: true}) must return the distributed nodes, and assign edNodes() and assignedNodes({flatten: false}) must returned the assigned nodes') ;
266 266
267 </script> 267 </script>
268 </body> 268 </body>
269 </html> 269 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698