diff --git a/badges/coverage-badge.svg b/badges/coverage-badge.svg index c3f8392e..1a70a667 100644 --- a/badges/coverage-badge.svg +++ b/badges/coverage-badge.svg @@ -1 +1 @@ -Statements 52.95%Statements 52.95%Branches 41.89%Branches 41.89%Lines 53.76%Lines 53.76%Functions 60.47%Functions 60.47% +Statements 47.23%Statements 47.23%Branches 34.77%Branches 34.77%Lines 48.3%Lines 48.3%Functions 53%Functions 53% diff --git a/badges/tests-badge.svg b/badges/tests-badge.svg index 515cd6b9..8d05fb3d 100644 --- a/badges/tests-badge.svg +++ b/badges/tests-badge.svg @@ -1 +1 @@ -TestsTests144/144144/144 \ No newline at end of file +TestsTests140/143140/143 \ No newline at end of file diff --git a/cypress.json b/cypress.json index e76775b3..f13b80a0 100644 --- a/cypress.json +++ b/cypress.json @@ -8,6 +8,7 @@ "ignoreTestFiles": ["**/__snapshots__/*", "**/__image_snapshots__/*"], "defaultCommandTimeout": 10000, "pageLoadTimeout": 120000, + "includeShadowDom": true, "cypress-plugin-snapshots": { "autoCleanUp": true, "prettier": true, diff --git a/cypress/fixtures/example.json b/cypress/fixtures/example.json new file mode 100644 index 00000000..da18d935 --- /dev/null +++ b/cypress/fixtures/example.json @@ -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" +} \ No newline at end of file diff --git a/cypress/integration/ui/__snapshots__/scenario.js.snap b/cypress/integration/ui/__snapshots__/scenario.js.snap index 99c631c3..afd7c8bf 100644 --- a/cypress/integration/ui/__snapshots__/scenario.js.snap +++ b/cypress/integration/ui/__snapshots__/scenario.js.snap @@ -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" > check tool_text_anchor_end #0`] = ` strokecolor="#000000" strokewidth="5" fill-opacity="1" - stroke="none" stroke-opacity="1" + stroke="none" > check tool_text_anchor_end #0`] = ` strokecolor="none" strokewidth="5" fill-opacity="1" - stroke="none" stroke-opacity="1" + stroke="none" > { - 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'); - }); - }); -}); diff --git a/cypress/integration/ui/issues/issue-407.js b/cypress/integration/ui/issues/issue-407.js index a67f2f0b..ad4a699f 100644 --- a/cypress/integration/ui/issues/issue-407.js +++ b/cypress/integration/ui/issues/issue-407.js @@ -20,7 +20,7 @@ describe('Fix issue 407', function () { hello - `, {parseSpecialCharSequences: false}); + `, {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'); }); }); diff --git a/cypress/integration/ui/issues/issue-408.js b/cypress/integration/ui/issues/issue-408.js index 47f9a874..b7524235 100644 --- a/cypress/integration/ui/issues/issue-408.js +++ b/cypress/integration/ui/issues/issue-408.js @@ -20,7 +20,7 @@ describe('Fix issue 408', function () { - `, {parseSpecialCharSequences: false}); + `, {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 diff --git a/cypress/integration/ui/scenario.js b/cypress/integration/ui/scenario.js index bdd23209..c68c8d7e 100644 --- a/cypress/integration/ui/scenario.js +++ b/cypress/integration/ui/scenario.js @@ -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(); }); diff --git a/cypress/integration/ui/tool-selection.js b/cypress/integration/ui/tool-selection.js index e8c24166..d96d37b2 100644 --- a/cypress/integration/ui/tool-selection.js +++ b/cypress/integration/ui/tool-selection.js @@ -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'); }); }); diff --git a/cypress/integration/unit/coords.js b/cypress/integration/unit/coords.js index 54ccea26..51dd7ee0 100644 --- a/cypress/integration/unit/coords.js +++ b/cypress/integration/unit/coords.js @@ -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 () { diff --git a/cypress/integration/unit/history.js b/cypress/integration/unit/history.js index 8cfdb984..aa84368c 100644 --- a/cypress/integration/unit/history.js +++ b/cypress/integration/unit/history.js @@ -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 () { diff --git a/cypress/integration/unit/math.js b/cypress/integration/unit/math.js index 9063b470..3852a2a0 100644 --- a/cypress/integration/unit/math.js +++ b/cypress/integration/unit/math.js @@ -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'); diff --git a/cypress/integration/unit/path.js b/cypress/integration/unit/path.js index ae823cc4..2c82c12e 100644 --- a/cypress/integration/unit/path.js +++ b/cypress/integration/unit/path.js @@ -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'; diff --git a/cypress/integration/unit/recalculate.js b/cypress/integration/unit/recalculate.js index f9147fe9..c1f3b0b1 100644 --- a/cypress/integration/unit/recalculate.js +++ b/cypress/integration/unit/recalculate.js @@ -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'; diff --git a/cypress/integration/unit/svgtransformlist.js b/cypress/integration/unit/svgtransformlist.js index 97fa686b..b380e01d 100644 --- a/cypress/integration/unit/svgtransformlist.js +++ b/cypress/integration/unit/svgtransformlist.js @@ -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'; diff --git a/cypress/integration/unit/utilities-bbox.js b/cypress/integration/unit/utilities-bbox.js index 09ca6642..7f6d051b 100644 --- a/cypress/integration/unit/utilities-bbox.js +++ b/cypress/integration/unit/utilities-bbox.js @@ -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'; diff --git a/cypress/integration/unit/utilities-performance.js b/cypress/integration/unit/utilities-performance.js index 6db47d1e..5eed6e93 100644 --- a/cypress/integration/unit/utilities-performance.js +++ b/cypress/integration/unit/utilities-performance.js @@ -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; diff --git a/cypress/integration/unit/utilities.js b/cypress/integration/unit/utilities.js index a5c46755..6c00c9ac 100644 --- a/cypress/integration/unit/utilities.js +++ b/cypress/integration/unit/utilities.js @@ -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 () { diff --git a/cypress/support/ui-test-helper.js b/cypress/support/ui-test-helper.js index 0c57c3aa..ef5b9b3c 100644 --- a/cypress/support/ui-test-helper.js +++ b/cypress/support/ui-test-helper.js @@ -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 = () => { diff --git a/src/common/browser.js b/src/common/browser.js index 83be6b7a..5ad51503 100644 --- a/src/common/browser.js +++ b/src/common/browser.js @@ -6,9 +6,6 @@ * @copyright 2010 Jeff Schiller, 2010 Alexis Deveria */ -// Dependencies: -// 1) jQuery (for $.alert()) - import 'pathseg'; import {NS} from './namespaces.js'; diff --git a/src/editor/LayersPanel.js b/src/editor/LayersPanel.js index fb0e7a6b..1e8d08d1 100644 --- a/src/editor/LayersPanel.js +++ b/src/editor/LayersPanel.js @@ -1,3 +1,4 @@ +/* eslint-disable no-alert */ /* globals $ */ /** @@ -27,17 +28,17 @@ class LayersPanel { /** * @returns {void} */ - async newLayer () { + newLayer () { let uniqName; let i = this.svgCanvas.getCurrentDrawing().getNumLayers(); do { uniqName = this.uiStrings.layers.layer + ' ' + (++i); } while (this.svgCanvas.getCurrentDrawing().hasLayer(uniqName)); - const newName = await $.prompt(this.uiStrings.notification.enterUniqueLayerName, uniqName); + const newName = prompt(this.uiStrings.notification.enterUniqueLayerName, uniqName); if (!newName) { return; } if (this.svgCanvas.getCurrentDrawing().hasLayer(newName)) { - /* await */ $.alert(this.uiStrings.notification.dupeLayerName); + alert(this.uiStrings.notification.dupeLayerName); return; } this.svgCanvas.createLayer(newName); @@ -63,15 +64,15 @@ class LayersPanel { /** * - * @returns {Promise} + * @returns {void} */ - async cloneLayer () { + cloneLayer () { const name = this.svgCanvas.getCurrentDrawing().getCurrentLayerName() + ' copy'; - const newName = await $.prompt(this.uiStrings.notification.enterUniqueLayerName, name); + const newName = prompt(this.uiStrings.notification.enterUniqueLayerName, name); if (!newName) { return; } if (this.svgCanvas.getCurrentDrawing().hasLayer(newName)) { - /* await */ $.alert(this.uiStrings.notification.dupeLayerName); + alert(this.uiStrings.notification.dupeLayerName); return; } this.svgCanvas.cloneLayer(newName); @@ -110,13 +111,13 @@ class LayersPanel { /** * @returns {void} */ - async layerRename () { + layerRename () { // const curIndex = $('#layerlist tr.layersel').prevAll().length; // Currently unused const oldName = $('#layerlist tr.layersel td.layername').text(); - const newName = await $.prompt(this.uiStrings.notification.enterNewLayerName, ''); + const newName = prompt(this.uiStrings.notification.enterNewLayerName, ''); if (!newName) { return; } if (oldName === newName || this.svgCanvas.getCurrentDrawing().hasLayer(newName)) { - /* await */ $.alert(this.uiStrings.notification.layerHasThatName); + alert(this.uiStrings.notification.layerHasThatName); return; } this.svgCanvas.renameCurrentLayer(newName); diff --git a/src/editor/components/PaintBox.js b/src/editor/components/PaintBox.js index b4cbce3d..eb2a89e2 100644 --- a/src/editor/components/PaintBox.js +++ b/src/editor/components/PaintBox.js @@ -138,22 +138,6 @@ class PaintBox { this.setPaint(paint); return (paint); } - - /** - * @returns {void} - */ - prep () { - const ptype = this.paint.type; - - switch (ptype) { - case 'linearGradient': - case 'radialGradient': { - const paint = new $.jGraduate.Paint({copy: this.paint}); - this.setPaint(this.type, paint); - break; - } - } - } } PaintBox.ctr = 0; diff --git a/src/editor/components/jgraduate/jQuery.jGraduate.js b/src/editor/components/jgraduate/jQuery.jGraduate.js index 8b571617..81f3d84a 100644 --- a/src/editor/components/jgraduate/jQuery.jGraduate.js +++ b/src/editor/components/jgraduate/jQuery.jGraduate.js @@ -283,7 +283,8 @@ export default function jQueryPluginJGraduate ($) { const $wc = (selector) => $($shadowRoot.querySelectorAll(selector)); if (!idref) { - /* await */ $.alert('Container element must have an id attribute to maintain unique id strings for sub-elements.'); + // eslint-disable-next-line no-alert + alert('Container element must have an id attribute to maintain unique id strings for sub-elements.'); return; } diff --git a/src/editor/components/seMenuItem.js b/src/editor/components/seMenuItem.js index 48112456..288ea17e 100644 --- a/src/editor/components/seMenuItem.js +++ b/src/editor/components/seMenuItem.js @@ -8,7 +8,7 @@ template.innerHTML = `
- icon + icon
diff --git a/src/editor/components/seSpinInput.js b/src/editor/components/seSpinInput.js index 9a8b0d9f..78ebc01c 100644 --- a/src/editor/components/seSpinInput.js +++ b/src/editor/components/seSpinInput.js @@ -18,7 +18,7 @@ template.innerHTML = ` padding: 0px; } - icon + icon label `; diff --git a/src/editor/dialogs/cmenuDialog.js b/src/editor/dialogs/cmenuDialog.js index 6d6750ef..b47a5458 100644 --- a/src/editor/dialogs/cmenuDialog.js +++ b/src/editor/dialogs/cmenuDialog.js @@ -184,7 +184,7 @@ export class SeCMenuDialog extends HTMLElement { }); break; default: - super.attributeChangedCallback(name, oldValue, newValue); + // super.attributeChangedCallback(name, oldValue, newValue); break; } } diff --git a/src/editor/dialogs/cmenuLayersDialog.js b/src/editor/dialogs/cmenuLayersDialog.js index 94707834..0623662f 100644 --- a/src/editor/dialogs/cmenuLayersDialog.js +++ b/src/editor/dialogs/cmenuLayersDialog.js @@ -115,7 +115,7 @@ export class SeCMenuLayerDialog extends HTMLElement { } break; default: - super.attributeChangedCallback(name, oldValue, newValue); + // super.attributeChangedCallback(name, oldValue, newValue); break; } } diff --git a/src/editor/dialogs/editorPreferencesDialog.js b/src/editor/dialogs/editorPreferencesDialog.js index f693a334..e8a6b167 100644 --- a/src/editor/dialogs/editorPreferencesDialog.js +++ b/src/editor/dialogs/editorPreferencesDialog.js @@ -194,11 +194,11 @@ template.innerHTML = `
Grid -