diff --git a/cypress.json b/cypress.json index 022af78..2e178e6 100644 --- a/cypress.json +++ b/cypress.json @@ -1,5 +1,5 @@ { "video": false, - "viewportWidth": 1080, + "viewportWidth": 1366, "viewportHeight": 720 } \ No newline at end of file diff --git a/cypress/integration/menus/checkbox.spec.ts b/cypress/integration/menus/checkbox.spec.ts new file mode 100644 index 0000000..a475118 --- /dev/null +++ b/cypress/integration/menus/checkbox.spec.ts @@ -0,0 +1,37 @@ +import Editor, { ElementType } from '../../../src/editor' + +describe('菜单-复选框', () => { + + beforeEach(() => { + cy.visit('http://localhost:3000/canvas-editor/') + + cy.get('canvas').first().as('canvas').should('have.length', 1) + }) + + const type: ElementType = 'checkbox' + + it('代码块', () => { + cy.getEditor().then((editor: Editor) => { + editor.listener.saved = function (payload) { + const data = payload.data[0] + + expect(data.checkbox?.value).to.eq(true) + } + + editor.command.executeSelectAll() + + editor.command.executeBackspace() + + editor.command.executeInsertElementList([{ + type, + value: '', + checkbox: { + value: true + } + }]) + + cy.get('@canvas').type('{ctrl}s') + }) + }) + +}) diff --git a/index.html b/index.html index 01d078a..68a38c4 100644 --- a/index.html +++ b/index.html @@ -169,6 +169,9 @@ +