test:optimize the method of get editor value

This commit is contained in:
Hufe921
2023-02-21 21:07:52 +08:00
parent 63487d4f90
commit 708d57812e
20 changed files with 288 additions and 302 deletions
+7 -9
View File
@@ -13,14 +13,6 @@ describe('菜单-清除格式', () => {
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()
@@ -36,7 +28,13 @@ describe('菜单-清除格式', () => {
cy.get('.menu-item__format')
.click()
.then(() => {
cy.get('@canvas').type('{ctrl}s')
const payload = editor.command.getValue()
const data = payload.data
expect(data[0].italic).to.eq(false)
expect(data[0].bold).to.eq(false)
})
})
})