Skip to content

Commit f810407

Browse files
twmbclaude
andcommitted
test(frontend): cover escapeLatin1 round-trip in KowlJsonView
Lock in the regression fix from #2421: with escapeLatin1, Latin-1 glyphs are written as \u00XX in the editor value (recoverable via copy-paste); without it, the glyph passes through. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 45aa8d2 commit f810407

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

frontend/src/components/misc/kowl-json-view.test.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,24 @@ describe('KowlJsonView', () => {
161161

162162
expect(editorLayoutSpy).toHaveBeenLastCalledWith({ width: 800, height: 480 });
163163
});
164+
165+
test('escapeLatin1 re-escapes Latin-1 code points so copy-paste recovers the original byte', async () => {
166+
render(<KowlJsonView escapeLatin1 srcObj={{ v: 'ÛN' }} />);
167+
168+
await waitFor(() => {
169+
const value = editorPropsSpy.mock.lastCall?.[0].value as string;
170+
expect(value).toContain('\\u00db');
171+
expect(value).not.toContain('Û');
172+
});
173+
});
174+
175+
test('without escapeLatin1, Latin-1 glyphs pass through to the editor unchanged', async () => {
176+
render(<KowlJsonView srcObj={{ v: 'ÛN' }} />);
177+
178+
await waitFor(() => {
179+
const value = editorPropsSpy.mock.lastCall?.[0].value as string;
180+
expect(value).toContain('Û');
181+
expect(value).not.toContain('\\u00db');
182+
});
183+
});
164184
});

0 commit comments

Comments
 (0)