From 95dff460b06324e63e1d2ccdffded77d91b957fc Mon Sep 17 00:00:00 2001 From: EricMoin Date: Thu, 12 Nov 2026 19:07:49 +0800 Subject: [PATCH] fix(remote-connection): cover cancelled login responses and honor theme rules --- .../client/RemoteConnectionSection.module.css | 1 - .../tests/login-page.client.spec.ts | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/client/remote-connection/src/client/RemoteConnectionSection.module.css b/packages/client/remote-connection/src/client/RemoteConnectionSection.module.css index ad60862435..27359afc11 100644 --- a/packages/client/remote-connection/src/client/RemoteConnectionSection.module.css +++ b/packages/client/remote-connection/src/client/RemoteConnectionSection.module.css @@ -89,7 +89,6 @@ height: auto; aspect-ratio: 1 / 1; border-radius: var(--dsw-radius-md); - background: var(--dsw-static-neutral-00); } .field { diff --git a/packages/client/remote-connection/tests/login-page.client.spec.ts b/packages/client/remote-connection/tests/login-page.client.spec.ts index 569399d145..d0e9cbd51f 100644 --- a/packages/client/remote-connection/tests/login-page.client.spec.ts +++ b/packages/client/remote-connection/tests/login-page.client.spec.ts @@ -178,6 +178,24 @@ it('aborts each in-flight Token request when the page leaves, including after a expect(fixture.replace).not.toHaveBeenCalled() }) +it('does not navigate when a completed Token request settles after the page leaves', async () => { + const fixture = authenticationPage() + const pending = Promise.withResolvers() + fixture.exchange.mockReturnValue(pending.promise) + enterAuthenticationPage(loginLocales) + fixture.input.value = TOKEN + fixture.form.dispatchEvent(new Event('submit', { cancelable: true })) + const signal = fixture.exchange.mock.calls[0]![1]?.signal + expect(signal?.aborted).toBe(false) + pending.resolve(new Response(null, { status: 200 })) + window.dispatchEvent(new Event('pagehide')) + expect(signal?.aborted).toBe(true) + await expect.poll(() => fixture.submit.disabled).toBe(false) + expect(fixture.form.hasAttribute('aria-busy')).toBe(false) + expect(fixture.error.textContent).toBe('') + expect(fixture.replace).not.toHaveBeenCalled() +}) + it.each(['', '#short', `#${'a'.repeat(42)}!`])('removes an invalid fragment without sending a login request: %s', (fragment) => { const fixture = page(`/remote-login${fragment}`) enterBrowser(loginLocales)