Guest User

Untitled

a guest
May 23rd, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. fixture.debugElement.query(By.css('h1'));
  2.  
  3. fixture.debugElement.query(By.css('class="name"'))
  4.  
  5. By.css('.classname') // get by class name
  6. By.css('input[type=radio]') // get input by type radio
  7. By.css('.parent .child') // get child who has a parent
  8.  
  9. //typscript syntax
  10.  
  11. fixture = TestBed.createComponent(<your component>);
  12.  
  13. let result = fixture.nativeElement.querySelector('<id attribute name of html element>');
  14.  
  15. expect(result.id).toEqual("id of your DOM element.").
Add Comment
Please, Sign In to add comment