OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 <script src="resources/shadow-dom.js"></script> | 5 <script src="resources/shadow-dom.js"></script> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <script> | 8 <script> |
9 description("Tests for getDestinationInsertionPoints() which involves re-distrib
ution."); | 9 description("Tests for getDestinationInsertionPoints() which involves re-distrib
ution."); |
10 | 10 |
11 document.body.appendChild( | 11 document.body.appendChild( |
12 createDOM('div', {}, | 12 createDOM('div', {}, |
13 createDOM('div', {'id': 'host-1'}, | 13 createDOM('div', {'id': 'host-1'}, |
14 createShadowRoot( | 14 createShadowRoot( |
15 createDOM('div', {'id': 'host-2'}, | 15 createDOM('div', {'id': 'host-2'}, |
16 createShadowRoot( | 16 createShadowRoot( |
17 createDOM('content', {'id': 'content-2
'})), | 17 createDOM('content', {'id': 'content-2
'})), |
18 createDOM('content', {'id': 'content-1'}))
), | 18 createDOM('content', {'id': 'content-1'}))
), |
19 createDOM('div', {'id': 'child-1'})))); | 19 createDOM('div', {'id': 'child-1'})))); |
20 | 20 |
21 shouldBeEqualAsArray(document.getElementById('child-1').getDestinationInsertionP
oints(), | 21 shouldBeEqualAsArray(document.getElementById('child-1').getDestinationInsertionP
oints(), |
22 [getNodeInTreeOfTrees('host-1/content-1'), getNodeInTreeOfT
rees('host-1/host-2/content-2')]); | 22 [getNodeInTreeOfTrees('host-1/content-1'), getNodeInTreeOfT
rees('host-1/host-2/content-2')]); |
23 | 23 |
24 debug('adding explicit open mode should not change the behavior.'); | |
25 document.body.appendChild( | 24 document.body.appendChild( |
26 createDOM('div', {}, | 25 createDOM('div', {}, |
27 createDOM('div', {'id': 'host-10'}, | 26 createDOM('div', {'id': 'host-10'}, |
28 createShadowRoot( | 27 createShadowRoot( |
29 createDOM('div', {'id': 'host-20'}, | 28 createDOM('div', {'id': 'host-20'}, |
30 createShadowRoot( | 29 createShadowRoot( |
31 {'mode': 'open'}, | 30 {'mode': 'open'}, |
32 createDOM('content', {'id': 'content-2
0'})), | 31 createDOM('content', {'id': 'content-2
0'})), |
33 createDOM('content', {'id': 'content-10'})
)), | 32 createDOM('content', {'id': 'content-10'})
)), |
34 createDOM('div', {'id': 'child-10'})))); | 33 createDOM('div', {'id': 'child-10'})))); |
35 | 34 |
36 shouldBeEqualAsArray(document.getElementById('child-10').getDestinationInsertion
Points(), | 35 shouldBeEqualAsArray(document.getElementById('child-10').getDestinationInsertion
Points(), |
37 [getNodeInTreeOfTrees('host-10/content-10'), getNodeInTreeO
fTrees('host-10/host-20/content-20')]); | 36 [getNodeInTreeOfTrees('host-10/content-10')]); |
38 | 37 |
39 debug('Only unclosed insertion points should be returned for getDestinationInser
tionPoints().'); | |
40 document.body.appendChild( | 38 document.body.appendChild( |
41 createDOM('div', {}, | 39 createDOM('div', {}, |
42 createDOM('div', {'id': 'host-11'}, | 40 createDOM('div', {'id': 'host-11'}, |
43 createShadowRoot( | 41 createShadowRoot( |
44 createDOM('div', {'id': 'host-21'}, | 42 createDOM('div', {'id': 'host-21'}, |
45 createShadowRoot( | 43 createShadowRoot( |
46 {'mode': 'closed'}, | 44 {'mode': 'closed'}, |
47 createDOM('content', {'id': 'content-2
1'})), | 45 createDOM('content', {'id': 'content-2
1'})), |
48 createDOM('content', {'id': 'content-11'})
)), | 46 createDOM('content', {'id': 'content-11'})
)), |
49 createDOM('div', {'id': 'child-11'})))); | 47 createDOM('div', {'id': 'child-11'})))); |
50 | 48 |
51 shouldBeEqualAsArray(document.getElementById('child-11').getDestinationInsertion
Points(), | 49 shouldBeEqualAsArray(document.getElementById('child-11').getDestinationInsertion
Points(), |
52 [getNodeInTreeOfTrees('host-11/content-11')]); | 50 [getNodeInTreeOfTrees('host-11/content-11')]); |
53 | 51 |
54 document.body.appendChild( | 52 document.body.appendChild( |
55 createDOM('div', {}, | 53 createDOM('div', {}, |
56 createDOM('div', {'id': 'host-12'}, | 54 createDOM('div', {'id': 'host-12'}, |
57 createShadowRoot( | 55 createShadowRoot( |
58 {'mode': 'closed'}, | 56 {'mode': 'closed'}, |
59 createDOM('div', {'id': 'host-22'}, | 57 createDOM('div', {'id': 'host-22'}, |
60 createShadowRoot( | 58 createShadowRoot( |
61 createDOM('content', {'id': 'content-2
2'})), | 59 createDOM('content', {'id': 'content-2
2'})), |
62 createDOM('content', {'id': 'content-12'})
)), | 60 createDOM('content', {'id': 'content-12'})
)), |
63 createDOM('div', {'id': 'child-12'})))); | 61 createDOM('div', {'id': 'child-12'})))); |
64 | 62 |
65 shouldBe('document.getElementById("child-12").getDestinationInsertionPoints().le
ngth', '0'); | 63 shouldBe('document.getElementById("child-12").getDestinationInsertionPoints().le
ngth', '0'); |
66 </script> | 64 </script> |
67 </body> | 65 </body> |
68 </html> | 66 </html> |
OLD | NEW |