mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 03:06:31 -05:00
fix(renderer): merge similar renderer types
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
93f296a175
commit
9d49401b4d
8 changed files with 12 additions and 20 deletions
|
@ -13,7 +13,7 @@ describe('Intro page', () => {
|
||||||
|
|
||||||
describe('customizable content', () => {
|
describe('customizable content', () => {
|
||||||
it('fetches and shows the correct intro page 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", () => {
|
it("won't show anything if no content was found", () => {
|
||||||
|
|
|
@ -22,8 +22,8 @@ describe('Motd', () => {
|
||||||
statusCode: 200,
|
statusCode: 200,
|
||||||
headers: { 'Last-Modified': MOCK_LAST_MODIFIED }
|
headers: { 'Last-Modified': MOCK_LAST_MODIFIED }
|
||||||
})
|
})
|
||||||
cy.visitHome()
|
cy.visitHistory()
|
||||||
cy.getMotdBody().should('contain.html', motdMockHtml)
|
cy.getSimpleRendererBody().should('contain.html', motdMockHtml)
|
||||||
cy.getByCypressId('motd-dismiss')
|
cy.getByCypressId('motd-dismiss')
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
|
@ -13,9 +13,7 @@ declare namespace Cypress {
|
||||||
|
|
||||||
getMarkdownBody(): Chainable<Element>
|
getMarkdownBody(): Chainable<Element>
|
||||||
|
|
||||||
getIntroBody(): Chainable<Element>
|
getSimpleRendererBody(): Chainable<Element>
|
||||||
|
|
||||||
getMotdBody(): Chainable<Element>
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,10 +37,6 @@ Cypress.Commands.add('getMarkdownBody', () => {
|
||||||
return cy.getIframeBody(RendererType.DOCUMENT).findByCypressId('markdown-body')
|
return cy.getIframeBody(RendererType.DOCUMENT).findByCypressId('markdown-body')
|
||||||
})
|
})
|
||||||
|
|
||||||
Cypress.Commands.add('getIntroBody', () => {
|
Cypress.Commands.add('getSimpleRendererBody', () => {
|
||||||
return cy.getIframeBody(RendererType.INTRO).findByCypressId('markdown-body')
|
return cy.getIframeBody(RendererType.SIMPLE).findByCypressId('markdown-body')
|
||||||
})
|
|
||||||
|
|
||||||
Cypress.Commands.add('getMotdBody', () => {
|
|
||||||
return cy.getIframeBody(RendererType.MOTD).findByCypressId('markdown-body')
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -20,7 +20,7 @@ exports[`motd modal renders a modal if a motd was fetched and can dismiss it 1`]
|
||||||
data-testid="motd-renderer"
|
data-testid="motd-renderer"
|
||||||
>
|
>
|
||||||
This is a mock implementation of a iframe renderer. Props:
|
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}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -57,7 +57,7 @@ export const MotdModal: React.FC = () => {
|
||||||
<EditorToRendererCommunicatorContextProvider>
|
<EditorToRendererCommunicatorContextProvider>
|
||||||
<RenderIframe
|
<RenderIframe
|
||||||
frameClasses={'w-100'}
|
frameClasses={'w-100'}
|
||||||
rendererType={RendererType.MOTD}
|
rendererType={RendererType.SIMPLE}
|
||||||
markdownContentLines={lines as string[]}
|
markdownContentLines={lines as string[]}
|
||||||
adaptFrameHeightToContent={true}
|
adaptFrameHeightToContent={true}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -30,7 +30,7 @@ export const IntroCustomContent: React.FC = () => {
|
||||||
<RenderIframe
|
<RenderIframe
|
||||||
frameClasses={'w-100 overflow-y-hidden'}
|
frameClasses={'w-100 overflow-y-hidden'}
|
||||||
markdownContentLines={value as string[]}
|
markdownContentLines={value as string[]}
|
||||||
rendererType={RendererType.INTRO}
|
rendererType={RendererType.SIMPLE}
|
||||||
forcedDarkMode={true}
|
forcedDarkMode={true}
|
||||||
adaptFrameHeightToContent={true}
|
adaptFrameHeightToContent={true}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -146,8 +146,7 @@ export const IframeMarkdownRenderer: React.FC = () => {
|
||||||
slideOptions={slideOptions}
|
slideOptions={slideOptions}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
case RendererType.MOTD:
|
case RendererType.SIMPLE:
|
||||||
case RendererType.INTRO:
|
|
||||||
return (
|
return (
|
||||||
<MarkdownDocument
|
<MarkdownDocument
|
||||||
additionalOuterContainerClasses={'vh-100 bg-light overflow-y-hidden'}
|
additionalOuterContainerClasses={'vh-100 bg-light overflow-y-hidden'}
|
||||||
|
|
|
@ -129,9 +129,8 @@ export type RendererToEditorMessageType =
|
||||||
|
|
||||||
export enum RendererType {
|
export enum RendererType {
|
||||||
DOCUMENT = 'document',
|
DOCUMENT = 'document',
|
||||||
INTRO = 'intro',
|
SIMPLE = 'simple',
|
||||||
SLIDESHOW = 'slideshow',
|
SLIDESHOW = 'slideshow'
|
||||||
MOTD = 'motd'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BaseConfiguration {
|
export interface BaseConfiguration {
|
||||||
|
|
Loading…
Reference in a new issue