Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unit testing 如何测试指令在ng repeat中包含哪个ng模板_Unit Testing_Angularjs_Angularjs Directive - Fatal编程技术网

Unit testing 如何测试指令在ng repeat中包含哪个ng模板

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

我写指令。在模板中,我在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 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项。 任何人都可以帮助我

来自:

查找-仅限于按标记名查找