设置使用量角器的角度模式

编程入门 行业动态 更新时间:2024-10-26 20:25:22
本文介绍了设置使用量角器的角度模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图模仿用户的故事在我的网站用量角器。

用户必须键入一个使用自动完成的输入。在现实生活中,用户可以键入输入一些文字,然后,用她的鼠标或多个天然她DownArrow中文键选择正确的命题。

问题是,我似乎无法模拟与量角器。 element.sendKeys只是不允许你这样做。我曾尝试在十几个不同的方式,它充其量产生未predictable结果。

所以我想操纵NG-模型直接behing我的输入。是否有访问它从量角器和通话功能/设置属性的元素范围的方法是什么?

下面是我的问题的一个简化版本:

查看:

< D​​IV NG控制器=myController的>  <输入ID =我输入NG模型=基于myModel/>< / DIV>

控制器:

myModule.controller('myController的',['$范围',函数($范围){   $ scope.myModel =;   // [...] }]);

E2E量角器测试:

描述了(设置基于myModel为固定值功能(){  它(应该设置基于myModel为测试值',函数(){    VAR myInput =元素('我输入');    // 怎么办?  });});

解决方案

在这样的回答:How选择在下拉protractorjs端到端测试选项

他们使用这样的: .sendKeys(protractor.Key.ARROW_DOWN); 发送下箭头

这值得一试。

I'm trying to emulate a user story on my website with Protractor.

The user has to type in an input that uses auto-completion. In real life, the user has to type some text in the input, then select the right proposition with either her mouse or more naturally her downarrow key.

The problem is that I can't seem to simulate that with Protractor. element.sendKeys just does not allow you to do that. I have tried in a dozen different manners and it yields unpredictable results at best.

So I would like to manipulate the ng-model behing my input directly. Is there a way to access the scope of an element from Protractor and call functions/set properties on it?

Here is a simplified version of my problem :

View :

<div ng-controller="MyController"> <input id="my-input" ng-model="myModel"/> </div>

Controller :

myModule.controller('MyController', ['$scope', function($scope){ $scope.myModel = ""; //[...] }]);

e2e Protractor test :

describe("setting myModel to a fixture value", function(){ it("should set myModel to 'a test value'", function(){ var myInput = element('my-input'); // Now what? }); });

解决方案

In this answer: How to select option in drop down protractorjs e2e tests

They use this: .sendKeys(protractor.Key.ARROW_DOWN); for sending DOWN arrows.

It worth a try.

更多推荐

设置使用量角器的角度模式

本文发布于:2023-11-23 03:35:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1619937.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:量角器   角度   模式

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!