Skip to content

Commit

Permalink
fix: add back 'Done' text on the button
Browse files Browse the repository at this point in the history
fixes podman-desktop#3251
Signed-off-by: Florent Benoit <[email protected]>
  • Loading branch information
benoitf committed Aug 10, 2023
1 parent 35f3af6 commit f75dc3f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
30 changes: 30 additions & 0 deletions packages/renderer/src/lib/kube/KubePlayYAML.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,33 @@ test('error: When pressing the Play button, expect us to show the errors to the
const error = screen.getByText('The following pods were created but failed to start: error 1, error 2');
expect(error).toBeInTheDocument();
});

test('expect done button is there at the end', async () => {
(window as any).playKube = vi.fn().mockResolvedValue({
Pods: [],
});

// Render the component
setup();
render(KubePlayYAML, {});

// Simulate selecting a file
const fileInput = screen.getByRole('textbox', { name: 'Kubernetes YAML file' });
expect(fileInput).toBeInTheDocument();
await userEvent.click(fileInput);

// Simulate selecting a runtime
const runtimeOption = screen.getByText('Using a Podman container engine');
expect(runtimeOption).toBeInTheDocument();

// Simulate clicking the "Play" button
const playButton = screen.getByRole('button', { name: 'Play' });
expect(playButton).toBeInTheDocument();
await userEvent.click(playButton);

// search the done button
const doneButton = screen.getByRole('button', { name: 'Done' });
expect(doneButton).toBeInTheDocument();
// check that text value is also 'Done'
expect(doneButton).toHaveTextContent('Done');
});
2 changes: 1 addition & 1 deletion packages/renderer/src/lib/kube/KubePlayYAML.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ async function getKubernetesfileLocation() {
{/if}

{#if runFinished}
<Button on:click="{() => goBackToHistory()}" class="pt-4 w-full" title="Done" type="primary" />
<Button on:click="{() => goBackToHistory()}" class="pt-4 w-full">Done</Button>
{/if}
</div>
</div>
Expand Down

0 comments on commit f75dc3f

Please sign in to comment.