Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.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
Javascript 无法调用$scope.form.$jasmine测试中提交的:未定义_Javascript_Angularjs_Unit Testing_Angularjs Directive_Jasmine - Fatal编程技术网

Javascript 无法调用$scope.form.$jasmine测试中提交的:未定义

Javascript 无法调用$scope.form.$jasmine测试中提交的:未定义,javascript,angularjs,unit-testing,angularjs-directive,jasmine,Javascript,Angularjs,Unit Testing,Angularjs Directive,Jasmine,Angularjs 1.3.0-beta.8 我正在尝试测试是否提交了表单 这是测试 it ('should submit when I TELL IT TO DO SO!!!', function(){ element.find('button').trigger('click'); // form button that calls submit funtion expect( element.isolateScope().validationFieldsForm.$valid ).

Angularjs 1.3.0-beta.8

我正在尝试测试是否提交了表单

这是测试

it ('should submit when I TELL IT TO DO SO!!!', function(){
  element.find('button').trigger('click'); // form button that calls submit funtion
  expect( element.isolateScope().validationFieldsForm.$valid ).toBe( true );
});
上述测试工作正常。我有权使用$valid。然而,当我再次运行相同的测试,但像这样修改

it ('should submit when I TELL IT TO DO SO!!!', function(){
  element.find('button').trigger('click'); // form button that calls submit funtion
  expect( element.isolateScope().validationFieldsForm.$submitted ).toBe( true );
});
上述测试将导致“未定义”。事实上,如果我在指令中调用$scope.myFormName.$submitted,这也不起作用,但是$error、$valid、$invalid、$setValidity等等。。。所有的工作

Angularjs说$submitted应该在表单控件对象中可用


您使用的版本中似乎不存在
$submitted
。看。这是用

添加的,您是对的!我使用了两个不同版本的分支,混淆了我的选项。谢谢你的提醒。我的头很痛。。。