Add test for creating content blocks
This commit is contained in:
parent
b84381b9ab
commit
d4e9464503
|
|
@ -1,19 +1,66 @@
|
||||||
|
import {getMinimalMe} from '../../../support/helpers';
|
||||||
|
|
||||||
|
const MeQuery = getMinimalMe();
|
||||||
|
|
||||||
describe('Create Content Block', () => {
|
describe('Create Content Block', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.setup();
|
||||||
|
|
||||||
|
cy.mockGraphqlOps({
|
||||||
|
operations: {
|
||||||
|
MeQuery,
|
||||||
|
ModuleDetailsQuery: {
|
||||||
|
module: {},
|
||||||
|
},
|
||||||
|
AddContentBlock: {
|
||||||
|
addContentBlock: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('visits the page', () => {
|
it('visits the page', () => {
|
||||||
// todo:
|
// todo:
|
||||||
// add mocks
|
// add mocks
|
||||||
// cy.visit('/module/some-module/add/bliblablub');
|
cy.visit('/module/some-module/add-after/bliblablub');
|
||||||
// add title
|
// add title
|
||||||
|
cy.getByDataCy('content-block-form-heading').should('exist');
|
||||||
|
cy.getByDataCy('content-list').should('not.exist');
|
||||||
|
cy.getByDataCy('save-button').should('exist').should('be.disabled');
|
||||||
|
cy.getByDataCy('content-block-title').within(() => {
|
||||||
|
cy.getByDataCy('input-with-label-input').type('Title of my book');
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.getByDataCy('add-content-link').click();
|
||||||
|
cy.getByDataCy('chooser-heading').should('contain', 'Neuer Inhalt');
|
||||||
// add text element
|
// add text element
|
||||||
|
cy.getByDataCy('choose-text-widget').click();
|
||||||
|
cy.getByDataCy('text-form-input').type('Hallo Sam');
|
||||||
|
|
||||||
// add list item
|
// add list item
|
||||||
|
cy.getByDataCy('add-content-link').last().click();
|
||||||
|
cy.getByDataCy('convert-to-list-checkbox').click();
|
||||||
// add text element to list item
|
// add text element to list item
|
||||||
// add second list item
|
cy.getByDataCy('choose-text-widget').click();
|
||||||
// add text element to second list item
|
cy.getByDataCy('content-list').within(() => {
|
||||||
// add another text element to second list item
|
cy.getByDataCy('text-form-input').last().type('Hallo Velo');
|
||||||
|
// add second list item
|
||||||
|
cy.getByDataCy('add-content-link').click();
|
||||||
|
// add text element to second list item
|
||||||
|
cy.getByDataCy('choose-text-widget').click();
|
||||||
|
cy.getByDataCy('text-form-input').last().type('Hallo Velo');
|
||||||
|
// add another text element to second list item
|
||||||
|
cy.getByDataCy('add-content-link').last().click();
|
||||||
|
cy.getByDataCy('choose-text-widget').click();
|
||||||
|
cy.getByDataCy('text-form-input').last().type('Hallo Outo');
|
||||||
|
});
|
||||||
// save
|
// save
|
||||||
|
cy.getByDataCy('save-button').should('exist').should('not.be.disabled').click();
|
||||||
|
|
||||||
// another test
|
// another test
|
||||||
// go to pase
|
// go to page
|
||||||
// click cancel, go back
|
// click cancel, go back
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<a
|
<a
|
||||||
class="add-content-link"
|
class="add-content-link"
|
||||||
|
data-cy="add-content-link"
|
||||||
@click="$emit('click')"
|
@click="$emit('click')"
|
||||||
><plus-icon class="add-content-link__icon" /> <span class="add-content-link__text">Neuer Inhalt</span></a>
|
><plus-icon class="add-content-link__icon" /> <span class="add-content-link__text">Neuer Inhalt</span></a>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
<content-form-section title="Titel">
|
<content-form-section title="Titel">
|
||||||
<input-with-label
|
<input-with-label
|
||||||
:value="localContentBlock.title"
|
:value="localContentBlock.title"
|
||||||
|
data-cy="content-block-title"
|
||||||
label="Name"
|
label="Name"
|
||||||
placeholder="z.B. Auftrag 3"
|
placeholder="z.B. Auftrag 3"
|
||||||
@input="localContentBlock.title=$event"
|
@input="localContentBlock.title=$event"
|
||||||
|
|
@ -40,6 +41,7 @@
|
||||||
<!-- If the block is a content list -->
|
<!-- If the block is a content list -->
|
||||||
<div
|
<div
|
||||||
class="content-block-form__segment"
|
class="content-block-form__segment"
|
||||||
|
data-cy="content-list"
|
||||||
v-if="block.type === 'content_list_item'"
|
v-if="block.type === 'content_list_item'"
|
||||||
>
|
>
|
||||||
<content-element-actions
|
<content-element-actions
|
||||||
|
|
@ -102,6 +104,7 @@
|
||||||
<button
|
<button
|
||||||
:disabled="!isValid"
|
:disabled="!isValid"
|
||||||
class="button button--primary"
|
class="button button--primary"
|
||||||
|
data-cy="save-button"
|
||||||
@click="save(localContentBlock)"
|
@click="save(localContentBlock)"
|
||||||
>
|
>
|
||||||
Speichern
|
Speichern
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,10 @@
|
||||||
>
|
>
|
||||||
<cross-icon class="icon-button__icon" />
|
<cross-icon class="icon-button__icon" />
|
||||||
</button>
|
</button>
|
||||||
<h3 class="content-block-element-chooser-widget__heading">
|
<h3
|
||||||
|
class="content-block-element-chooser-widget__heading"
|
||||||
|
data-cy="chooser-heading"
|
||||||
|
>
|
||||||
Neuer Inhalt
|
Neuer Inhalt
|
||||||
</h3>
|
</h3>
|
||||||
<template
|
<template
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
<input
|
<input
|
||||||
:value="value"
|
:value="value"
|
||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
|
data-cy="input-with-label-input"
|
||||||
class="skillbox-input"
|
class="skillbox-input"
|
||||||
@input="$emit('input', $event.target.value)"
|
@input="$emit('input', $event.target.value)"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue