Make new tests pass
This commit is contained in:
parent
ddf5360c51
commit
7d9da414d8
|
|
@ -1,10 +1,70 @@
|
|||
import {getMinimalMe} from '../../../support/helpers';
|
||||
import minimalModule from '../../../fixtures/module.minimal';
|
||||
|
||||
const {me: minimalMe} = getMinimalMe({});
|
||||
|
||||
describe('Instruments on Module page', () => {
|
||||
beforeEach(() => {
|
||||
console.log('setting up');
|
||||
cy.setup();
|
||||
cy.mockGraphqlOps({
|
||||
operations: {
|
||||
UpdateLastModule: {
|
||||
updateLastModule: {
|
||||
success: true,
|
||||
},
|
||||
},
|
||||
MeQuery: {
|
||||
me: minimalMe,
|
||||
},
|
||||
ModuleDetailsQuery: {
|
||||
module: {
|
||||
...minimalModule,
|
||||
slug: 'module-with-instrument',
|
||||
chapters: [
|
||||
{
|
||||
title: 'Some Chapter',
|
||||
contentBlocks: [
|
||||
{
|
||||
'type': 'base_communication',
|
||||
'title': 'Das Interview',
|
||||
'contents': [
|
||||
{
|
||||
'type': 'basic_knowledge',
|
||||
'value': {
|
||||
'description': '<p>Ein Interview dient dazu, durch Befragung Informationen zu ermitteln. Bei journalistischen Interviews werden oft Expertinnen und Experten befragt, aber auch Personen.</p>',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'type': 'normal',
|
||||
'title': 'Normaler Block',
|
||||
'contents': [
|
||||
{
|
||||
type: 'text_block',
|
||||
value: {
|
||||
text: 'Some text, not an instrument'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
it('shows the correct instrument label', () => {
|
||||
cy.visit('modules/module-with-instrument');
|
||||
cy.getByDataCy('instrument').first().within(() => {
|
||||
cy.getByDataCy('instrument-subheader').should('contain', 'Instrumente - Sprache & Kommunikation');
|
||||
cy.visit('module/module-with-instrument');
|
||||
cy.getByDataCy('content-block').first().within(() => {
|
||||
cy.getByDataCy('instrument-label').should('contain', 'Instrumente - Sprache & Kommunikation');
|
||||
});
|
||||
cy.getByDataCy('content-block').eq(1).within(() => {
|
||||
cy.getByDataCy('instrument-label').should('not.exist');
|
||||
});
|
||||
// also check that other content blocks don't have the label
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
<div
|
||||
:class="specialClass"
|
||||
class="content-block"
|
||||
data-cy="content-block"
|
||||
>
|
||||
<div
|
||||
class="block-actions"
|
||||
|
|
@ -41,6 +42,7 @@
|
|||
|
||||
<h3
|
||||
class="content-block__instrument-label"
|
||||
data-cy="instrument-label"
|
||||
v-if="instrumentLabel !== ''"
|
||||
>
|
||||
{{ instrumentLabel }}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,10 @@
|
|||
:class="typeClass"
|
||||
class="instrument-entry"
|
||||
>
|
||||
<h4 class="instrument-entry__category">
|
||||
<h4
|
||||
class="instrument-entry__category"
|
||||
data-cy="instrument-subheader"
|
||||
>
|
||||
{{ categoryName }}
|
||||
</h4>
|
||||
<h3 class="instrument-entry__title">
|
||||
|
|
|
|||
Loading…
Reference in New Issue