Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/32.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
Angular 如何检查角度中的占位符内容?_Angular_Typescript_Testing - Fatal编程技术网

Angular 如何检查角度中的占位符内容?

Angular 如何检查角度中的占位符内容?,angular,typescript,testing,Angular,Typescript,Testing,我有以下html代码: <input formControlName="firstName" type="text" class="form-control" placeholder="Please enter the First Name"> </div> 您可以使用getAttribute() 使用.placeholder(如果需要键入,可能需要转换为HTMLInp

我有以下html代码:

 <input formControlName="firstName"  type="text" class="form-control"
      placeholder="Please enter the First Name">
  </div>

您可以使用
getAttribute()


使用
.placeholder
(如果需要键入,可能需要转换为
HTMLInputElement
)。
 expect(fixture.nativeElement.querySelector('input[formcontrolname="firstName"]').value)
.toContain("John");
expect(element.getAttribute("placeholder")).toEqual("Please enter the First Name")