feat:add format test case

pr675
黄云飞 4 years ago
parent eabc895f0f
commit 90b2061c38

@ -0,0 +1,44 @@
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'
const textLength = text.length
it('清除格式', () => {
cy.getEditor().then((editor: Editor) => {
editor.listener.saved = function (payload) {
const data = payload.data
expect(data[0].italic).to.eq(false)
expect(data[0].bold).to.eq(false)
}
editor.command.executeSelectAll()
editor.command.executeBackspace()
editor.command.executeInsertElementList([{
value: text,
bold: true,
italic: true
}])
editor.command.executeSetRange(0, textLength)
cy.get('.menu-item__format')
.click()
.then(() => {
cy.get('@canvas').type('{ctrl}s')
})
})
})
})
Loading…
Cancel
Save