Compare commits
2 Commits
c09ca93f4e
...
eafe89b313
| Author | SHA1 | Date | |
|---|---|---|---|
| eafe89b313 | |||
| 724b00d3d5 |
@@ -8,9 +8,9 @@ test.describe('preview text', () => {
|
|||||||
await comparison.pickPair('Inter', 'Roboto');
|
await comparison.pickPair('Inter', 'Roboto');
|
||||||
await comparison.setPreviewText('Sphinx');
|
await comparison.setPreviewText('Sphinx');
|
||||||
|
|
||||||
// Each grapheme renders as a `.char-wrap` cell in the slider once
|
// Window chars render as `.char-wrap` cells for crossfade.
|
||||||
// both fonts are loaded. Six glyphs → six cells.
|
// With WINDOW_SIZE=5, "Sphinx" (6 chars) fits 5 in the window.
|
||||||
await expect(comparison.slider.locator('.char-wrap')).toHaveCount(6);
|
await expect(comparison.slider.locator('.char-wrap')).toHaveCount(5);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('preserves the typed value in the input', async ({ comparison }) => {
|
test('preserves the typed value in the input', async ({ comparison }) => {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
describe,
|
describe,
|
||||||
expect,
|
expect,
|
||||||
it,
|
it,
|
||||||
|
vi,
|
||||||
} from 'vitest';
|
} from 'vitest';
|
||||||
|
|
||||||
// Helper to flush Svelte effects (they run in microtasks)
|
// Helper to flush Svelte effects (they run in microtasks)
|
||||||
@@ -69,12 +70,17 @@ describe('layoutStore', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should default to list mode when localStorage has invalid data', async () => {
|
it('should default to list mode when localStorage has invalid data', async () => {
|
||||||
|
// createPersistentStore logs and swallows the parse error; silence
|
||||||
|
// the expected warn so it doesn't pollute test output, and assert it.
|
||||||
|
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
||||||
localStorage.setItem(STORAGE_KEY, 'invalid json');
|
localStorage.setItem(STORAGE_KEY, 'invalid json');
|
||||||
|
|
||||||
const { LayoutManager } = await import('./layoutStore.svelte');
|
const { LayoutManager } = await import('./layoutStore.svelte');
|
||||||
const manager = new LayoutManager();
|
const manager = new LayoutManager();
|
||||||
|
|
||||||
expect(manager.mode).toBe('list');
|
expect(manager.mode).toBe('list');
|
||||||
|
expect(warnSpy).toHaveBeenCalled();
|
||||||
|
warnSpy.mockRestore();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should default to list mode when localStorage has empty object', async () => {
|
it('should default to list mode when localStorage has empty object', async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user