Skip to content

Commit f236fda

Browse files
committed
test: add multi-theme with two TextMate theme objects test
Verifies that isTextmateTheme fix properly validates multi-theme configs where both values are TextMate theme objects (not strings).
1 parent c1078c7 commit f236fda

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

package/tests/hook.test.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,39 @@ describe('useShikiHighlighter Hook', () => {
344344
expect(style).not.toContain('--shiki-dark');
345345
});
346346
});
347+
348+
test('multi-theme with two TextMate theme objects works', async () => {
349+
const code = 'const x = 1;';
350+
// Both values are TextMate theme objects (no strings)
351+
const lightTheme = {
352+
name: 'test-light',
353+
tokenColors: [
354+
{ scope: 'keyword', settings: { foreground: '#ff0000' } },
355+
],
356+
};
357+
const darkTheme = {
358+
name: 'test-dark',
359+
tokenColors: [
360+
{ scope: 'keyword', settings: { foreground: '#00ff00' } },
361+
],
362+
};
363+
const themes = { light: lightTheme, dark: darkTheme };
364+
365+
const { getByTestId } = renderComponent({
366+
code,
367+
language: 'javascript',
368+
theme: themes,
369+
});
370+
371+
await waitFor(() => {
372+
const container = getByTestId('highlighted');
373+
const pre = container.querySelector('pre');
374+
// Should have multi-theme CSS variables
375+
const spans = container.querySelectorAll('span[style*="--shiki-"]');
376+
expect(spans.length).toBeGreaterThan(0);
377+
expect(pre).toBeInTheDocument();
378+
});
379+
});
347380
});
348381

349382
describe('Rendering Options', () => {

0 commit comments

Comments
 (0)