小编Jav*_*ior的帖子

使用UnderscoreJS为AngularJS编写测试

我开始学习如何测试Angular应用程序,并遇到了一些问题.

我使用Yeoman生成了一个Angular应用程序. yo angular --minsafe AppName

然后生成一个服务 yo angular:service MyService

在服务中写了一个简单的方法,并测试它,只是为了确保一切正常.我跑grunt test了,测试通过了.

现在它变得有趣了,因为我在混音中bower install underscore加入了<script>Underscore并在其中添加了一个标签index.html.然后我在服务方法中添加了一些简单的代码,只是_.map([1,2,3], function(el){return el+1});为了看看Underscore是否正常工作.

我再次进行了测试grunt test,并没有说出来_ is not defined.

我认为,因为Underscore将_变量附加到窗口对象,它将可用于测试.我错了吗?

此外,当我在浏览器中运行应用程序时,Underscore已定义并正常工作.

所以,我的问题是,你如何测试使用Underscore的Angular应用程序?这是一个常见问题还是我做错了什么?

谢谢,Petar

unit-testing underscore.js angularjs gruntjs karma-runner

8
推荐指数
1
解决办法
2095
查看次数

在WebView中禁用div上的橙色突出显示

我正在制作PhoneGap Android应用程序,并且无法关闭橙色突出显示可点击元素.

我已经尝试了CSS的所有组合:-webkit-tap-highlight-color,-webkit-focus-ring-color和-webkit-user-modify,如

禁用焦点上的橙色轮廓高亮
在Android中的链接周围禁用橙色高亮显示

这是我拥有的,它没有做任何事情:

`* {  
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0) !important;   
    -webkit-focus-ring-color: rgba(255, 255, 255, 0) !important;  
    outline: none !important;  
    -webkit-user-modify: read-write-plaintext-only !important;  
    -webkit-touch-callout: none;
    -webkit-user-select: none;
}`
Run Code Online (Sandbox Code Playgroud)

我正在使用Phonegap 2.9.0和Android 4.1.2,以及来自这里的Calendario插件:http://tympanus.net/codrops/2012/11/27/calendario-a-flexible-calendar-plugin/

是否有希望禁用这种难看的有机物呢?

css android webview cordova

2
推荐指数
1
解决办法
3864
查看次数