73 lines
1.5 KiB
JavaScript
73 lines
1.5 KiB
JavaScript
import module from '../../../fixtures/module.minimal';
|
|
import { getMinimalMe } from '../../../support/helpers';
|
|
|
|
const chapters = [
|
|
{
|
|
title: 'ABC',
|
|
description: 'DEF',
|
|
contentBlocks: [
|
|
{
|
|
title: 'A ContentBlock',
|
|
userCreated: true,
|
|
mine: true,
|
|
contents: [
|
|
{
|
|
type: 'text_block',
|
|
value: {
|
|
text: 'Hello World',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
];
|
|
|
|
const operations = {
|
|
MeQuery: getMinimalMe({ isTeacher: true }),
|
|
ModuleDetailsQuery: {
|
|
module: {
|
|
chapters,
|
|
},
|
|
},
|
|
ModuleEditModeQuery: {
|
|
module: {
|
|
slug: 'some-module',
|
|
},
|
|
},
|
|
DeleteContentBlock: {
|
|
success: true,
|
|
},
|
|
UpdateLastModule: {},
|
|
};
|
|
|
|
describe('Custom Content Block', () => {
|
|
beforeEach(() => {
|
|
cy.setup();
|
|
});
|
|
|
|
// todo: fix this test
|
|
it.skip('Deletes the custom content block and removes it from the view', () => {
|
|
cy.mockGraphqlOps({
|
|
operations,
|
|
});
|
|
|
|
cy.visit('module/some-module');
|
|
|
|
cy.log('Toggling Edit Mode');
|
|
cy.getByDataCy('toggle-editing').click();
|
|
|
|
cy.getByDataCy('module-title').should('exist');
|
|
cy.get('.content-block').should('have.length', 1);
|
|
|
|
cy.log('Opening More Menu');
|
|
cy.getByDataCy('more-options-link').click();
|
|
|
|
// check if content block is still there
|
|
cy.log('Deleting Content Block');
|
|
cy.getByDataCy('delete-content-block-link').click();
|
|
|
|
cy.get('.content-block').should('have.length', 0);
|
|
});
|
|
});
|