mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-09 21:25:45 +08:00
feat(editor): by default render code iframe for html preview (#12848)
#### PR Dependency Tree * **PR #12848** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a feature flag to enable or disable web container functionality for code block previews. - **Improvements** - Code block HTML previews now support an alternative rendering method based on the new feature flag, enhancing flexibility. - **Chores** - Updated feature flag settings by removing an obsolete flag and adding the new web container flag. - **Tests** - Simplified code block preview tests for faster and more direct validation of HTML preview content. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -22,16 +22,12 @@ test.describe('Code Block Autocomplete Operations', () => {
|
||||
test.describe('Code Block Preview', () => {
|
||||
test('enable html preview', async ({ page }) => {
|
||||
const code = page.locator('affine-code');
|
||||
const htmlPreview = page.locator('html-preview');
|
||||
|
||||
await openHomePage(page);
|
||||
await createNewPage(page);
|
||||
await waitForEditorLoad(page);
|
||||
await gotoContentFromTitle(page);
|
||||
await type(page, '```html aaa');
|
||||
await page.waitForTimeout(3000);
|
||||
// web container can not load as expected at the first time in playwright, not sure why
|
||||
await page.reload();
|
||||
await code.hover({
|
||||
position: {
|
||||
x: 155,
|
||||
@@ -39,15 +35,6 @@ test.describe('Code Block Preview', () => {
|
||||
},
|
||||
});
|
||||
await page.getByText('Preview').click();
|
||||
|
||||
await expect(
|
||||
page
|
||||
.locator('iframe[title="HTML Preview"]')
|
||||
.contentFrame()
|
||||
.getByText('aaa')
|
||||
).toBeHidden();
|
||||
await expect(htmlPreview).toHaveText('Rendering the code...');
|
||||
await page.waitForTimeout(20000);
|
||||
await expect(
|
||||
page
|
||||
.locator('iframe[title="HTML Preview"]')
|
||||
|
||||
Reference in New Issue
Block a user