diff --git a/cypress/integration/menus/latex.spec.ts b/cypress/integration/menus/latex.spec.ts new file mode 100644 index 0000000..a52441c --- /dev/null +++ b/cypress/integration/menus/latex.spec.ts @@ -0,0 +1,37 @@ +import Editor from '../../../src/editor' + +describe('菜单-LaTeX', () => { + + beforeEach(() => { + cy.visit('http://localhost:3000/canvas-editor/') + + cy.get('canvas').first().as('canvas').should('have.length', 1) + }) + + const text = 'canvas-editor' + + it('LaTeX', () => { + cy.getEditor().then((editor: Editor) => { + editor.listener.saved = function (payload) { + const data = payload.data + + expect(data[0].type).to.eq('latex') + + expect(data[0].value).to.eq(text) + } + + editor.command.executeSelectAll() + + editor.command.executeBackspace() + + cy.get('.menu-item__latex').click() + + cy.get('.dialog-option__item [name="value"]').type(text) + + cy.get('.dialog-menu button').eq(1).click() + + cy.get('@canvas').type('{ctrl}s') + }) + }) + +})