mirror of https://gitee.com/godoos/godoos.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.1 KiB
49 lines
1.1 KiB
import Editor from '../../../src/editor'
|
|
|
|
describe('菜单-撤销&重做', () => {
|
|
beforeEach(() => {
|
|
cy.visit('http://localhost:3000/canvas-editor/')
|
|
|
|
cy.get('canvas').first().as('canvas').should('have.length', 1)
|
|
})
|
|
|
|
const text = 'canvas-editor'
|
|
|
|
it('撤销', () => {
|
|
cy.getEditor().then((editor: Editor) => {
|
|
editor.command.executeSelectAll()
|
|
|
|
editor.command.executeBackspace()
|
|
|
|
cy.get('@canvas').type(`${text}1`)
|
|
|
|
cy.get('.menu-item__undo')
|
|
.click()
|
|
.then(() => {
|
|
const data = editor.command.getValue().data.main
|
|
|
|
expect(data[0].value).to.eq(text)
|
|
})
|
|
})
|
|
})
|
|
|
|
it('重做', () => {
|
|
cy.getEditor().then((editor: Editor) => {
|
|
editor.command.executeSelectAll()
|
|
|
|
editor.command.executeBackspace()
|
|
|
|
cy.get('@canvas').type(`${text}1`)
|
|
|
|
cy.get('.menu-item__undo').click()
|
|
|
|
cy.get('.menu-item__redo')
|
|
.click()
|
|
.then(() => {
|
|
const data = editor.command.getValue().data.main
|
|
|
|
expect(data[0].value).to.eq(`${text}1`)
|
|
})
|
|
})
|
|
})
|
|
})
|
|
|