Add test for subtitle in room entry, add missing block

Resolves MS-487
This commit is contained in:
Ramon Wenger 2022-07-06 11:00:22 +02:00
parent 58e7fbaa45
commit deb2a2cd1b
4 changed files with 35 additions and 10 deletions

View File

@ -7,6 +7,17 @@ describe('Article page', () => {
id: 'room-entry-id', id: 'room-entry-id',
title: 'Some Room Entry, yay!', title: 'Some Room Entry, yay!',
comments: [], comments: [],
contents: [{
type: 'text_block',
value: {
text: 'Ein Text',
},
}, {
type: 'subtitle',
value: {
text: 'Ein Untertitel'
}
}],
}; };
const operations = { const operations = {
@ -23,18 +34,28 @@ describe('Article page', () => {
roomEntry: roomEntry, roomEntry: roomEntry,
owner: { owner: {
firstName: 'Matt', firstName: 'Matt',
lastName: 'Damon' lastName: 'Damon',
} },
} },
} },
}; };
} },
}; };
beforeEach(() => { beforeEach(() => {
cy.setup(); cy.setup();
}); });
it('shows the article with contents', () => {
cy.mockGraphqlOps({
operations,
});
cy.visit(`/article/${slug}`);
cy.getByDataCy('text-block').should('contain.text', 'Ein Text');
cy.getByDataCy('subtitle-block').should('contain.text', 'Ein Untertitel');
});
it('goes to article and leaves a comment', () => { it('goes to article and leaves a comment', () => {
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations, operations,

View File

@ -2,6 +2,7 @@
<!-- eslint-disable vue/no-v-html --> <!-- eslint-disable vue/no-v-html -->
<h5 <h5
class="subtitle" class="subtitle"
data-cy="subtitle-block"
v-html="sanitizedText" v-html="sanitizedText"
/> />
</template> </template>

View File

@ -2,6 +2,7 @@
<!-- eslint-disable vue/no-v-html --> <!-- eslint-disable vue/no-v-html -->
<div <div
class="text-block" class="text-block"
data-cy="text-block"
v-html="sanitizedText" v-html="sanitizedText"
/> />
</template> </template>

View File

@ -40,6 +40,7 @@
const VideoBlock = () => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/VideoBlock'); const VideoBlock = () => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/VideoBlock');
const LinkBlock = () => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/LinkBlock'); const LinkBlock = () => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/LinkBlock');
const DocumentBlock = () => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/DocumentBlock'); const DocumentBlock = () => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/DocumentBlock');
const SubtitleBlock = () => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/SubtitleBlock');
export default { export default {
components: { components: {
@ -51,6 +52,7 @@
'video_block': VideoBlock, 'video_block': VideoBlock,
'link_block': LinkBlock, 'link_block': LinkBlock,
'document_block': DocumentBlock, 'document_block': DocumentBlock,
'subtitle': SubtitleBlock,
UserMetaWidget, UserMetaWidget,
}, },