Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fixture.debugElement.query(By.css('h1'));
- fixture.debugElement.query(By.css('class="name"'))
- By.css('.classname') // get by class name
- By.css('input[type=radio]') // get input by type radio
- By.css('.parent .child') // get child who has a parent
- //typscript syntax
- fixture = TestBed.createComponent(<your component>);
- let result = fixture.nativeElement.querySelector('<id attribute name of html element>');
- expect(result.id).toEqual("id of your DOM element.").
Add Comment
Please, Sign In to add comment