From 9e52ab45001169ca70785dc8a343231d2216a710 Mon Sep 17 00:00:00 2001 From: Philippe Martin Date: Wed, 19 Jun 2024 13:52:21 +0200 Subject: [PATCH] fix: enable button when container port is set Signed-off-by: Philippe Martin --- packages/frontend/src/pages/CreateService.spec.ts | 12 +----------- packages/frontend/src/pages/CreateService.svelte | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/packages/frontend/src/pages/CreateService.spec.ts b/packages/frontend/src/pages/CreateService.spec.ts index 791d5cb64..f2c1aa4bb 100644 --- a/packages/frontend/src/pages/CreateService.spec.ts +++ b/packages/frontend/src/pages/CreateService.spec.ts @@ -124,23 +124,13 @@ test('expect error message to be hidden when models locally', () => { test('button click should call createInferenceServer', async () => { mocks.modelsInfoSubscribeMock.mockReturnValue([{ id: 'random', file: true }]); - let onMountDone = false; - vi.spyOn(mocks.tasksQueriesMock, 'subscribe').mockImplementation((_f: (tasks: Task[]) => void) => { - onMountDone = true; - return () => {}; - }); - render(CreateService); - // wait for onMount to be called - await vi.waitFor(() => { - expect(onMountDone).toBeTruthy(); - }); - let createBtn: HTMLElement | undefined = undefined; await vi.waitFor(() => { createBtn = screen.getByTitle('Create service'); expect(createBtn).toBeDefined(); + expect(createBtn).toBeEnabled(); }); if (createBtn === undefined) throw new Error('createBtn undefined'); diff --git a/packages/frontend/src/pages/CreateService.svelte b/packages/frontend/src/pages/CreateService.svelte index a0ac449e1..582285f39 100644 --- a/packages/frontend/src/pages/CreateService.svelte +++ b/packages/frontend/src/pages/CreateService.svelte @@ -210,7 +210,7 @@ export function goToUpPage(): void { title="Create service" inProgress="{loading}" on:click="{submit}" - disabled="{!modelId}" + disabled="{!modelId || !containerPort}" icon="{faPlusCircle}"> Create service