From 0c1c7d5b12864f054d86b438c7b7daf61d5d5539 Mon Sep 17 00:00:00 2001 From: JFH Date: Sat, 20 Jun 2020 13:12:19 +0200 Subject: [PATCH] add cypress tests for issues #407 and #408 --- cypress/integration/ui/issues/issue-407.js | 30 ++++++++++++++++++++++ cypress/integration/ui/issues/issue-408.js | 29 +++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 cypress/integration/ui/issues/issue-407.js create mode 100644 cypress/integration/ui/issues/issue-408.js diff --git a/cypress/integration/ui/issues/issue-407.js b/cypress/integration/ui/issues/issue-407.js new file mode 100644 index 00000000..f56e9002 --- /dev/null +++ b/cypress/integration/ui/issues/issue-407.js @@ -0,0 +1,30 @@ +import { + visitAndApproveStorage +} from '../../../support/ui-test-helper.js'; + +// See https://github.com/SVG-Edit/svgedit/issues/407 +describe('Fix issue 407: can enter edit on text child', function () { + beforeEach(() => { + visitAndApproveStorage(); + }); + + it('should set rectangle selection after click', function () { + cy.get('#tool_source').click(); + cy.get('#svg_source_textarea') + .type('{selectall}') + .type(` + + Layer 1 + + + hello + + + `, {parseSpecialCharSequences: false}); + cy.get('#tool_source_save').click(); + cy.get('#svg_1').click().dblclick(); + cy.get('#a_text').should('exist'); + cy.get('#a_text').trigger('mousedown', {which: 1}).trigger('mouseup').dblclick().type('1234'); + cy.get('#a_text').should('have.text', 'he1234llo'); + }); +}); diff --git a/cypress/integration/ui/issues/issue-408.js b/cypress/integration/ui/issues/issue-408.js new file mode 100644 index 00000000..acccc70a --- /dev/null +++ b/cypress/integration/ui/issues/issue-408.js @@ -0,0 +1,29 @@ +import { + visitAndApproveStorage +} from '../../../support/ui-test-helper.js'; + +// See https://github.com/SVG-Edit/svgedit/issues/408 +describe('Fix issue 408: does not throw when showing/saving svg content', function () { + beforeEach(() => { + visitAndApproveStorage(); + }); + + it('should set rectangle selection after click', function () { + cy.get('#tool_source').click(); + cy.get('#svg_source_textarea') + .type('{selectall}') + .type(` + + Layer 1 + + + + + + `, {parseSpecialCharSequences: false}); + cy.get('#tool_source_save').click(); + cy.get('#svg_6').click().dblclick(); // change context + cy.get('#tool_source').click(); // reopen tool_source + cy.get('#tool_source_save').should('exist'); // The save button should be here if it does not throw + }); +});