Palette
    Preparing search index...

    Function renderTestComponent

    • Render a Palette Component class as a test element

      If the class is not yet registered, it is auto-registered before creation.

      Type Parameters

      Parameters

      • component: E

        The component class to register and create

      • Optionalattributes: Record<string, string | null>

        A record of attributes to apply

      Returns Promise<InstanceType<E>>

      A reference to the rendered Component

      test("component does something", async () => {
      let somethingMock = mock();

      class MyTestComponent extends Component {
      script() {
      somethingMock();
      }
      }

      await renderTestComponent(MyTestComponent);
      expect(somethingMock).toHaveBeenCalled();
      });