Q:

How to test if a div is not displayed? 

I have a div with a unique id='myDiv'.  In a CasperJS test, I need to verify that this div is not displayed (i.e., display=none). 
How can I achieve this? 

A:

CasperJS provides the visible function in the casper module and assertVisible in the tester module. 
It checks 

whether getComputedStyle produces an exception, 
style.visibility === 'hidden' || style.display === 'none', 
style.display === "inline" || style.display === "inline-block" and 
elem.clientHeight > 0 && elem.clientWidth > 0 in that order. 

This also works if an ancestor element is hidden, but not the tested element.