jquery removal, isolate svgcavas from svgedit, tests

This commit is contained in:
JFH
2020-12-26 00:08:54 +01:00
parent 9bf5f559bb
commit c0ca1dd621
58 changed files with 166 additions and 391 deletions

View File

@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}

View File

@@ -880,8 +880,8 @@ exports[`use various parts of svg-edit > check tool_text_anchor_middle #0`] = `
strokecolor="#000000"
strokewidth="5"
fill-opacity="1"
stroke="none"
stroke-opacity="1"
stroke="none"
></polygon>
<polygon
cx="115"
@@ -1016,8 +1016,8 @@ exports[`use various parts of svg-edit > check tool_text_anchor_end #0`] = `
strokecolor="#000000"
strokewidth="5"
fill-opacity="1"
stroke="none"
stroke-opacity="1"
stroke="none"
></polygon>
<polygon
cx="115"
@@ -1031,8 +1031,8 @@ exports[`use various parts of svg-edit > check tool_text_anchor_end #0`] = `
strokecolor="none"
strokewidth="5"
fill-opacity="1"
stroke="none"
stroke-opacity="1"
stroke="none"
></polygon>
<polygon
cx="115"

View File

@@ -1,21 +0,0 @@
import {
visitAndApproveStorage
} from '../../../support/ui-test-helper.js';
// See https://github.com/SVG-Edit/svgedit/issues/364
describe('Issue 364; IE errorwith rectangle selection by click', function () {
beforeEach(() => {
visitAndApproveStorage();
});
it('should set rectangle selection after click', function () {
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.get('#tools_rect_show')
.trigger('mousedown', {force: true})
.wait(100) // this delay seems necessary
.trigger('mouseup', {force: true})
.should((button) => {
expect(button).to.have.class('tool_button_current');
});
});
});

View File

@@ -20,7 +20,7 @@ describe('Fix issue 407', function () {
<text fill="#000000" id="a_text" text-anchor="middle" x="260.5" xml:space="preserve" y="192.5">hello</text>
</g>
</g>
</svg>`, {parseSpecialCharSequences: false});
</svg>`, {force: true, parseSpecialCharSequences: false});
cy.get('#tool_source_save').click();
cy.get('#svg_1').click().dblclick();
cy.get('#a_text').should('exist');
@@ -30,6 +30,6 @@ describe('Fix issue 407', function () {
.dblclick({force: true});
// svgedit use the #text text field to capture the text
cy.get('#text').type('1234', {force: true});
cy.get('#a_text').should('have.text', 'he1234llo');
cy.get('#a_text').should('have.text', 'hell1234o');
});
});

View File

@@ -20,7 +20,7 @@ describe('Fix issue 408', function () {
<circle cx="117.5" cy="87.5" fill="#ffff00" r="19.84943" stroke="#000000" />
</g>
</g>
</svg>`, {parseSpecialCharSequences: false});
</svg>`, {force: true, parseSpecialCharSequences: false});
cy.get('#tool_source_save').click();
cy.get('#svg_6').click().dblclick(); // change context
cy.get('#tool_source').click(); // reopen tool_source

View File

@@ -41,7 +41,6 @@ describe('use various parts of svg-edit', function () {
.trigger('mousedown', 'center', {force: true})
.trigger('mouseup', {force: true});
// svgedit use the #text text field to capture the text
// cy.get('#text').type('1234', {force: true});
cy.get('#text').type('B', {force: true});
testSnapshot();
});

View File

@@ -8,13 +8,10 @@ describe('UI - Tool selection', function () {
});
it('should set rectangle selection by click', function () {
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.get('#tools_rect_show')
.trigger('mousedown', {force: true})
.wait(100) // this delay seems necessary
.trigger('mouseup', {force: true})
.should((button) => {
expect(button).to.have.class('tool_button_current');
});
cy.get('#tools_rect')
.should('not.have.attr', 'pressed');
cy.get('#tools_rect')
.trigger('click', {force: true})
.should('have.attr', 'pressed');
});
});

View File

@@ -1,7 +1,7 @@
import '../../../instrumented/editor/jquery.min.js';
import {NS} from '../../../instrumented/common/namespaces.js';
import * as utilities from '../../../instrumented/common/utilities.js';
import * as utilities from '../../../instrumented/svgcanvas/utilities.js';
import * as coords from '../../../instrumented/svgcanvas/coords.js';
describe('coords', function () {

View File

@@ -1,8 +1,8 @@
import '../../../instrumented/editor/jquery.min.js';
import {NS} from '../../../instrumented/common/namespaces.js';
import * as transformlist from '../../../instrumented/common/svgtransformlist.js';
import * as utilities from '../../../instrumented/common/utilities.js';
import * as transformlist from '../../../instrumented/svgcanvas/svgtransformlist.js';
import * as utilities from '../../../instrumented/svgcanvas/utilities.js';
import * as hstory from '../../../instrumented/svgcanvas/history.js';
describe('history', function () {

View File

@@ -1,7 +1,7 @@
import '../../../instrumented/editor/jquery.min.js';
import {NS} from '../../../instrumented/common/namespaces.js';
import * as math from '../../../instrumented/common/math.js';
import * as math from '../../../instrumented/svgcanvas/math.js';
describe('math', function () {
const svg = document.createElementNS(NS.SVG, 'svg');

View File

@@ -4,7 +4,7 @@ import 'pathseg';
import '../../../instrumented/editor/jquery.min.js';
import {NS} from '../../../instrumented/common/namespaces.js';
import * as utilities from '../../../instrumented/common/utilities.js';
import * as utilities from '../../../instrumented/svgcanvas/utilities.js';
import * as pathModule from '../../../instrumented/svgcanvas/path.js';
import {Path, Segment} from '../../../instrumented/svgcanvas/path-method.js';
import {init as unitsInit} from '../../../instrumented/common/units.js';

View File

@@ -1,7 +1,7 @@
import '../../../instrumented/editor/jquery.min.js';
import {NS} from '../../../instrumented/common/namespaces.js';
import * as utilities from '../../../instrumented/common/utilities.js';
import * as utilities from '../../../instrumented/svgcanvas/utilities.js';
import * as coords from '../../../instrumented/svgcanvas/coords.js';
import * as recalculate from '../../../instrumented/svgcanvas/recalculate.js';

View File

@@ -1,7 +1,7 @@
import '../../../instrumented/editor/jquery.min.js';
import {NS} from '../../../instrumented/common/namespaces.js';
import * as transformlist from '../../../instrumented/common/svgtransformlist.js';
import * as transformlist from '../../../instrumented/svgcanvas/svgtransformlist.js';
import {disableSupportsNativeTransformLists} from '../../../instrumented/common/browser.js';
import almostEqualsPlugin from '../../support/assert-almostEquals.js';

View File

@@ -4,9 +4,9 @@ import 'pathseg';
import '../../../instrumented/editor/jquery.min.js';
import {NS} from '../../../instrumented/common/namespaces.js';
import * as utilities from '../../../instrumented/common/utilities.js';
import * as transformlist from '../../../instrumented/common/svgtransformlist.js';
import * as math from '../../../instrumented/common/math.js';
import * as utilities from '../../../instrumented/svgcanvas/utilities.js';
import * as transformlist from '../../../instrumented/svgcanvas/svgtransformlist.js';
import * as math from '../../../instrumented/svgcanvas/math.js';
import * as path from '../../../instrumented/svgcanvas/path.js';
import setAssertionMethods from '../../support/assert-close.js';

View File

@@ -3,9 +3,9 @@ import 'pathseg';
import '../../../instrumented/editor/jquery.min.js';
import {NS} from '../../../instrumented/common/namespaces.js';
import * as utilities from '../../../instrumented/common/utilities.js';
import * as transformlist from '../../../instrumented/common/svgtransformlist.js';
import * as math from '../../../instrumented/common/math.js';
import * as utilities from '../../../instrumented/svgcanvas/utilities.js';
import * as transformlist from '../../../instrumented/svgcanvas/svgtransformlist.js';
import * as math from '../../../instrumented/svgcanvas/math.js';
describe('utilities performance', function () {
let currentLayer, groupWithMatrixTransform, textWithMatrixTransform;

View File

@@ -2,7 +2,7 @@
import '../../../instrumented/editor/jquery.min.js';
import * as browser from '../../../instrumented/common/browser.js';
import * as utilities from '../../../instrumented/common/utilities.js';
import * as utilities from '../../../instrumented/svgcanvas/utilities.js';
import {NS} from '../../../instrumented/common/namespaces.js';
describe('utilities', function () {

View File

@@ -1,5 +1,6 @@
export const approveStorage = () => {
return cy.get('#dialog_buttons > input[type=button][data-ok]')
// JFH will need to be chnaged when dialog is changed...
cy.get('elix-alert-dialog').shadow().find('#choiceButtonContainer > plain-border-button-0:nth-child(1)')
.click();
};
@@ -9,7 +10,7 @@ export const visitAndApproveStorage = () => {
};
export const openMainMenu = () => {
return cy.get('#main_icon').click();
return cy.get('#main_button').click();
};
export const openEditorPreferences = () => {