【问题标题】:How can I manually test AngularJS directives and Jasmine tests written in CoffeeScript?如何手动测试用 CoffeeScript 编写的 AngularJS 指令和 Jasmine 测试?
【发布时间】:2015-01-20 20:54:09
【问题描述】:

我正在编写一个 Ruby gem,其中提供了许多角度指令。

使用以下文件夹结构编写指令,例如

app
 - assets
   - javascripts
     - components
        - dropdown
          - dropdown.html
          - dropdown.service.coffee
          - index.coffee (this has directive code)
spec
 - javascripts
   - dropdown
     - dropdown.service_spec.coffee (jasmine test)

既然这是一个宝石,我想保留它而不是让它成为一个 Rails 应用程序。这将使人们更难将其用作宝石

但我希望能够测试指令。我不能自动这样做。

我想知道如何通过启动 HTML 页面在本地/手动运行这些用咖啡脚本编写的 Jasmine 测试?

【问题讨论】:

    标签: angularjs unit-testing coffeescript rubygems jasmine


    【解决方案1】:

    您需要创建一个 HTML 文件来添加您的文件、jasmine 并运行测试。

    您可以使用众多现有样板之一,而不是自己这样做:

    https://github.com/andrewvida/coffeescript-jasmine-boilerplate

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-01-23
      • 2013-08-25
      • 1970-01-01
      • 2012-06-14
      • 2014-09-15
      • 2015-01-09
      • 2011-12-20
      • 2016-09-16
      相关资源
      最近更新 更多