File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -559,6 +559,12 @@ bot.dom.isShown = function(elem, opt_ignoreOpacity) {
559
559
throw new Error ( 'Argument to isShown must be of type Element' ) ;
560
560
}
561
561
562
+ // By convention, BODY element is always shown: BODY represents the document
563
+ // and even if there's nothing rendered in there, user can always see there's the document.
564
+ if ( bot . dom . isElement ( elem , goog . dom . TagName . BODY ) ) {
565
+ return true ;
566
+ }
567
+
562
568
// Option or optgroup is shown iff enclosing select is shown (ignoring the
563
569
// select's opacity).
564
570
if ( bot . dom . isElement ( elem , goog . dom . TagName . OPTION ) ||
Original file line number Diff line number Diff line change 40
40
expectedFailures = new goog . testing . ExpectedFailures ( ) ;
41
41
}
42
42
43
-
44
43
function tearDown ( ) {
45
44
expectedFailures . handleTearDown ( ) ;
45
+ goog . style . setStyle ( document . body , 'display' , 'block' ) ;
46
46
goog . style . setStyle ( document . body , 'overflow' , 'auto' ) ;
47
47
}
48
48
52
52
} ) ;
53
53
}
54
54
55
+ function testBodyShown ( ) {
56
+ assertTrue ( isShown ( document . body ) ) ;
57
+ }
58
+
59
+ function testBodyAlwaysShown ( ) {
60
+ goog . style . setStyle ( document . body , 'display' , 'none' ) ;
61
+ assertTrue ( "BODY element must *always* be shown" , isShown ( document . body ) ) ;
62
+ }
63
+
55
64
function testCanDetermineIfAnElementIsShownOrNot ( ) {
56
65
assertTrue ( isShown ( findElement ( { id : 'displayed' } ) ) ) ;
57
66
assertFalse ( isShown ( findElement ( { id : 'none' } ) ) ) ;
You can’t perform that action at this time.
0 commit comments