angular - Angular2 Testing Template Driven Forms disabled attribute -


i have template driven form many inputs following

<input type="text" name="data" [(ngmodel)]="data" [disabled]="disabled" /> 

i want write test ensure inputs disabled when disabled variable set true. below test far. works, there several "disabled" properties on element , element.nativeelement remain false. plus, rendered view in chrome when stopped in debugger doesn't disabled. "ng-reflect-is-disabled" attribute true.

it("should disable inputs when disabled true", () => {     component.disabled = true;     fixture.detectchanges();      inputs = fixture.debugelement.queryall(by.css('input'));     inputs.foreach(element => {         expect(element.attributes["ng-reflect-is-disabled"]).tobe('true');     });    }); 

is there better way can check disabled state of input?


Comments

Popular posts from this blog

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -

c# - Populating Gridview inside Listview ItemTemplate On Web User Control from Code Behind -