@@ -3,6 +3,7 @@ describe('dom.isVisible', function() {
3
3
4
4
var fixture = document . getElementById ( 'fixture' ) ;
5
5
var fixtureSetup = axe . testUtils . fixtureSetup ;
6
+ var isIE11 = axe . testUtils . isIE11 ;
6
7
var shadowSupported = axe . testUtils . shadowSupport . v1 ;
7
8
var fakeNode = {
8
9
nodeType : Node . ELEMENT_NODE ,
@@ -188,6 +189,33 @@ describe('dom.isVisible', function() {
188
189
el = document . getElementById ( 'target' ) ;
189
190
assert . isFalse ( axe . commons . dom . isVisible ( el ) ) ;
190
191
} ) ;
192
+
193
+ // IE11 either only supports clip paths defined by url() or not at all,
194
+ // MDN and caniuse.com give different results...
195
+ ( isIE11 || window . PHANTOMJS ? it . skip : it ) (
196
+ 'should detect clip-path hidden text technique' ,
197
+ function ( ) {
198
+ fixture . innerHTML =
199
+ '<div id="target" style="clip-path: inset(50%);">Hi</div>' ;
200
+
201
+ var el = document . getElementById ( 'target' ) ;
202
+ assert . isFalse ( axe . commons . dom . isVisible ( el ) ) ;
203
+ }
204
+ ) ;
205
+
206
+ ( isIE11 || window . PHANTOMJS ? it . skip : it ) (
207
+ 'should detect clip-path hidden text technique on parent' ,
208
+ function ( ) {
209
+ fixture . innerHTML =
210
+ '<div style="clip-path: circle(0%);">' +
211
+ '<div id="target">Hi</div>' +
212
+ '</div>' ;
213
+
214
+ var el = document . getElementById ( 'target' ) ;
215
+ assert . isFalse ( axe . commons . dom . isVisible ( el ) ) ;
216
+ }
217
+ ) ;
218
+
191
219
( shadowSupported ? it : xit ) (
192
220
'should correctly handle visible slotted elements' ,
193
221
function ( ) {
@@ -411,5 +439,23 @@ describe('dom.isVisible', function() {
411
439
el = document . getElementById ( 'target' ) ;
412
440
assert . isTrue ( axe . commons . dom . isVisible ( el , true ) ) ;
413
441
} ) ;
442
+
443
+ it ( 'should detect clip-path hidden text technique' , function ( ) {
444
+ fixture . innerHTML =
445
+ '<div id="target" style="clip-path: inset(50%);">Hi</div>' ;
446
+
447
+ var el = document . getElementById ( 'target' ) ;
448
+ assert . isTrue ( axe . commons . dom . isVisible ( el , true ) ) ;
449
+ } ) ;
450
+
451
+ it ( 'should detect clip-path hidden text technique on parent' , function ( ) {
452
+ fixture . innerHTML =
453
+ '<div style="clip-path: circle(0%);">' +
454
+ '<div id="target">Hi</div>' +
455
+ '</div>' ;
456
+
457
+ var el = document . getElementById ( 'target' ) ;
458
+ assert . isTrue ( axe . commons . dom . isVisible ( el , true ) ) ;
459
+ } ) ;
414
460
} ) ;
415
461
} ) ;
0 commit comments