How do I find out if an element is visible or hidden in testacular (jasmine)?
My DOM looks like:
By default, display is set to inline
for input, and inline-block
for select. Therefore, you can determine if either are currently shown by testing for the existence of the default CSS property.
expect(element('.value-entry input').css('display')).toBe('inline');
expect(element('.value-entry select').css('display')).toBe('inline-block');
To check if either are hidden, replace inline
and inline-block
with a check for none
, which is how ngShow hides an element.
expect(element('.value-entry input').css('display')).toBe('none');
expect(element('.value-entry select').css('display')).toBe('none');