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

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -