57 lines
1.2 KiB
JavaScript
57 lines
1.2 KiB
JavaScript
import getMe from '../../fixtures/me.minimal';
|
|
import module from '../../fixtures/module.minimal';
|
|
|
|
const chapters = [{
|
|
title: 'ABC',
|
|
description: 'DEF',
|
|
contentBlocks: [
|
|
{
|
|
title: 'A ContentBlock',
|
|
userCreated: true,
|
|
mine: true,
|
|
contents: [],
|
|
},
|
|
],
|
|
}];
|
|
|
|
const operations = {
|
|
MeQuery: {
|
|
me: getMe(true),
|
|
},
|
|
ModuleDetailsQuery: {
|
|
module: {
|
|
...module,
|
|
chapters,
|
|
},
|
|
},
|
|
DeleteContentBlock: {
|
|
success: true,
|
|
},
|
|
};
|
|
|
|
describe('Custom Content Block', () => {
|
|
before(() => {
|
|
cy.setup();
|
|
});
|
|
|
|
it('Deletes the custom content block and removes it from the view', () => {
|
|
cy.fakeLogin('ross.geller', 'test');
|
|
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);
|
|
});
|
|
});
|