diff --git a/packages/frontend/src/lib/NavPage.spec.ts b/packages/frontend/src/lib/NavPage.spec.ts new file mode 100644 index 000000000..fde5d0da0 --- /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 { render, screen } 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 +}); diff --git a/packages/frontend/src/lib/NavPage.svelte b/packages/frontend/src/lib/NavPage.svelte index a799f104b..04a7a03dd 100644 --- a/packages/frontend/src/lib/NavPage.svelte +++ b/packages/frontend/src/lib/NavPage.svelte @@ -1,10 +1,12 @@ @@ -57,7 +59,11 @@ export let icon: IconDefinition | undefined = undefined;
- + {#if loading} + + {:else} + + {/if}
diff --git a/packages/frontend/src/pages/ModelColumnHW.svelte b/packages/frontend/src/lib/table/model/ModelColumnHW.svelte similarity index 100% rename from packages/frontend/src/pages/ModelColumnHW.svelte rename to packages/frontend/src/lib/table/model/ModelColumnHW.svelte diff --git a/packages/frontend/src/pages/ModelColumnLicense.svelte b/packages/frontend/src/lib/table/model/ModelColumnLicense.svelte similarity index 100% rename from packages/frontend/src/pages/ModelColumnLicense.svelte rename to packages/frontend/src/lib/table/model/ModelColumnLicense.svelte diff --git a/packages/frontend/src/pages/ModelColumnName.svelte b/packages/frontend/src/lib/table/model/ModelColumnName.svelte similarity index 100% rename from packages/frontend/src/pages/ModelColumnName.svelte rename to packages/frontend/src/lib/table/model/ModelColumnName.svelte diff --git a/packages/frontend/src/pages/ModelColumnPopularity.svelte b/packages/frontend/src/lib/table/model/ModelColumnPopularity.svelte similarity index 100% rename from packages/frontend/src/pages/ModelColumnPopularity.svelte rename to packages/frontend/src/lib/table/model/ModelColumnPopularity.svelte diff --git a/packages/frontend/src/pages/ModelColumnRegistry.svelte b/packages/frontend/src/lib/table/model/ModelColumnRegistry.svelte similarity index 100% rename from packages/frontend/src/pages/ModelColumnRegistry.svelte rename to packages/frontend/src/lib/table/model/ModelColumnRegistry.svelte diff --git a/packages/frontend/src/pages/Model.svelte b/packages/frontend/src/pages/Model.svelte index 453a28890..008cdc825 100644 --- a/packages/frontend/src/pages/Model.svelte +++ b/packages/frontend/src/pages/Model.svelte @@ -16,7 +16,7 @@ onMount(async () => { }) - + diff --git a/packages/frontend/src/pages/Models.svelte b/packages/frontend/src/pages/Models.svelte index 613747562..63a69b44d 100644 --- a/packages/frontend/src/pages/Models.svelte +++ b/packages/frontend/src/pages/Models.svelte @@ -4,11 +4,11 @@ import NavPage from '../lib/NavPage.svelte'; import Table from '../lib/table/Table.svelte'; import { Column, Row } from '../lib/table/table'; import { localModels } from '../stores/local-models'; -import ModelColumnName from './ModelColumnName.svelte'; -import ModelColumnRegistry from './ModelColumnRegistry.svelte'; -import ModelColumnPopularity from './ModelColumnPopularity.svelte'; -import ModelColumnLicense from './ModelColumnLicense.svelte'; -import ModelColumnHw from './ModelColumnHW.svelte'; +import ModelColumnName from '../lib/table/model/ModelColumnName.svelte'; +import ModelColumnRegistry from '../lib/table/model/ModelColumnRegistry.svelte'; +import ModelColumnPopularity from '../lib/table/model/ModelColumnPopularity.svelte'; +import ModelColumnLicense from '../lib/table/model/ModelColumnLicense.svelte'; +import ModelColumnHw from '../lib/table/model/ModelColumnHW.svelte'; import { onDestroy, onMount } from 'svelte'; import { studioClient } from '/@/utils/client'; import type { Category } from '@shared/models/ICategory'; @@ -73,12 +73,9 @@ onDestroy(() => { - +
- {#if loading} - - {/if}
{#if !loading} {#if tasks.length > 0} diff --git a/packages/frontend/src/pages/RecipeModels.svelte b/packages/frontend/src/pages/RecipeModels.svelte index a4def8571..effd0e591 100644 --- a/packages/frontend/src/pages/RecipeModels.svelte +++ b/packages/frontend/src/pages/RecipeModels.svelte @@ -2,11 +2,11 @@ import type { ModelInfo } from '@shared/src/models/IModelInfo'; import Table from '../lib/table/Table.svelte'; import { Column, Row } from '../lib/table/table'; - import ModelColumnName from './ModelColumnName.svelte'; - import ModelColumnRegistry from './ModelColumnRegistry.svelte'; - import ModelColumnPopularity from './ModelColumnPopularity.svelte'; - import ModelColumnLicense from './ModelColumnLicense.svelte'; - import ModelColumnHw from './ModelColumnHW.svelte'; + import ModelColumnName from '../lib/table/model/ModelColumnName.svelte'; + import ModelColumnRegistry from '../lib/table/model/ModelColumnRegistry.svelte'; + import ModelColumnPopularity from '../lib/table/model/ModelColumnPopularity.svelte'; + import ModelColumnLicense from '../lib/table/model/ModelColumnLicense.svelte'; + import ModelColumnHw from '../lib/table/model/ModelColumnHW.svelte'; import { onMount } from 'svelte'; import { studioClient } from '../utils/client'; @@ -16,7 +16,7 @@ onMount(async () => { if (modelsIds && modelsIds.length > 0) { models = await studioClient.getModelsByIds(modelsIds); - } + } }) const columns: Column[] = [