简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM