如何确定某个元素是否可见或隐藏在唾液(茉莉花)中?测试某些元素是否可见
我的DOM的样子:
<div class="span5 value-entry">
<input type="text" ng-model="query.value" placeholder="Enter value" class="input-large" ng-show="genericInput(criteria.attribute)">
<select ng-model="query.value" ng-options="entry for entry in filteredValue(criteria.attribute)" class="input-medium" ng-show="!genericInput(criteria.attribute)">
<option value="">-- Select Value --</option>.
</select>
</div>
要么选择显示或输入框,但不能同时使用。我想检查哪些元素是可见的(基于其他标准),但我似乎无法弄清楚如何让代码工作。我写了下面的代码:
expect(element('.value-entry input').is(':visible')).toBe(true);
但我得到一个错误:
TypeError: Object #<Object> has no method 'is'
如何检查,如果输入的是可见的,并且选择在同一时间(反之亦然)隐藏?
编辑:我想在这里补充一点,这是一个端到端的测试
参见这个问题:http://stackoverflow.com/questions/16703276/angular-watch- for-ngshow-nghide-changes-in-ancestors-that-affect-child-dom-ele这个解决方案也考虑到祖先的可见性 – lanoxx