mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-08 16:39:42 +02:00
test(cjk): update the mobile server-override test for the welcome-screen gate
The PR gates CJK textarea visibility on an active session (`showCjk = cjkUserEnabled && !!activeSessionId`) so the fixed-position textarea no longer floats over the welcome overlay. That intentionally changes the behavior the existing `shows the CJK textarea on mobile only for server override` test asserted — it set `_serverCjkOverride = true` on a fresh page (no active session) and expected the textarea visible, which now (correctly) resolves to hidden. The test lives in test/mobile/** (excluded from CI), so it wasn't caught by the PR's green CI. Update the test to verify the new, intended behavior: with the server override on it stays hidden on the welcome screen (no active session) and is revealed once a session is active. This is a co-authored review fix; the original change is TeigenZhang's. Verified: tsc, check:frontend-syntax, check:public-assets, prettier all clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -528,15 +528,24 @@ describe('Virtual Keyboard', () => {
|
|||||||
expect(afterEnter.sentInputs).toEqual(['hello', '\r']);
|
expect(afterEnter.sentInputs).toEqual(['hello', '\r']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows the CJK textarea on mobile only for server override', async () => {
|
it('shows the CJK textarea on mobile for server override only inside an active session', async () => {
|
||||||
const state = await page.evaluate(() => {
|
const state = await page.evaluate(() => {
|
||||||
app._serverCjkOverride = true;
|
|
||||||
app._updateCjkInputState();
|
|
||||||
|
|
||||||
const input = document.getElementById('cjkInput');
|
const input = document.getElementById('cjkInput');
|
||||||
if (!(input instanceof HTMLElement)) return null;
|
if (!(input instanceof HTMLElement)) return null;
|
||||||
|
|
||||||
|
// Welcome screen (no active session): even with the server override on, the
|
||||||
|
// fixed-position textarea must stay hidden so it doesn't float over the overlay.
|
||||||
|
app.activeSessionId = null;
|
||||||
|
app._serverCjkOverride = true;
|
||||||
|
app._updateCjkInputState();
|
||||||
|
const onWelcomeDisplay = getComputedStyle(input).display;
|
||||||
|
|
||||||
|
// Entering a session reveals it.
|
||||||
|
app.activeSessionId = 'cjk-server-override-test';
|
||||||
|
app._updateCjkInputState();
|
||||||
const cs = getComputedStyle(input);
|
const cs = getComputedStyle(input);
|
||||||
return {
|
return {
|
||||||
|
onWelcomeDisplay,
|
||||||
display: cs.display,
|
display: cs.display,
|
||||||
position: cs.position,
|
position: cs.position,
|
||||||
bottom: cs.bottom,
|
bottom: cs.bottom,
|
||||||
@@ -546,6 +555,7 @@ describe('Virtual Keyboard', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(state).not.toBeNull();
|
expect(state).not.toBeNull();
|
||||||
|
expect(state?.onWelcomeDisplay).toBe('none');
|
||||||
expect(state?.display).not.toBe('none');
|
expect(state?.display).not.toBe('none');
|
||||||
expect(state?.position).toBe('fixed');
|
expect(state?.position).toBe('fixed');
|
||||||
expect(Number(state?.zIndex)).toBeGreaterThan(50);
|
expect(Number(state?.zIndex)).toBeGreaterThan(50);
|
||||||
|
|||||||
Reference in New Issue
Block a user