Fix undo on converting rectangle to path creating an exception (#703)
parent
0a6cce903e
commit
7704bc436c
|
@ -0,0 +1,29 @@
|
|||
import {
|
||||
visitAndApproveStorage
|
||||
} from '../../../support/ui-test-helper.js'
|
||||
|
||||
// See https://github.com/SVG-Edit/svgedit/issues/699
|
||||
describe('Fix issue 699', function () {
|
||||
beforeEach(() => {
|
||||
visitAndApproveStorage()
|
||||
})
|
||||
|
||||
it('should not throw error when undoing and redoing convert to path for a rectangle', function () {
|
||||
cy.get('#tool_rect')
|
||||
.click({ force: true })
|
||||
cy.get('#svgcontent')
|
||||
.trigger('mousedown', 150, 150, { force: true })
|
||||
.trigger('mousemove', 250, 200, { force: true })
|
||||
.trigger('mouseup', { force: true })
|
||||
cy.get('#tool_topath') // Check if undo redo is correct for tool_topath with tool_rect
|
||||
.click({ force: true })
|
||||
cy.get('#tool_undo')
|
||||
.click({ force: true })
|
||||
cy.get('#tool_redo')
|
||||
.click({ force: true })
|
||||
cy.get('#tool_undo') // Do twice just to make sure
|
||||
.click({ force: true })
|
||||
cy.get('#tool_redo')
|
||||
.click({ force: true })
|
||||
})
|
||||
})
|
|
@ -760,11 +760,11 @@ export const convertToPath = (elem, attrs, svgCanvas) => {
|
|||
}
|
||||
|
||||
const { nextSibling } = elem
|
||||
batchCmd.addSubCommand(new svgCanvas.history.RemoveElementCommand(elem, nextSibling, parent))
|
||||
batchCmd.addSubCommand(new svgCanvas.history.InsertElementCommand(path))
|
||||
|
||||
batchCmd.addSubCommand(new svgCanvas.history.RemoveElementCommand(elem, nextSibling, elem.parentNode))
|
||||
svgCanvas.clearSelection()
|
||||
elem.remove()
|
||||
|
||||
batchCmd.addSubCommand(new svgCanvas.history.InsertElementCommand(path))
|
||||
path.setAttribute('id', id)
|
||||
path.removeAttribute('visibility')
|
||||
svgCanvas.addToSelection([path], true)
|
||||
|
|
Loading…
Reference in New Issue