How to use the @open-wc/testing-helpers/index-no-side-effects.js.elementUpdated function in @open-wc/testing-helpers

To help you get started, we’ve selected a few @open-wc/testing-helpers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github open-wc / open-wc / packages / demoing-storybook / src / withWebComponentsKnobs.js View on Github external
wcTags.forEach((el, elIndex) => {
      const metaData = customElements.tags.find(tag => tag.name.toUpperCase() === el.tagName);
      elementUpdated(el).then(() => {
        if (metaData && metaData.properties) {
          propertiesToKnobs({ el, elIndex, metaData, hasMultiple, filterProperties });
        }
        if (!filterProperties && metaData && metaData.cssProperties) {
          cssPropertiesToKnobs(el, elIndex, metaData.cssProperties, hasMultiple);
        }
      });

      if (metaData) {
        const defaultEventNames = ['click', 'focusin', 'focusout', 'keyup'];
        const userEventNames = metaData.events ? metaData.events.map(item => item.name) : [];
        const uniqueEventNames = [...new Set([...defaultEventNames, ...userEventNames])];
        uniqueEventNames.forEach(evName => {
          el.addEventListener(evName, () => {
            syncElToKnobs(el, elIndex, metaData, hasMultiple, filterProperties);
          });