Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stencil.js expect(element).toHaveClass('hydrated') ... what does this mean

In the "my-component.e2e.ts" test class created by Stencil.js "npm init stencil" we have a line

expect(element).toHaveClass('hydrated');

I can guess what 'hydrated' means, but I cannot find any documentation for it or why I have to test for it. Can anyone point me to the documentation that explains this or explain it here?

like image 322
Safa Alai Avatar asked Oct 24 '25 17:10

Safa Alai


1 Answers

Stencil documentation is not very good and not very detailed. There is no description of 'hydrated' class and what is happening before this class is apply. Anyway, component hydration is not term that Stencil introduced. If you want, you can seach more about it in some modern frameworks context (like react of vue).

However in Stencil 'hydrated' class is added when component is mounted correctly (properties are apply, @Methods are created etc). The defaut test you are reffering to is just a way to test if component builds correctly.

like image 67
Kate Avatar answered Oct 26 '25 06:10

Kate



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!