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.
38 lines
828 B
38 lines
828 B
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 = `console.log('canvas-editor')`
|
|
|
|
it('代码块', () => {
|
|
cy.getEditor().then((editor: Editor) => {
|
|
editor.listener.saved = function (payload) {
|
|
const data = payload.data[2]
|
|
|
|
expect(data.value).to.eq('log')
|
|
|
|
expect(data.color).to.eq('#b9a40a')
|
|
}
|
|
|
|
editor.command.executeSelectAll()
|
|
|
|
editor.command.executeBackspace()
|
|
|
|
cy.get('.menu-item__codeblock').click()
|
|
|
|
cy.get('.dialog-option [name="codeblock"]').type(text)
|
|
|
|
cy.get('.dialog-menu button').eq(1).click()
|
|
|
|
cy.get('@canvas').type('{ctrl}s')
|
|
})
|
|
})
|
|
|
|
})
|