Skip to content

v0.3.0

Choose a tag to compare

@github-actions github-actions released this 15 Jan 10:25
· 21 commits to main since this release
a05738b

Minor Changes

  • ✨ renamed RenderConfig type to ComponentRenderOptions (by @shairez in #18)

    RenderConfig is now deprecated and will be removed in a future version. Use ComponentRenderOptions instead.`

  • ✨ return container element (by @shairez in #18)

    Now you can access the component's host element via the container property.
    This is basically a shortcut for fixture.nativeElement.

    test('renders component with service provider', async () => {
      const { container, fixture } = await render(HelloWorldComponent);
    
      expect(container).toBe(fixture.nativeElement);
    });
  • ✨ decorated render result with element locators (which start with the baseElement) (by @shairez in #18)

    Now you can do this:

    test('renders component with service provider', async () => {
      const screen = await render(HelloWorldComponent);
      await expect.element(screen.getByText('Hello World')).toBeVisible(); // uses the baseElement as the root element for the query selector
    });
  • ✨ add baseElement (by @shairez in #18)

    Now default locators will be based on the baseElement instead of the component element.
    This helps with testing components which project to a portal.

  • ✨ renamed component to locator to match other vitest-browser libraries api (by @shairez in #18)

    component is now deprecated and will be removed in a future version. Use locator instead.