trap in testing angular observable

https://medium.com/angular-in-depth/how-to-test-observables-a00038c7faad

excerpt:

The “subscribe and assert pattern” has the following downsides

  • You need to remind yourself always to call the done callback

    1. Don’t forget to call “done” when you’re done ☝️

    Often, tests which use the “subscribe and assert pattern” are green even though, in reality, they are failing. How come? 🤔

    In asynchronous scenarios, our test rushes through without also checking our assertions inside our nextcomplete or error handler. This can quickly happen if we forget to call the done callback after the assertions.

    The done callback is a way to indicate to the testing framework when our test is actually done.

    remarks: forgetting about “done” is elusive because this test passed when it actually failed. However, the karma will return and show you some other test failed if you run ng test. but the other test is actually passing. ng test is not good at reporting precisely.

HostBindings

https://www.thecodecampus.de/blog/angular-2-use-hostbindings-set-class/
And I played a little bit with it in the sandbox,  it seems it can not only bind to class (class itself is just an attr) but also can bind a boolean value to a specific class as a switch.  And it can bind to any customized attribute.
https://stackblitz.com/edit/angular-playground-325-fn6rkg?file=app%2Fbox%2Fbox.component.ts

in case forget about the syntax of using ampersand (&) in pseudo-class :host in sass/scss
here is the reference:
https://css-tricks.com/the-sass-ampersand/

Angular observable tricks

https://medium.com/@luukgruijs/understanding-hot-vs-cold-observables-62d04cf92e03

这篇文章举例说明了hot and cold  observables的区别,简单来说,observable is the bridge between producer and observer.

producer outside is hot,

producer inside is cold.

另外,当一个component 中有多个observable 的不同订阅时,如果订阅回调里涉及到UI  binding, 有时这些binding有依赖性。这时可以依靠delay()来控制先后顺序。