Commit b754bf80 b754bf80a78f83410a546f43e5737e4d6663d85c by Trent Ohannessian

Add style.display check for inline-block when determining element visibility

When checking for visibility, style.display is checked to match
“inline”.  Added a check for “inline-block”.
1 parent d306b927
......@@ -164,7 +164,7 @@
if (hidden) {
return false;
}
if (style.display === "inline") {
if (style.display === "inline" || style.display === "inline-block") {
return true;
}
return elem.clientHeight > 0 && elem.clientWidth > 0;
......
......@@ -201,3 +201,23 @@ casper.test.begin('ClientUtils.getElementsInfo() second element tests', 10, func
'ClientUtils.getElementsInfo() retrieves second element whole tag contents');
test.done();
});
casper.test.begin('ClientUtils.getElementInfo() visibility tests', 4, function(test) {
casper.page.content = '<a href="plop" class="plip plup" style="display: inline"><i>paf</i></a>';
var info = casper.getElementInfo('a.plip');
test.assert(info.visible, 'ClientUtils.getElementInfo() retrieves element visibility with display inline');
casper.page.content = '<a href="plop" class="plip plup" style="display: inline-block"><i>paf</i></a>';
info = casper.getElementInfo('a.plip');
test.assert(info.visible, 'ClientUtils.getElementInfo() retrieves element visibility with display inline-block');
casper.page.content = '<a href="plop" class="plip plup" style="visibility: hidden"><i>paf</i></a>';
info = casper.getElementInfo('a.plip');
test.assertNot(info.visible, 'ClientUtils.getElementInfo() retrieves element visibility with visibility hidden');
casper.page.content = '<a href="plop" class="plip plup" style="display: none"><i>paf</i></a>';
info = casper.getElementInfo('a.plip');
test.assertNot(info.visible, 'ClientUtils.getElementInfo() retrieves element visibility with display none');
test.done();
});
......