Skip to content

Commit

Permalink
fix(push-manifest): terminal overflow (podman-desktop#10527)
Browse files Browse the repository at this point in the history
* fix(push-manifest): terminal overflow

Signed-off-by: axel7083 <[email protected]>

* chore(push-manifest): remove useless width classes

Signed-off-by: axel7083 <[email protected]>

* chore(push-manifest-test): remove useless mock

Signed-off-by: axel7083 <[email protected]>

---------

Signed-off-by: axel7083 <[email protected]>
  • Loading branch information
axel7083 authored Jan 6, 2025
1 parent 58471a4 commit 7cbea9e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
29 changes: 13 additions & 16 deletions packages/renderer/src/lib/image/PushManifestModal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,10 @@ vi.mock('@xterm/xterm', () => {
};
});

const getConfigurationValueMock = vi.fn();
const pushManifestMock = vi.fn();

beforeAll(() => {
(window.events as unknown) = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
receive: (_channel: string, func: any) => {
func();
},
};
(window as any).ResizeObserver = vi.fn().mockReturnValue({ observe: vi.fn(), unobserve: vi.fn() });
(window as any).getImageInspect = vi.fn().mockImplementation(() => Promise.resolve({}));
(window as any).logsContainer = vi.fn().mockResolvedValue(undefined);
(window as any).refreshTerminal = vi.fn();
(window as any).getConfigurationValue = getConfigurationValueMock;
(window as any).showMessageBox = vi.fn();
(window as any).pushManifest = pushManifestMock;
Object.defineProperty(window, 'dispatchEvent', {
value: vi.fn(),
});
});

const fakedManifest: ImageInfoUI = {
Expand Down Expand Up @@ -95,4 +82,14 @@ test('Expect to render PushManifestModal correctly with Push manifest button', a

// Be able to click it
fireEvent.click(pushButton);

// expect resize event to be dispatched
const event: Event = await vi.waitFor(() => {
expect(window.dispatchEvent).toHaveBeenCalled();
const calls = vi.mocked(window.dispatchEvent).mock.calls;
expect(calls).toHaveLength(1);
expect(calls[0][0]).toBeInstanceOf(Event);
return calls[0][0];
});
expect(event.type).toBe('resize');
});
5 changes: 3 additions & 2 deletions packages/renderer/src/lib/image/PushManifestModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ let logsPush: Terminal;
async function pushManifest() {
initTerminal = true;
await tick();
window.dispatchEvent(new Event('resize'));
logsPush?.reset();
pushInProgress = true;
Expand Down Expand Up @@ -58,8 +59,8 @@ async function pushManifestFinished() {
{/if}
</p>
{/if}
<div hidden={initTerminal === false}>
<TerminalWindow bind:terminal={logsPush} disableStdIn />
<div class="h-[185px]" hidden={initTerminal === false}>
<TerminalWindow class="h-full" bind:terminal={logsPush} disableStdIn />
</div>
</div>

Expand Down

0 comments on commit 7cbea9e

Please sign in to comment.