为什么模板不在测试中编译?

时间:2018-05-19 19:52:26

标签: angularjs unit-testing karma-runner

我写了spec for my controller。 Angular模块ngCountdownRibbon有一个逻辑,用于向文档正文添加带计数器的功能区。在getRibbonDate函数中,我想访问这个计算值并在test中检查它们(html元素的innerText)。但不知怎的,当我试图获得它时,它没有被编译。我如何才能使这个规范有效?

所需行为

文档正文中附加的编译代码应为:

  <a ng-href="http://amzn.com/w/ZWFNUL8AGNLP" class="ribbon-container ng-scope" 
     target="_blank" href="http://amzn.com/w/ZWFNUL8AGNLP">
    <span class="ribbon ribbon_left" ng-class="ngCountdownRibbon.ribbonClass"> 
      <span>
        <ng-pluralize
            count="ngCountdownRibbon.ribbonDays"
            when="{'0': 'Event has come', 'one': '1 day left', 'other': '{} days left'}"
            <="" 
            ng-pluralize="">1 day left
        </ng-pluralize>
      </span>
    </span>
  </a>

我现在在编译代码中获得了什么

LOG:
 <a ng-href="{{ngCountdownRibbon.ribbonLink}}" class="ribbon-container ng-scope" 
       target="_blank">
    <span class="ribbon" ng-class="ngCountdownRibbon.ribbonClass">
      <span>
        <ng-pluralize
          count="ngCountdownRibbon.ribbonDays"
          when="{'0': 'Event has come', 'one': '1 day left', 'other': '{} days left'}"
          <="" ng-pluralize="">
        </ng-pluralize>
      </span>
    </span>
</a>

最简单的重现方法是分叉repo并运行&nbsp; npm test&#39;来自分支init-tests的命令

0 个答案:

没有答案