mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Revert "Changed request type to fetching iframe content in previews
refs https://ghost.slack.com/archives/C0568LN2CGJ/p1706018058495729
This commit is contained in:
parent
109a354818
commit
181be4ef1b
5 changed files with 5 additions and 5 deletions
|
@ -224,7 +224,7 @@ export async function mockSitePreview({page, url, response}: {page: Page, url: s
|
||||||
const lastRequest: {previewHeader?: string} = {};
|
const lastRequest: {previewHeader?: string} = {};
|
||||||
|
|
||||||
await page.route(url, async (route) => {
|
await page.route(url, async (route) => {
|
||||||
if (route.request().method() !== 'GET') {
|
if (route.request().method() !== 'POST') {
|
||||||
return route.continue();
|
return route.continue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ const AnnouncementBarPreview: React.FC<AnnouncementBarSettings> = ({announcement
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch(url, {
|
fetch(url, {
|
||||||
method: 'GET',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'text/html;charset=utf-8',
|
'Content-Type': 'text/html;charset=utf-8',
|
||||||
'x-ghost-preview': getPreviewData(
|
'x-ghost-preview': getPreviewData(
|
||||||
|
|
|
@ -65,7 +65,7 @@ const ThemePreview: React.FC<ThemePreviewProps> = ({settings,url}) => {
|
||||||
|
|
||||||
// Fetch theme preview HTML
|
// Fetch theme preview HTML
|
||||||
fetch(url, {
|
fetch(url, {
|
||||||
method: 'GET',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'text/html;charset=utf-8',
|
'Content-Type': 'text/html;charset=utf-8',
|
||||||
'x-ghost-preview': previewData,
|
'x-ghost-preview': previewData,
|
||||||
|
|
|
@ -44,7 +44,7 @@ test.describe('Announcement Bar', async () => {
|
||||||
|
|
||||||
const iframesHandleHome = await page.$$('[data-testid="announcement-bar-preview-iframe"] > iframe');
|
const iframesHandleHome = await page.$$('[data-testid="announcement-bar-preview-iframe"] > iframe');
|
||||||
const textExistsInHomeIframes = await checkTextInIframes(iframesHandleHome, 'homepage preview');
|
const textExistsInHomeIframes = await checkTextInIframes(iframesHandleHome, 'homepage preview');
|
||||||
await expect(textExistsInHomeIframes).toBeTruthy();
|
expect(textExistsInHomeIframes).toBeTruthy();
|
||||||
|
|
||||||
const modal = page.getByTestId('announcement-bar-modal');
|
const modal = page.getByTestId('announcement-bar-modal');
|
||||||
await modal.getByTestId('design-toolbar').getByRole('tab', {name: 'Post'}).click();
|
await modal.getByTestId('design-toolbar').getByRole('tab', {name: 'Post'}).click();
|
||||||
|
|
|
@ -220,7 +220,7 @@ test.describe('Design settings', async () => {
|
||||||
await expect(modal.getByTestId('design-setting-tabs').getByRole('tab', {name: 'Post'})).toBeHidden();
|
await expect(modal.getByTestId('design-setting-tabs').getByRole('tab', {name: 'Post'})).toBeHidden();
|
||||||
|
|
||||||
const expectedEncoded = new URLSearchParams([['custom', JSON.stringify({})]]).toString();
|
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}) => {
|
test('Custom theme setting visibility', async ({page}) => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue