add tests for preview

This commit is contained in:
2024-10-17 11:49:22 -05:00
parent 29a5c22b22
commit 23655f71d3
2 changed files with 30 additions and 1 deletions

View File

@@ -13,3 +13,23 @@ test('nav items work', async ({ page }) => {
await expect(page.getByTestId(`${await tab.textContent()}-pane`)).toBeVisible();
}
});
test('preview accepts content', async ({ page }) => {
await page.goto('/');
await page.getByText('content').click();
await page.getByRole('textbox').fill('# résumé');
const previewFrame = page.getByTitle('résumé preview').contentFrame();
await expect(previewFrame.getByRole('heading')).toHaveText('résumé');
});
test('preview accepts styles', async ({ page }) => {
await page.goto('/');
await page.getByText('content').click();
await page.getByRole('textbox').fill('# blah');
await page.getByText('style', { exact: true }).click();
await page.getByRole('textbox').fill('h1 { color: red; }');
const previewFrame = page.getByTitle('résumé preview').contentFrame();
await expect(previewFrame.getByRole('heading')).toHaveCSS('color', 'rgb(255, 0, 0)');
});