我有一个下拉列表,当我选择一些元素时。该文本在下拉框中显示中断。我需要能够验证文字在量角器测试中没有被切断。量角器 - 如何验证下拉列表中的文本选择不会被截断
<select class="form-control add_reason_select ng-pristine ng-empty ng-invalid ng-invalid-required ng-touched" required="" name="reason_id" ng- options="EntranceReason.Reason for EntranceReason in selectedTransition.EntranceReasons track by EntranceReason.Id" ng- change="selectReason(selectedTransition.selectedReason)" ng- model="selectedTransition.selectedReason" style="">
<option value="?" selected="selected"></option>
<option label="Candidate withdrew" value="1">Candidate withdrew</option>
<option label="Cannot meet applicant salary requirements" value="2">Cannot meet applicant salary requirements</option>
<option label="Conflict of interest" value="3">Conflict of interest</option>
<option label="Did not meet pre-employment requirements" value="11">Did not meet pre-employment requirements</option>
<option label="Does not meet minimum qualifications" value="12">Does not meet minimum qualifications</option>
我使用移动模拟在iPhone 5的Chrome浏览器和其中一些下拉选择的文本显示切断一次选择。
例如使用iPhone 5仿真。如果我选择不符合下拉列表中的最低限定条件。实际上可见的是“不符合最低要求”。 根据我使用的移动仿真,将更多或更少的文本被截断。
我可以选择所选元素并按照我在量角器测试中所做的操作进行检查。
var el = element(by.model('selectedTransition.selectedReason')).$('option:checked');
expect(el.getText()).toEqual('Cannot not meet pre-employment requirements');
但这并不是不实际读取可见文本,而是在读这符合预期的语句,并传递元素值。如何验证可见文本是否被切断?
谢谢!它确实有帮助。将选择alecxe的答案作为解决方案。我想我可能能够获得宽度属性并通过这种方式进行验证。 –