From 94c7d9b21bffe8ae60688ac987f97e7f7550e85f Mon Sep 17 00:00:00 2001 From: Ronald Langeveld Date: Tue, 23 Jan 2024 14:33:38 +0000 Subject: [PATCH] Revert "Changed request type to fetching iframe content in previews refs https://ghost.slack.com/archives/C0568LN2CGJ/p1706018058495729 --- apps/admin-x-framework/src/test/acceptance.ts | 2 +- .../settings/site/announcementBar/AnnouncementBarPreview.tsx | 2 +- .../components/settings/site/designAndBranding/ThemePreview.tsx | 2 +- .../test/acceptance/site/announcementbar.test.ts | 2 +- apps/admin-x-settings/test/acceptance/site/design.test.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/admin-x-framework/src/test/acceptance.ts b/apps/admin-x-framework/src/test/acceptance.ts index ea7f3cc2d4..9f191c2cd2 100644 --- a/apps/admin-x-framework/src/test/acceptance.ts +++ b/apps/admin-x-framework/src/test/acceptance.ts @@ -224,7 +224,7 @@ export async function mockSitePreview({page, url, response}: {page: Page, url: s const lastRequest: {previewHeader?: string} = {}; await page.route(url, async (route) => { - if (route.request().method() !== 'GET') { + if (route.request().method() !== 'POST') { return route.continue(); } diff --git a/apps/admin-x-settings/src/components/settings/site/announcementBar/AnnouncementBarPreview.tsx b/apps/admin-x-settings/src/components/settings/site/announcementBar/AnnouncementBarPreview.tsx index f68c0bb465..6bd8ae2737 100644 --- a/apps/admin-x-settings/src/components/settings/site/announcementBar/AnnouncementBarPreview.tsx +++ b/apps/admin-x-settings/src/components/settings/site/announcementBar/AnnouncementBarPreview.tsx @@ -28,7 +28,7 @@ const AnnouncementBarPreview: React.FC = ({announcement } fetch(url, { - method: 'GET', + method: 'POST', headers: { 'Content-Type': 'text/html;charset=utf-8', 'x-ghost-preview': getPreviewData( diff --git a/apps/admin-x-settings/src/components/settings/site/designAndBranding/ThemePreview.tsx b/apps/admin-x-settings/src/components/settings/site/designAndBranding/ThemePreview.tsx index 42008969f9..ce155836b4 100644 --- a/apps/admin-x-settings/src/components/settings/site/designAndBranding/ThemePreview.tsx +++ b/apps/admin-x-settings/src/components/settings/site/designAndBranding/ThemePreview.tsx @@ -65,7 +65,7 @@ const ThemePreview: React.FC = ({settings,url}) => { // Fetch theme preview HTML fetch(url, { - method: 'GET', + method: 'POST', headers: { 'Content-Type': 'text/html;charset=utf-8', 'x-ghost-preview': previewData, diff --git a/apps/admin-x-settings/test/acceptance/site/announcementbar.test.ts b/apps/admin-x-settings/test/acceptance/site/announcementbar.test.ts index bc160f9306..e0f0f0c798 100644 --- a/apps/admin-x-settings/test/acceptance/site/announcementbar.test.ts +++ b/apps/admin-x-settings/test/acceptance/site/announcementbar.test.ts @@ -44,7 +44,7 @@ test.describe('Announcement Bar', async () => { const iframesHandleHome = await page.$$('[data-testid="announcement-bar-preview-iframe"] > iframe'); const textExistsInHomeIframes = await checkTextInIframes(iframesHandleHome, 'homepage preview'); - await expect(textExistsInHomeIframes).toBeTruthy(); + expect(textExistsInHomeIframes).toBeTruthy(); const modal = page.getByTestId('announcement-bar-modal'); await modal.getByTestId('design-toolbar').getByRole('tab', {name: 'Post'}).click(); diff --git a/apps/admin-x-settings/test/acceptance/site/design.test.ts b/apps/admin-x-settings/test/acceptance/site/design.test.ts index 9e567a44af..9f062e7443 100644 --- a/apps/admin-x-settings/test/acceptance/site/design.test.ts +++ b/apps/admin-x-settings/test/acceptance/site/design.test.ts @@ -220,7 +220,7 @@ test.describe('Design settings', async () => { await expect(modal.getByTestId('design-setting-tabs').getByRole('tab', {name: 'Post'})).toBeHidden(); const expectedEncoded = new URLSearchParams([['custom', JSON.stringify({})]]).toString(); - await expect(lastPreviewRequest.previewHeader).toMatch(new RegExp(`&${expectedEncoded.replace(/\+/g, '\\+')}`)); + expect(lastPreviewRequest.previewHeader).toMatch(new RegExp(`&${expectedEncoded.replace(/\+/g, '\\+')}`)); }); test('Custom theme setting visibility', async ({page}) => {