为什么不绑定()找到一个双向绑定在一个端到端的测试?绑定、双向、端到、测试

2023-09-13 03:27:13 作者:柔侣

绑定()功能似乎并没有找到双向绑定的端到端测试。假设下面的绑定:

The binding() function doesn't seem to find two-way-bindings in e2e tests. Assuming the following bindings:

<input ng-model="username">
<p>{{email}}</p>
<input ng-bind="password">

下面的端到端测试失败:

The following e2e test fails:

...
expect(binding('username')).toMatch('alice');
...
>> Binding selector 'username' did not match.

下面的端到端测试成功:

The following e2e tests succeeds:

...
expect(binding('email')).toMatch('alice@ab.com');
expect(binding('password')).toMatch('abc123');
...

THX!

推荐答案

请尝试这种方式;

<input ng-model="username">

而在你的E2E的测试;

And in your E2E test;

expect(input('username').val()).toMatch('alice');