parent
3896b86b5d
commit
b87c9497dc
@ -0,0 +1,42 @@
|
||||
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 url = 'https://hufe.club/canvas-editor'
|
||||
|
||||
it('超链接', () => {
|
||||
cy.getEditor().then((editor: Editor) => {
|
||||
editor.listener.saved = function (payload) {
|
||||
const data = payload.data
|
||||
|
||||
expect(data[0].type).to.eq('hyperlink')
|
||||
|
||||
expect(data[0].url).to.eq(url)
|
||||
|
||||
expect(data[0]?.valueList?.[0].value).to.eq(text)
|
||||
}
|
||||
|
||||
editor.command.executeSelectAll()
|
||||
|
||||
editor.command.executeBackspace()
|
||||
|
||||
cy.get('.menu-item__hyperlink').click()
|
||||
|
||||
cy.get('.dialog-option__item [name="name"]').type(text)
|
||||
|
||||
cy.get('.dialog-option__item [name="url"]').type(url)
|
||||
|
||||
cy.get('.dialog-menu button').eq(1).click()
|
||||
|
||||
cy.get('@canvas').type('{ctrl}s')
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
Loading…
Reference in new issue