feat(client): save challenge layout in local storage (again) (#55621)

This commit is contained in:
Oliver Eyton-Williams
2024-07-25 17:45:03 +02:00
committed by GitHub
parent 0eebe3ee2e
commit cda00d4770
3 changed files with 60 additions and 27 deletions

View File

@@ -42,4 +42,34 @@ test.describe('MultifileEditor Component', () => {
index++;
}
});
test('Reloading should preserve the editor layout', async ({
page,
isMobile
}) => {
test.skip(
isMobile,
'The mobile layout does not have resizable panes, so this test is not applicable.'
);
const desktopLayout = page.getByTestId('desktop-layout');
const splitter = desktopLayout.getByTestId('preview-left-splitter');
const editorPane = desktopLayout.getByTestId('editor-pane');
const initialStyle = await editorPane.getAttribute('style');
expect(initialStyle).toContain('flex: 1');
// Drag the splitter to resize the editor pane
await splitter.hover();
await page.mouse.down();
await page.mouse.move(100, 100);
await page.mouse.up();
const newStyle = await editorPane.getAttribute('style');
// It doesn't matter where it's dragged to, just that it's different:
expect(newStyle).not.toContain('flex: 1');
await page.reload();
expect(await editorPane.getAttribute('style')).toBe(newStyle);
});
});