Skip to content

Commit

Permalink
fix: enable button when container port is set
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe Martin <[email protected]>
  • Loading branch information
feloy committed Jun 19, 2024
1 parent 346d12b commit 9e52ab4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
12 changes: 1 addition & 11 deletions packages/frontend/src/pages/CreateService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/pages/CreateService.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
</Button>
Expand Down

0 comments on commit 9e52ab4

Please sign in to comment.