From 9d49401b4dc570cc152697b397a18de42e4be697 Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Thu, 16 Mar 2023 08:20:16 +0100 Subject: [PATCH] fix(renderer): merge similar renderer types Signed-off-by: Tilman Vatteroth --- frontend/cypress/e2e/intro.spec.ts | 2 +- frontend/cypress/e2e/motd.spec.ts | 4 ++-- frontend/cypress/support/get-iframe-content.ts | 12 +++--------- .../__snapshots__/motd-modal.test.tsx.snap | 2 +- .../src/components/common/motd-modal/motd-modal.tsx | 2 +- .../components/intro-page/intro-custom-content.tsx | 2 +- .../render-page/iframe-markdown-renderer.tsx | 3 +-- .../rendering-message.ts | 5 ++--- 8 files changed, 12 insertions(+), 20 deletions(-) diff --git a/frontend/cypress/e2e/intro.spec.ts b/frontend/cypress/e2e/intro.spec.ts index d46caa9a6..0a4a3e97e 100644 --- a/frontend/cypress/e2e/intro.spec.ts +++ b/frontend/cypress/e2e/intro.spec.ts @@ -13,7 +13,7 @@ describe('Intro page', () => { describe('customizable content', () => { it('fetches and shows the correct intro page content', () => { - cy.getIntroBody().contains('test content') + cy.getSimpleRendererBody().contains('test content') }) it("won't show anything if no content was found", () => { diff --git a/frontend/cypress/e2e/motd.spec.ts b/frontend/cypress/e2e/motd.spec.ts index e3ba8dcae..5ae507ba4 100644 --- a/frontend/cypress/e2e/motd.spec.ts +++ b/frontend/cypress/e2e/motd.spec.ts @@ -22,8 +22,8 @@ describe('Motd', () => { statusCode: 200, headers: { 'Last-Modified': MOCK_LAST_MODIFIED } }) - cy.visitHome() - cy.getMotdBody().should('contain.html', motdMockHtml) + cy.visitHistory() + cy.getSimpleRendererBody().should('contain.html', motdMockHtml) cy.getByCypressId('motd-dismiss') .click() .then(() => { diff --git a/frontend/cypress/support/get-iframe-content.ts b/frontend/cypress/support/get-iframe-content.ts index c1220e0a7..7ef1a5db8 100644 --- a/frontend/cypress/support/get-iframe-content.ts +++ b/frontend/cypress/support/get-iframe-content.ts @@ -13,9 +13,7 @@ declare namespace Cypress { getMarkdownBody(): Chainable - getIntroBody(): Chainable - - getMotdBody(): Chainable + getSimpleRendererBody(): Chainable } } @@ -39,10 +37,6 @@ Cypress.Commands.add('getMarkdownBody', () => { return cy.getIframeBody(RendererType.DOCUMENT).findByCypressId('markdown-body') }) -Cypress.Commands.add('getIntroBody', () => { - return cy.getIframeBody(RendererType.INTRO).findByCypressId('markdown-body') -}) - -Cypress.Commands.add('getMotdBody', () => { - return cy.getIframeBody(RendererType.MOTD).findByCypressId('markdown-body') +Cypress.Commands.add('getSimpleRendererBody', () => { + return cy.getIframeBody(RendererType.SIMPLE).findByCypressId('markdown-body') }) diff --git a/frontend/src/components/common/motd-modal/__snapshots__/motd-modal.test.tsx.snap b/frontend/src/components/common/motd-modal/__snapshots__/motd-modal.test.tsx.snap index ae11f42d9..267117c6e 100644 --- a/frontend/src/components/common/motd-modal/__snapshots__/motd-modal.test.tsx.snap +++ b/frontend/src/components/common/motd-modal/__snapshots__/motd-modal.test.tsx.snap @@ -20,7 +20,7 @@ exports[`motd modal renders a modal if a motd was fetched and can dismiss it 1`] data-testid="motd-renderer" > This is a mock implementation of a iframe renderer. Props: - {"frameClasses":"w-100","rendererType":"motd","markdownContentLines":["very important mock text!"],"adaptFrameHeightToContent":true} + {"frameClasses":"w-100","rendererType":"simple","markdownContentLines":["very important mock text!"],"adaptFrameHeightToContent":true}
{ diff --git a/frontend/src/components/intro-page/intro-custom-content.tsx b/frontend/src/components/intro-page/intro-custom-content.tsx index ddbc8ad40..0848a6e58 100644 --- a/frontend/src/components/intro-page/intro-custom-content.tsx +++ b/frontend/src/components/intro-page/intro-custom-content.tsx @@ -30,7 +30,7 @@ export const IntroCustomContent: React.FC = () => { diff --git a/frontend/src/components/render-page/iframe-markdown-renderer.tsx b/frontend/src/components/render-page/iframe-markdown-renderer.tsx index c409f87c8..fd31deed0 100644 --- a/frontend/src/components/render-page/iframe-markdown-renderer.tsx +++ b/frontend/src/components/render-page/iframe-markdown-renderer.tsx @@ -146,8 +146,7 @@ export const IframeMarkdownRenderer: React.FC = () => { slideOptions={slideOptions} /> ) - case RendererType.MOTD: - case RendererType.INTRO: + case RendererType.SIMPLE: return (