How to write resilient and refactor friendly component test in Angular?

Published: 20 February 2023
on channel: ng-tips
110
4

#component, #angular, #refactorFriendlyTest, #resilientTest

Learn how to write resilient and refactor friendly component test in Angular with code examples.


0:11 Discussion of sample component test taken from official Angular site.
5:05 Component test against the DOM (Document Object Model).
11:18 Make selectors resilient using unique custom or in-built element attributes.
12:31 Make selectors resilient using text content of element without using attributes.


Gist to find the DOM element by the matching text content recursively.

https://gist.github.com/sanjeevsubedi...

I also have a blog post about this.

  / how-to-make-angular-component-test-resilie...  


Angular component test sample code.

https://angular.io/guide/testing-comp...


Watch video How to write resilient and refactor friendly component test in Angular? online without registration, duration hours minute second in high quality. This video was added by user ng-tips 20 February 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 11 once and liked it people.