diff --git a/client/cypress/e2e/frontend/modules/duplicate-content-block.cy.ts b/client/cypress/e2e/frontend/modules/duplicate-content-block.cy.ts new file mode 100644 index 00000000..f68e6644 --- /dev/null +++ b/client/cypress/e2e/frontend/modules/duplicate-content-block.cy.ts @@ -0,0 +1,62 @@ +import {getMinimalMe} from '../../../support/helpers'; + +describe('Duplicate Content Block', () => { + beforeEach(() => { + cy.setup(); + }); + it.skip('works', () => { + // todo: does not work right now, as the cache does not seem to update for the 'inEditMode' local query. Need to + // make this work for the test to work right. + const operations = { + MeQuery: getMinimalMe({isTeacher: true}), + UpdateLastModule: {}, + ModuleEditModeQuery: { + module: { + } + }, + AssignmentQuery: { + assignment: { + title: 'Ein Assignment', + assignment: 'Eine Beschreibung' + } + }, + ModuleDetailsQuery: { + module: { + chapters: [ + { + contentBlocks: [ + { + type: 'normal', + title: 'Hello there', + contents: [ + { + type: 'text_block', + value: { + text: '

Asdf

' + } + }, + { + type: 'assignment', + value: { + title: 'Ein Auftrag', + assignment: 'Eine Beschreibung', + id: 'abcd' + } + } + + ] + } + ] + } + ] + } + } + }; + cy.mockGraphqlOps({ + operations + }); + cy.visit('/module/some-module'); + + cy.getByDataCy('toggle-editing').click(); + }); +}); diff --git a/client/cypress/integration/frontend/modules/custom-content-block.spec.js b/client/cypress/integration/frontend/modules/custom-content-block.spec.js index 21bf98c8..d569de30 100644 --- a/client/cypress/integration/frontend/modules/custom-content-block.spec.js +++ b/client/cypress/integration/frontend/modules/custom-content-block.spec.js @@ -61,6 +61,14 @@ describe('Custom Content Block', () => { cy.log('Opening More Menu'); cy.getByDataCy('more-options-link').click(); + cy.log('Duplicating Content Block'); + cy.getByDataCy('duplicate-content-block-link').click(); + + cy.get('.content-block').should('have.length', 2); + + 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(); diff --git a/client/src/components/ContentBlock.vue b/client/src/components/ContentBlock.vue index 77cd254f..4f5cb45f 100644 --- a/client/src/components/ContentBlock.vue +++ b/client/src/components/ContentBlock.vue @@ -11,14 +11,28 @@ >
- + -