@@ -27,42 +27,44 @@ <H1>Page for Shadow DOM chromedriver tests</H1>
27
27
</ div >
28
28
29
29
< template id ="parentTemplate ">
30
- < div id ="parentDiv ">
30
+ < div id ="parentDiv ">
31
31
< div style ="border-style:solid;border-color:green ">
32
- < H3 > Parent</ H3 >
33
- < H4 > Contents</ H4 >
34
- < content > </ content >
32
+ < H3 > Parent</ H3 >
33
+ < H4 > Contents</ H4 >
34
+ < content > </ content >
35
35
</ div >
36
- </ div >
36
+ </ div >
37
37
</ template >
38
38
< template id ="olderChildTemplate ">
39
- < div id ="olderChildDiv ">
39
+ < div id ="olderChildDiv ">
40
40
< div style ="border-style:solid;border-color:red ">
41
- < H3 id ="olderHeading "> Older Child</ H3 >
42
- As the older child of a nested shadow root, this is the most likely
43
- to go wrong bit of the page, so we'll concentrate our tests here.
44
- < H4 > Contents</ H4 >
45
- < content > </ content >
46
- < input id ="olderTextBox " type ="text " value ="foo "/>
47
- < input type ="button " onClick ="buttonWasClicked() " value ="button "
48
- id ="olderButton "/>
41
+ < H3 id ="olderHeading "> Older Child</ H3 >
42
+ As the older child of a nested shadow root, this is the most likely
43
+ to go wrong bit of the page, so we'll concentrate our tests here.
44
+ < H4 > Contents</ H4 >
45
+ < content > </ content >
46
+ < input id ="olderTextBox " type ="text " value ="foo "/>
47
+ < input type ="button " onClick ="buttonWasClicked() " value ="button "
48
+ id ="olderButton "/>
49
49
</ div >
50
- </ div >
50
+ </ div >
51
51
</ template >
52
52
< template id ="youngerChildTemplate ">
53
- < div id ="youngerChildDiv ">
53
+ < input type ="button " onClick ="buttonWasClicked() " value ="button "
54
+ id ="youngerButton "/>
55
+ < div id ="youngerChildDiv ">
54
56
< div style ="border-style:solid;border-color:blue ">
55
- < H3 > Younger Child</ H3 >
56
- < div style ="border-style:dotted;border-color:blue ">
57
- < H4 > Younger Child Contents</ H4 >
58
- < content > </ content >
59
- </ div >
60
- < div style ="border-style:dashed;border-color:blue ">
61
- < H4 > Younger Child Shadow</ H4 >
62
- < shadow > </ shadow >
63
- </ div >
57
+ < H3 > Younger Child</ H3 >
58
+ < div style ="border-style:dotted;border-color:blue ">
59
+ < H4 > Younger Child Contents</ H4 >
60
+ < content > </ content >
61
+ </ div >
62
+ < div style ="border-style:dashed;border-color:blue ">
63
+ < H4 > Younger Child Shadow</ H4 >
64
+ < shadow > </ shadow >
65
+ </ div >
64
66
</ div >
65
- </ div >
67
+ </ div >
66
68
</ template >
67
69
< script type ="text/javascript " >
68
70
var parentShadowRoot = document . querySelector ( '#innerDiv' ) . createShadowRoot ( ) ;
@@ -108,6 +110,17 @@ <H4>Younger Child Shadow</H4>
108
110
getCenterCoordinate ( elemButton ) ) . clickable ) ;
109
111
}
110
112
113
+ function testShadowRootTopLevelComponentIsElementClickable ( ) {
114
+ // Regression test: check things also work on buttons that are top-level
115
+ // components of a shadow DOM
116
+ var elemButton = document . querySelector ( "* /deep/ #youngerButton" ) ;
117
+ webdriver . chrome . getLocationInView ( elemButton , true ) ;
118
+ assertTrue (
119
+ "Button #youngerButton should be clickable" ,
120
+ webdriver . chrome . isElementClickable ( elemButton ,
121
+ getCenterCoordinate ( elemButton ) ) . clickable ) ;
122
+ }
123
+
111
124
function testShadowRootIsDisplayed ( ) {
112
125
// check isDisplayed works as expected on elements within a shadow
113
126
// DOM
0 commit comments