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

Side by Side Diff: third_party/WebKit/LayoutTests/shadow-dom/slotchange-event.html

Issue 2071133004: Remove old tests for slotchange events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@slotchange
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src='../resources/testharness.js'></script>
3 <script src='../resources/testharnessreport.js'></script>
4 <script src='resources/shadow-dom.js'></script>
5 <div id='d1'>
6 <template data-mode='open' data-expose-as='d1_shadow'>
7 <div id='d1-d1'>
8 <template data-mode='open' data-expose-as='d1_d1_shadow'>
9 <slot name='d1-d1-s1'></slot>
10 </template>
11 <slot name='d1-s1' slot='d1-d1-s1'></slot>
12 </div>
13 </template>
14 <div id='d2' slot='d1-s1'></div>
15 </div>
16 <script>
17 'use strict';
18 convertTemplatesToShadowRootsWithin(d1);
19 removeWhiteSpaceOnlyTextNodes(d1);
20
21 async_test((test) => {
22 var count_for_d1_s1 = 0;
23 var count_for_d1_d1_s1 = 0;
24
25 const d1_s1 = d1_shadow.querySelector('slot');
26 const d1_d1_s1 = d1_d1_shadow.querySelector('slot');
27
28 assert_array_equals(d1_s1.assignedNodes(), [d2]);
29 assert_array_equals(d1_s1.assignedNodes({'flatten': true}), [d2]);
30
31 assert_array_equals(d1_d1_s1.assignedNodes(), [d1_s1]);
32 assert_array_equals(d1_d1_s1.assignedNodes({'flatten': true}), [d2]);
33
34 d1_s1.addEventListener('slotchange', (e) => {
35 test.step(() => {
36 count_for_d1_s1++;
37 if (count_for_d1_s1 == 1) {
38 assert_equals(e.target, d1_s1);
39 assert_array_equals(d1_s1.assignedNodes(), [d2, d3]);
40 assert_array_equals(d1_s1.assignedNodes({'flatten': true}), [d2, d3]);
41 } else if (count_for_d1_s1 == 2) {
42 assert_equals(e.target, d1_s1);
43 assert_array_equals(d1_s1.assignedNodes(), [d2]);
44 assert_array_equals(d1_s1.assignedNodes({'flatten': true}), [d2]);
45 test.done();
46 }
47 });
48 });
49
50 d1_d1_s1.addEventListener('slotchange', (e) => {
51 test.step(() => {
52 count_for_d1_d1_s1++;
53 if (count_for_d1_d1_s1 == 1) {
54 assert_equals(e.target, d1_d1_s1);
55 assert_array_equals(d1_d1_s1.assignedNodes(), [d1_s1]);
56 assert_array_equals(d1_d1_s1.assignedNodes({'flatten': true}), [d2, d3]) ;
57 } else if (count_for_d1_d1_s1 == 2){
58 assert_equals(e.target, d1_d1_s1);
59 assert_array_equals(d1_d1_s1.assignedNodes(), [d1_s1]);
60 assert_array_equals(d1_d1_s1.assignedNodes({'flatten': true}), [d2]);
61 test.done();
62 }
63 });
64 });
65
66 const d3 = document.createElement('div');
67 d3.setAttribute('id', 'd3');
68 d3.setAttribute('slot', 'd1-s1');
69 d1.appendChild(d3);
70 // Different microtask.
71 setTimeout(function(){
72 d3.remove();
73 }, 0);
74
75 }, "slotchange event should be dispatched for a slot at most once per microtask. ");
76 </script>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698