From 201429883fa2322504d0ac73162ed046c8c67344 Mon Sep 17 00:00:00 2001 From: axel7083 <42176370+axel7083@users.noreply.github.com> Date: Wed, 17 Jan 2024 17:18:55 +0100 Subject: [PATCH] test: ensuring progress is displayed when loading is true --- packages/frontend/src/lib/NavPage.spec.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 packages/frontend/src/lib/NavPage.spec.ts diff --git a/packages/frontend/src/lib/NavPage.spec.ts b/packages/frontend/src/lib/NavPage.spec.ts new file mode 100644 index 000000000..dce409e37 --- /dev/null +++ b/packages/frontend/src/lib/NavPage.spec.ts @@ -0,0 +1,22 @@ +import '@testing-library/jest-dom/vitest'; +import { test, expect } from 'vitest'; +import { fireEvent, render, screen, within } from '@testing-library/svelte'; +import NavPage from '/@/lib/NavPage.svelte'; + +test('NavPage should have linear progress', async () => { + // render the component + render(NavPage, {loading: true, title: 'dummy'}); + + const content = await screen.findByLabelText('content'); + expect(content).toBeDefined(); + expect(content.firstChild?.nodeName).toBe('PROGRESS'); +}); + +test('NavPage should not have linear progress', async () => { + // render the component + render(NavPage, {title: 'dummy'},); + + const content = await screen.findByLabelText('content'); + expect(content).toBeDefined(); + expect(content.firstChild).toBeNull(); // no slot content provided +});