alexlafroscia / ember-cli-stencil

Automatic discovery of Stencil.js components for your Ember application
26 stars 7 forks source link

Test support for waiting on property or attribute changes #52

Open nwhittaker opened 2 years ago

nwhittaker commented 2 years ago

When programmatically changing a Stencil element's properties or attributes, the change is propagated asynchronously. In a test environment, it's typical to set a property or attribute on an element and then verify some change occurred. However, with a stencil component, it's difficult to reliably determine when it's safe to inspect the element for the changed behavior.

Stencil's own testing tools provide ways to wait for property/attribute changes to take effect:

I tried awaiting on nextRAF(), but that didn't seem to guarantee anything about the state of the stencil element and still lead to random failures.

This latency has been a significant point of pain for writing tests. Is it possible to get a test helper, or something, that provides a way to wait for property and attribute changes to take effect?