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

javascript - Confirm a form & display message if form is valid with JQuery -

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

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -