Unit testing 如何测试指令在ng repeat中包含哪个ng模板
我写指令。在模板中,我在ng重复中使用了ng include:Unit testing 如何测试指令在ng repeat中包含哪个ng模板,unit-testing,angularjs,angularjs-directive,Unit Testing,Angularjs,Angularjs Directive,我写指令。在模板中,我在ng重复中使用了ng include: <div ng-repeat="page in wStepPages" id="step{{$index}}" data-ng-show="getCurrentStep() == $index" ng-include="page.page" class="slide-frame"> </div> 例如,如果my page.page=step1.html: <div> <input
<div ng-repeat="page in wStepPages" id="step{{$index}}" data-ng-show="getCurrentStep() == $index" ng-include="page.page" class="slide-frame">
</div>
例如,如果my page.page=step1.html:
<div>
<input id="name" ng-model="isolate.name">
</div>
在我的测试规范中:
describe("test_wizard",function () {
var scope,doc,elem,compiled,html;
beforeEach(module('App.wizard','app/partials/step1.html','app/partials/step2.html','app/partials/step3.html','app/partials/step4.html'));
beforeEach(function(){
html = '<ov-wizard title="OV_WIZARD" step-pages="stepPages" confirm-bt="confirmbt" data="wizardData"></ov-wizard>';
inject(function($compile, $rootScope){
scope = $rootScope.$new();
elem = angular.element(html);
compiled = $compile(elem);
compiled(scope);
scope.$digest();
})
});
it("do some thing",function(){
expect(elem.find("#name").length).toEqual(1);
});
})
但它返回的是0项。
任何人都可以帮助我 来自:
查找-仅限于按标记名查找