test:update get editor value
This commit is contained in:
@@ -34,9 +34,7 @@ describe('控件-复选框', () => {
|
|||||||
}
|
}
|
||||||
}])
|
}])
|
||||||
|
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main[0]
|
||||||
|
|
||||||
const data = payload.data[0]
|
|
||||||
|
|
||||||
expect(data.control!.code).to.be.eq('98175')
|
expect(data.control!.code).to.be.eq('98175')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -41,9 +41,7 @@ describe('控件-列举型', () => {
|
|||||||
.eq(0)
|
.eq(0)
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main[0]
|
||||||
|
|
||||||
const data = payload.data[0]
|
|
||||||
|
|
||||||
expect(data.control!.value![0].value).to.be.eq(text)
|
expect(data.control!.value![0].value).to.be.eq(text)
|
||||||
|
|
||||||
|
|||||||
@@ -33,9 +33,7 @@ describe('控件-文本型', () => {
|
|||||||
cy.get('.ce-inputarea')
|
cy.get('.ce-inputarea')
|
||||||
.type(text)
|
.type(text)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main[0]
|
||||||
|
|
||||||
const data = payload.data[0]
|
|
||||||
|
|
||||||
expect(data.control!.value![0].value).to.be.eq(text)
|
expect(data.control!.value![0].value).to.be.eq(text)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ describe('基础功能', () => {
|
|||||||
cy.get('@canvas')
|
cy.get('@canvas')
|
||||||
.type(text)
|
.type(text)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
expect(payload.data[0].value).to.eq(text)
|
expect(data[0].value).to.eq(text)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -28,9 +28,7 @@ describe('菜单-内容块', () => {
|
|||||||
.eq(1)
|
.eq(1)
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].type).to.eq('block')
|
expect(data[0].type).to.eq('block')
|
||||||
|
|
||||||
|
|||||||
@@ -24,9 +24,7 @@ describe('菜单-复选框', () => {
|
|||||||
}
|
}
|
||||||
}])
|
}])
|
||||||
|
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main[0]
|
||||||
|
|
||||||
const data = payload.data[0]
|
|
||||||
|
|
||||||
expect(data.checkbox?.value).to.eq(true)
|
expect(data.checkbox?.value).to.eq(true)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -24,9 +24,7 @@ describe('菜单-代码块', () => {
|
|||||||
.eq(1)
|
.eq(1)
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main[2]
|
||||||
|
|
||||||
const data = payload.data[2]
|
|
||||||
|
|
||||||
expect(data.value).to.eq('log')
|
expect(data.value).to.eq('log')
|
||||||
|
|
||||||
|
|||||||
@@ -20,9 +20,7 @@ describe('菜单-日期选择器', () => {
|
|||||||
.first()
|
.first()
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].type).to.eq('date')
|
expect(data[0].type).to.eq('date')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -28,9 +28,7 @@ describe('菜单-清除格式', () => {
|
|||||||
cy.get('.menu-item__format')
|
cy.get('.menu-item__format')
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].italic).to.eq(false)
|
expect(data[0].italic).to.eq(false)
|
||||||
|
|
||||||
|
|||||||
@@ -27,9 +27,7 @@ describe('菜单-超链接', () => {
|
|||||||
.eq(1)
|
.eq(1)
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].type).to.eq('hyperlink')
|
expect(data[0].type).to.eq('hyperlink')
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ describe('菜单-图片', () => {
|
|||||||
cy.get('#image').attachFile('test.png')
|
cy.get('#image').attachFile('test.png')
|
||||||
|
|
||||||
cy.wait(200).then(() => {
|
cy.wait(200).then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
const data = payload.data
|
|
||||||
expect(data[0].type).to.eq('image')
|
expect(data[0].type).to.eq('image')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -24,9 +24,7 @@ describe('菜单-LaTeX', () => {
|
|||||||
.eq(1)
|
.eq(1)
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].type).to.eq('latex')
|
expect(data[0].type).to.eq('latex')
|
||||||
|
|
||||||
|
|||||||
@@ -36,9 +36,7 @@ describe('菜单-格式刷', () => {
|
|||||||
|
|
||||||
editor.command.executeApplyPainterStyle()
|
editor.command.executeApplyPainterStyle()
|
||||||
|
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data.length).to.eq(1)
|
expect(data.length).to.eq(1)
|
||||||
|
|
||||||
|
|||||||
@@ -23,9 +23,7 @@ describe('菜单-行处理', () => {
|
|||||||
cy.get('.menu-item__left')
|
cy.get('.menu-item__left')
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].rowFlex).to.eq('left')
|
expect(data[0].rowFlex).to.eq('left')
|
||||||
})
|
})
|
||||||
@@ -45,9 +43,7 @@ describe('菜单-行处理', () => {
|
|||||||
cy.get('.menu-item__center')
|
cy.get('.menu-item__center')
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].rowFlex).to.eq('center')
|
expect(data[0].rowFlex).to.eq('center')
|
||||||
})
|
})
|
||||||
@@ -67,9 +63,7 @@ describe('菜单-行处理', () => {
|
|||||||
cy.get('.menu-item__right')
|
cy.get('.menu-item__right')
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].rowFlex).to.eq('right')
|
expect(data[0].rowFlex).to.eq('right')
|
||||||
})
|
})
|
||||||
@@ -93,9 +87,7 @@ describe('菜单-行处理', () => {
|
|||||||
.eq(1)
|
.eq(1)
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].rowMargin).to.eq(1.25)
|
expect(data[0].rowMargin).to.eq(1.25)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -93,9 +93,7 @@ describe('菜单-搜索', () => {
|
|||||||
.find('button')
|
.find('button')
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
// 普通文本
|
// 普通文本
|
||||||
expect(data[0].value).to.be.eq(replaceText)
|
expect(data[0].value).to.be.eq(replaceText)
|
||||||
|
|||||||
@@ -20,9 +20,7 @@ describe('菜单-分割线', () => {
|
|||||||
.eq(1)
|
.eq(1)
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].type).to.eq('separator')
|
expect(data[0].type).to.eq('separator')
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,7 @@ describe('菜单-表格', () => {
|
|||||||
|
|
||||||
editor.command.executeInsertTable(8, 8)
|
editor.command.executeInsertTable(8, 8)
|
||||||
|
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].type).to.eq('table')
|
expect(data[0].type).to.eq('table')
|
||||||
|
|
||||||
|
|||||||
@@ -30,9 +30,7 @@ describe('菜单-文本处理', () => {
|
|||||||
.eq(1)
|
.eq(1)
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].font).to.eq('宋体')
|
expect(data[0].font).to.eq('宋体')
|
||||||
})
|
})
|
||||||
@@ -54,9 +52,7 @@ describe('菜单-文本处理', () => {
|
|||||||
cy.get('.menu-item__size-add')
|
cy.get('.menu-item__size-add')
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].size).to.eq(18)
|
expect(data[0].size).to.eq(18)
|
||||||
})
|
})
|
||||||
@@ -78,9 +74,7 @@ describe('菜单-文本处理', () => {
|
|||||||
cy.get('.menu-item__size-minus')
|
cy.get('.menu-item__size-minus')
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].size).to.eq(14)
|
expect(data[0].size).to.eq(14)
|
||||||
})
|
})
|
||||||
@@ -102,9 +96,7 @@ describe('菜单-文本处理', () => {
|
|||||||
cy.get('.menu-item__bold')
|
cy.get('.menu-item__bold')
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].bold).to.eq(true)
|
expect(data[0].bold).to.eq(true)
|
||||||
})
|
})
|
||||||
@@ -126,9 +118,7 @@ describe('菜单-文本处理', () => {
|
|||||||
cy.get('.menu-item__italic')
|
cy.get('.menu-item__italic')
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].italic).to.eq(true)
|
expect(data[0].italic).to.eq(true)
|
||||||
})
|
})
|
||||||
@@ -150,9 +140,7 @@ describe('菜单-文本处理', () => {
|
|||||||
cy.get('.menu-item__underline')
|
cy.get('.menu-item__underline')
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].underline).to.eq(true)
|
expect(data[0].underline).to.eq(true)
|
||||||
})
|
})
|
||||||
@@ -174,9 +162,7 @@ describe('菜单-文本处理', () => {
|
|||||||
cy.get('.menu-item__strikeout')
|
cy.get('.menu-item__strikeout')
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].strikeout).to.eq(true)
|
expect(data[0].strikeout).to.eq(true)
|
||||||
})
|
})
|
||||||
@@ -198,9 +184,7 @@ describe('菜单-文本处理', () => {
|
|||||||
cy.get('.menu-item__superscript')
|
cy.get('.menu-item__superscript')
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].type).to.eq('superscript')
|
expect(data[0].type).to.eq('superscript')
|
||||||
})
|
})
|
||||||
@@ -220,9 +204,7 @@ describe('菜单-文本处理', () => {
|
|||||||
editor.command.executeSetRange(0, textLength)
|
editor.command.executeSetRange(0, textLength)
|
||||||
|
|
||||||
cy.get('.menu-item__subscript').click().then(() => {
|
cy.get('.menu-item__subscript').click().then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].type).to.eq('subscript')
|
expect(data[0].type).to.eq('subscript')
|
||||||
})
|
})
|
||||||
@@ -243,9 +225,7 @@ describe('菜单-文本处理', () => {
|
|||||||
|
|
||||||
editor.command.executeColor('red')
|
editor.command.executeColor('red')
|
||||||
|
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].color).to.eq('red')
|
expect(data[0].color).to.eq('red')
|
||||||
})
|
})
|
||||||
@@ -265,9 +245,7 @@ describe('菜单-文本处理', () => {
|
|||||||
|
|
||||||
editor.command.executeHighlight('red')
|
editor.command.executeHighlight('red')
|
||||||
|
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
const data = payload.data
|
|
||||||
|
|
||||||
expect(data[0].highlight).to.eq('red')
|
expect(data[0].highlight).to.eq('red')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ describe('菜单-撤销&重做', () => {
|
|||||||
cy.get('.menu-item__undo')
|
cy.get('.menu-item__undo')
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
expect(payload.data[0].value).to.eq(text)
|
expect(data[0].value).to.eq(text)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -41,9 +41,9 @@ describe('菜单-撤销&重做', () => {
|
|||||||
cy.get('.menu-item__redo')
|
cy.get('.menu-item__redo')
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const payload = editor.command.getValue()
|
const data = editor.command.getValue().data.main
|
||||||
|
|
||||||
expect(payload.data[0].value).to.eq(`${text}1`)
|
expect(data[0].value).to.eq(`${text}1`)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user