当一个复选框AngularJS端到端测试检查如何验证?复选框、端到、测试、AngularJS

2023-09-13 02:51:48 作者:割接你的伤痛〃

我一直在试图走出 AngularJS端到端测试和我卡住确定是否一个复选框被选中。

I've been trying out the AngularJS e2e tests and am getting stuck determining whether or not a checkbox is checked.

我使用了端到端的复选框,输入测试作为样本(见的端到端测试的选项卡中的的示例的)。

I used the end to end test for the checkbox input as a sample (see the End to end test tab in the Example).

HTML片段:

值1:<输入类型=复选框NG模型=值1> < BR />

控制器片段:

function Ctrl($scope) {
  $scope.value1 = true;
}

这里是我的尝试:

1)预期(结合('值1'))toEqual('真正');

本工作在样品结束长达结束测试为值1 显示在屏幕上以 {{值1} 。如果你测试这个本地和删除`{{值1}}绑定测试失败。在大多数我的现实世界的例子,我不显示在屏幕任意位置的复选框值。

This works in the sample end to end test as long as value1 is displayed on screen with {{value1}}. If you test this locally and remove `{{value1}} the binding test fails. In most of my real-world examples I am not displaying the checkbox value on the screen anywhere.

2)预期(输入('值1')VAL())toEqual('真正');

该值将始终默认为,并没有涉及到是否不复选框在选中状态(从拍摄的