v0.3.0
Minor Changes
-
✨ renamed
RenderConfigtype toComponentRenderOptions(by @shairez in #18)RenderConfigis now deprecated and will be removed in a future version. UseComponentRenderOptionsinstead.` -
✨ return
containerelement (by @shairez in #18)Now you can access the component's host element via the
containerproperty.
This is basically a shortcut forfixture.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
baseElementinstead of the component element.
This helps with testing components which project to a portal. -
✨ renamed
componenttolocatorto match other vitest-browser libraries api (by @shairez in #18)componentis now deprecated and will be removed in a future version. Uselocatorinstead.