diff --git a/.eslintrc.js b/.eslintrc.js
index 5b10b10a..2b378572 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -66,7 +66,10 @@ module.exports = {
// environments; see also discussion above
// `mocha-cleanup/no-assertions-outside-it`
'jsdoc/check-examples': ['warn', {
- rejectExampleCodeRegex: '^`'
+ rejectExampleCodeRegex: '^`',
+ checkDefaults: true,
+ checkParams: true,
+ checkProperties: true
}],
// https://github.com/sindresorhus/eslint-plugin-unicorn/issues/453
diff --git a/badges/coverage-badge.svg b/badges/coverage-badge.svg
index 9bc0323a..3bed2c32 100644
--- a/badges/coverage-badge.svg
+++ b/badges/coverage-badge.svg
@@ -1 +1 @@
-
+
diff --git a/badges/licenses-badge-dev.svg b/badges/licenses-badge-dev.svg
index a7a34ae9..014c8f4a 100644
--- a/badges/licenses-badge-dev.svg
+++ b/badges/licenses-badge-dev.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/badges/licenses-badge.svg b/badges/licenses-badge.svg
index 5ed9448a..b93de2fe 100644
--- a/badges/licenses-badge.svg
+++ b/badges/licenses-badge.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ 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 d4d91bdb..21aa0bf8 100644
--- a/cypress/integration/ui/__snapshots__/scenario.js.snap
+++ b/cypress/integration/ui/__snapshots__/scenario.js.snap
@@ -10,8 +10,8 @@ exports[`use various parts of svg-edit > check tool_source #0`] = `
y="480"
viewBox="0 0 640 480"
>
-
- Layer 1
+
+ Layer 1
check tool_source #0`] = `
width="94"
x="69.5"
y="51.5"
- style="pointer-events:inherit"
>
@@ -70,8 +69,8 @@ exports[`use various parts of svg-edit > check tool_text #0`] = `
y="480"
viewBox="0 0 640 480"
>
-
- Layer 1
+
+ Layer 1
check tool_text #0`] = `
width="94"
x="69.5"
y="51.5"
- style="pointer-events:inherit"
fill-opacity="1"
stroke-opacity="1"
>
@@ -89,7 +87,6 @@ exports[`use various parts of svg-edit > check tool_text #0`] = `
fill="#000000"
stroke="#000000"
stroke-width="0"
- style="pointer-events: inherit; cursor: text;"
x="116"
y="87"
id="svg_1"
@@ -118,8 +115,8 @@ exports[`use various parts of svg-edit > check tool_clone #0`] = `
y="480"
viewBox="0 0 640 480"
>
-
- Layer 1
+
+ Layer 1
check tool_clone #0`] = `
width="94"
x="69.5"
y="51.5"
- style="pointer-events:inherit"
fill-opacity="1"
stroke-opacity="1"
>
@@ -181,8 +177,8 @@ exports[`use various parts of svg-edit > check tool_italic #0`] = `
y="480"
viewBox="0 0 640 480"
>
-
- Layer 1
+
+ Layer 1
check tool_italic #0`] = `
width="94"
x="69.5"
y="51.5"
- style="pointer-events:inherit"
fill-opacity="1"
stroke-opacity="1"
>
@@ -209,7 +204,7 @@ exports[`use various parts of svg-edit > check tool_italic #0`] = `
xml:space="preserve"
fill-opacity="1"
stroke-opacity="1"
- font-style="italic"
+ font-=""
>
B
@@ -245,8 +240,8 @@ exports[`use various parts of svg-edit > check tool_bold #0`] = `
y="480"
viewBox="0 0 640 480"
>
-
- Layer 1
+
+ Layer 1
check tool_bold #0`] = `
width="94"
x="69.5"
y="51.5"
- style="pointer-events:inherit"
fill-opacity="1"
stroke-opacity="1"
>
@@ -273,7 +267,7 @@ exports[`use various parts of svg-edit > check tool_bold #0`] = `
xml:space="preserve"
fill-opacity="1"
stroke-opacity="1"
- font-style="italic"
+ font-=""
font-weight="bold"
>
B
@@ -310,8 +304,8 @@ exports[`use various parts of svg-edit > check change color #0`] = `
y="480"
viewBox="0 0 640 480"
>
-
- Layer 1
+
+ Layer 1
check change color #0`] = `
width="94"
x="69.5"
y="51.5"
- style="pointer-events:inherit"
fill-opacity="1"
stroke-opacity="1"
>
@@ -338,7 +331,7 @@ exports[`use various parts of svg-edit > check change color #0`] = `
xml:space="preserve"
fill-opacity="1"
stroke-opacity="1"
- font-style="italic"
+ font-=""
font-weight="bold"
>
B
diff --git a/cypress/integration/ui/scenario.js b/cypress/integration/ui/scenario.js
index c84dbe11..47bd5f2a 100644
--- a/cypress/integration/ui/scenario.js
+++ b/cypress/integration/ui/scenario.js
@@ -3,10 +3,7 @@ import {
} from '../../support/ui-test-helper.js';
const testSnapshot = () => {
- // cy.get('#tool_source').click({force: true});
- // cy.get('#svg_source_textarea').invoke('val').toMatchSnapshot();
- // cy.get('#tool_source_save').click({force: true});
- cy.get('#svgcontent').toMatchSnapshot();
+ cy.get('#svgcontent').cleanSnapshot();
};
describe('use various parts of svg-edit', function () {
diff --git a/cypress/integration/ui/tool-selection.js b/cypress/integration/ui/tool-selection.js
index 8443f783..e8c24166 100644
--- a/cypress/integration/ui/tool-selection.js
+++ b/cypress/integration/ui/tool-selection.js
@@ -8,9 +8,11 @@ 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})
- .trigger('mouseup', {force: true, timeout: 10000})
+ .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/unit/test1.js b/cypress/integration/unit/test1.js
index 4b23449f..26cb407e 100644
--- a/cypress/integration/unit/test1.js
+++ b/cypress/integration/unit/test1.js
@@ -4,8 +4,6 @@ import '../../../instrumented/editor/jquery-ui/jquery-ui-1.8.17.custom.min.js';
import SvgCanvas from '../../../instrumented/svgcanvas/svgcanvas.js';
-// import '../../../instrumented/'
-
describe('Basic Module', function () {
// helper functions
/*
diff --git a/cypress/support/commands.js b/cypress/support/commands.js
index ca4d256f..c64ca1ef 100644
--- a/cypress/support/commands.js
+++ b/cypress/support/commands.js
@@ -23,3 +23,26 @@
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
+
+// remove the style attributes that is causing differences in snapshots
+const ngAttributes = ['style'];
+
+Cypress.Commands.add(
+ 'cleanSnapshot',
+ {
+ prevSubject: true
+ },
+ (subject, snapshotOptions) => {
+ let html = subject[0].outerHTML;
+
+ for (const attribute of ngAttributes) {
+ const expression = new RegExp(`${attribute}[^= ]*="[^"]*"`, 'g');
+ html = html.replace(expression, '');
+ }
+ html = html.replace(//g, '');
+
+ const sanitisedBody = new DOMParser().parseFromString(html, 'text/html').querySelector('body');
+
+ return cy.wrap(sanitisedBody.firstChild).toMatchSnapshot();
+ }
+);
diff --git a/dist/editor/index.js b/dist/editor/index.js
index a7d2ef86..513c209f 100644
--- a/dist/editor/index.js
+++ b/dist/editor/index.js
@@ -1,5 +1,5 @@
-var Tn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(Tn,Un,Qn){return Tn(Qn={path:Un,exports:{},require:function(Tn,Un){return function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==Un&&Qn.path)}},Qn.exports),Qn.exports}var check=function(Tn){return Tn&&Tn.Math==Math&&Tn},Un=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof Tn&&Tn)||Function("return this")(),fails=function(Tn){try{return!!Tn()}catch(Tn){return!0}},Qn=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),Dn={}.propertyIsEnumerable,Hn=Object.getOwnPropertyDescriptor,Gn={f:Hn&&!Dn.call({1:2},1)?function propertyIsEnumerable(Tn){var Un=Hn(this,Tn);return!!Un&&Un.enumerable}:Dn},createPropertyDescriptor=function(Tn,Un){return{enumerable:!(1&Tn),configurable:!(2&Tn),writable:!(4&Tn),value:Un}},Vn={}.toString,classofRaw=function(Tn){return Vn.call(Tn).slice(8,-1)},zn="".split,Kn=fails((function(){return!Object("z").propertyIsEnumerable(0)}))?function(Tn){return"String"==classofRaw(Tn)?zn.call(Tn,""):Object(Tn)}:Object,requireObjectCoercible=function(Tn){if(null==Tn)throw TypeError("Can't call method on "+Tn);return Tn},toIndexedObject=function(Tn){return Kn(requireObjectCoercible(Tn))},isObject=function(Tn){return"object"==typeof Tn?null!==Tn:"function"==typeof Tn},toPrimitive=function(Tn,Un){if(!isObject(Tn))return Tn;var Qn,Dn;if(Un&&"function"==typeof(Qn=Tn.toString)&&!isObject(Dn=Qn.call(Tn)))return Dn;if("function"==typeof(Qn=Tn.valueOf)&&!isObject(Dn=Qn.call(Tn)))return Dn;if(!Un&&"function"==typeof(Qn=Tn.toString)&&!isObject(Dn=Qn.call(Tn)))return Dn;throw TypeError("Can't convert object to primitive value")},Wn={}.hasOwnProperty,has=function(Tn,Un){return Wn.call(Tn,Un)},Xn=Un.document,Yn=isObject(Xn)&&isObject(Xn.createElement),documentCreateElement=function(Tn){return Yn?Xn.createElement(Tn):{}},Jn=!Qn&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),$n=Object.getOwnPropertyDescriptor,Zn={f:Qn?$n:function getOwnPropertyDescriptor(Tn,Un){if(Tn=toIndexedObject(Tn),Un=toPrimitive(Un,!0),Jn)try{return $n(Tn,Un)}catch(Tn){}if(has(Tn,Un))return createPropertyDescriptor(!Gn.f.call(Tn,Un),Tn[Un])}},anObject=function(Tn){if(!isObject(Tn))throw TypeError(String(Tn)+" is not an object");return Tn},er=Object.defineProperty,tr={f:Qn?er:function defineProperty(Tn,Un,Qn){if(anObject(Tn),Un=toPrimitive(Un,!0),anObject(Qn),Jn)try{return er(Tn,Un,Qn)}catch(Tn){}if("get"in Qn||"set"in Qn)throw TypeError("Accessors not supported");return"value"in Qn&&(Tn[Un]=Qn.value),Tn}},nr=Qn?function(Tn,Un,Qn){return tr.f(Tn,Un,createPropertyDescriptor(1,Qn))}:function(Tn,Un,Qn){return Tn[Un]=Qn,Tn},setGlobal=function(Tn,Qn){try{nr(Un,Tn,Qn)}catch(Dn){Un[Tn]=Qn}return Qn},rr=Un["__core-js_shared__"]||setGlobal("__core-js_shared__",{}),ir=Function.toString;"function"!=typeof rr.inspectSource&&(rr.inspectSource=function(Tn){return ir.call(Tn)});var or,ar,sr,lr=rr.inspectSource,cr=Un.WeakMap,ur="function"==typeof cr&&/native code/.test(lr(cr)),dr=createCommonjsModule((function(Tn){(Tn.exports=function(Tn,Un){return rr[Tn]||(rr[Tn]=void 0!==Un?Un:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),hr=0,pr=Math.random(),uid=function(Tn){return"Symbol("+String(void 0===Tn?"":Tn)+")_"+(++hr+pr).toString(36)},Ar=dr("keys"),sharedKey=function(Tn){return Ar[Tn]||(Ar[Tn]=uid(Tn))},fr={},gr=Un.WeakMap;if(ur){var mr=new gr,_r=mr.get,vr=mr.has,yr=mr.set;or=function(Tn,Un){return yr.call(mr,Tn,Un),Un},ar=function(Tn){return _r.call(mr,Tn)||{}},sr=function(Tn){return vr.call(mr,Tn)}}else{var wr=sharedKey("state");fr[wr]=!0,or=function(Tn,Un){return nr(Tn,wr,Un),Un},ar=function(Tn){return has(Tn,wr)?Tn[wr]:{}},sr=function(Tn){return has(Tn,wr)}}var br,xr,Sr={set:or,get:ar,has:sr,enforce:function(Tn){return sr(Tn)?ar(Tn):or(Tn,{})},getterFor:function(Tn){return function(Un){var Qn;if(!isObject(Un)||(Qn=ar(Un)).type!==Tn)throw TypeError("Incompatible receiver, "+Tn+" required");return Qn}}},kr=createCommonjsModule((function(Tn){var Qn=Sr.get,Dn=Sr.enforce,Hn=String(String).split("String");(Tn.exports=function(Tn,Qn,Gn,Vn){var zn=!!Vn&&!!Vn.unsafe,Kn=!!Vn&&!!Vn.enumerable,Wn=!!Vn&&!!Vn.noTargetGet;"function"==typeof Gn&&("string"!=typeof Qn||has(Gn,"name")||nr(Gn,"name",Qn),Dn(Gn).source=Hn.join("string"==typeof Qn?Qn:"")),Tn!==Un?(zn?!Wn&&Tn[Qn]&&(Kn=!0):delete Tn[Qn],Kn?Tn[Qn]=Gn:nr(Tn,Qn,Gn)):Kn?Tn[Qn]=Gn:setGlobal(Qn,Gn)})(Function.prototype,"toString",(function toString(){return"function"==typeof this&&Qn(this).source||lr(this)}))})),Cr=Un,aFunction=function(Tn){return"function"==typeof Tn?Tn:void 0},getBuiltIn=function(Tn,Qn){return arguments.length<2?aFunction(Cr[Tn])||aFunction(Un[Tn]):Cr[Tn]&&Cr[Tn][Qn]||Un[Tn]&&Un[Tn][Qn]},Br=Math.ceil,Er=Math.floor,toInteger=function(Tn){return isNaN(Tn=+Tn)?0:(Tn>0?Er:Br)(Tn)},Nr=Math.min,toLength=function(Tn){return Tn>0?Nr(toInteger(Tn),9007199254740991):0},Lr=Math.max,Tr=Math.min,toAbsoluteIndex=function(Tn,Un){var Qn=toInteger(Tn);return Qn<0?Lr(Qn+Un,0):Tr(Qn,Un)},createMethod=function(Tn){return function(Un,Qn,Dn){var Hn,Gn=toIndexedObject(Un),Vn=toLength(Gn.length),zn=toAbsoluteIndex(Dn,Vn);if(Tn&&Qn!=Qn){for(;Vn>zn;)if((Hn=Gn[zn++])!=Hn)return!0}else for(;Vn>zn;zn++)if((Tn||zn in Gn)&&Gn[zn]===Qn)return Tn||zn||0;return!Tn&&-1}},Pr={includes:createMethod(!0),indexOf:createMethod(!1)},Fr=Pr.indexOf,objectKeysInternal=function(Tn,Un){var Qn,Dn=toIndexedObject(Tn),Hn=0,Gn=[];for(Qn in Dn)!has(fr,Qn)&&has(Dn,Qn)&&Gn.push(Qn);for(;Un.length>Hn;)has(Dn,Qn=Un[Hn++])&&(~Fr(Gn,Qn)||Gn.push(Qn));return Gn},Ur=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ir=Ur.concat("length","prototype"),Rr={f:Object.getOwnPropertyNames||function getOwnPropertyNames(Tn){return objectKeysInternal(Tn,Ir)}},Mr={f:Object.getOwnPropertySymbols},Qr=getBuiltIn("Reflect","ownKeys")||function ownKeys(Tn){var Un=Rr.f(anObject(Tn)),Qn=Mr.f;return Qn?Un.concat(Qn(Tn)):Un},copyConstructorProperties=function(Tn,Un){for(var Qn=Qr(Un),Dn=tr.f,Hn=Zn.f,Gn=0;Gn=74)&&(br=Zr.match(/Chrome\/(\d+)/))&&(xr=br[1]);var ri=xr&&+xr,ii=wellKnownSymbol("species"),arrayMethodHasSpeciesSupport=function(Tn){return ri>=51||!fails((function(){var Un=[];return(Un.constructor={})[ii]=function(){return{foo:1}},1!==Un[Tn](Boolean).foo}))},oi=wellKnownSymbol("isConcatSpreadable"),ai=ri>=51||!fails((function(){var Tn=[];return Tn[oi]=!1,Tn.concat()[0]!==Tn})),si=arrayMethodHasSpeciesSupport("concat"),isConcatSpreadable=function(Tn){if(!isObject(Tn))return!1;var Un=Tn[oi];return void 0!==Un?!!Un:Kr(Tn)};_export({target:"Array",proto:!0,forced:!ai||!si},{concat:function concat(Tn){var Un,Qn,Dn,Hn,Gn,Vn=toObject(this),zn=arraySpeciesCreate(Vn,0),Kn=0;for(Un=-1,Dn=arguments.length;Un9007199254740991)throw TypeError("Maximum allowed index exceeded");for(Qn=0;Qn=9007199254740991)throw TypeError("Maximum allowed index exceeded");createProperty(zn,Kn++,Gn)}return zn.length=Kn,zn}});var aFunction$1=function(Tn){if("function"!=typeof Tn)throw TypeError(String(Tn)+" is not a function");return Tn},functionBindContext=function(Tn,Un,Qn){if(aFunction$1(Tn),void 0===Un)return Tn;switch(Qn){case 0:return function(){return Tn.call(Un)};case 1:return function(Qn){return Tn.call(Un,Qn)};case 2:return function(Qn,Dn){return Tn.call(Un,Qn,Dn)};case 3:return function(Qn,Dn,Hn){return Tn.call(Un,Qn,Dn,Hn)}}return function(){return Tn.apply(Un,arguments)}},li=[].push,createMethod$1=function(Tn){var Un=1==Tn,Qn=2==Tn,Dn=3==Tn,Hn=4==Tn,Gn=6==Tn,Vn=5==Tn||Gn;return function(zn,Wn,Xn,Yn){for(var Jn,$n,Zn=toObject(zn),er=Kn(Zn),tr=functionBindContext(Wn,Xn,3),nr=toLength(er.length),rr=0,ir=Yn||arraySpeciesCreate,or=Un?ir(zn,nr):Qn?ir(zn,0):void 0;nr>rr;rr++)if((Vn||rr in er)&&($n=tr(Jn=er[rr],rr,Zn),Tn))if(Un)or[rr]=$n;else if($n)switch(Tn){case 3:return!0;case 5:return Jn;case 6:return rr;case 2:li.call(or,Jn)}else if(Hn)return!1;return Gn?-1:Dn||Hn?Hn:or}},ui={forEach:createMethod$1(0),map:createMethod$1(1),filter:createMethod$1(2),some:createMethod$1(3),every:createMethod$1(4),find:createMethod$1(5),findIndex:createMethod$1(6)},di=Object.defineProperty,hi={},thrower=function(Tn){throw Tn},arrayMethodUsesToLength=function(Tn,Un){if(has(hi,Tn))return hi[Tn];Un||(Un={});var Dn=[][Tn],Hn=!!has(Un,"ACCESSORS")&&Un.ACCESSORS,Gn=has(Un,0)?Un[0]:thrower,Vn=has(Un,1)?Un[1]:void 0;return hi[Tn]=!!Dn&&!fails((function(){if(Hn&&!Qn)return!0;var Tn={length:-1};Hn?di(Tn,1,{enumerable:!0,get:thrower}):Tn[1]=1,Dn.call(Tn,Gn,Vn)}))},pi=ui.filter,Ai=arrayMethodHasSpeciesSupport("filter"),fi=arrayMethodUsesToLength("filter");_export({target:"Array",proto:!0,forced:!Ai||!fi},{filter:function filter(Tn){return pi(this,Tn,arguments.length>1?arguments[1]:void 0)}});var gi,mi=Object.keys||function keys(Tn){return objectKeysInternal(Tn,Ur)},_i=Qn?Object.defineProperties:function defineProperties(Tn,Un){anObject(Tn);for(var Qn,Dn=mi(Un),Hn=Dn.length,Gn=0;Hn>Gn;)tr.f(Tn,Qn=Dn[Gn++],Un[Qn]);return Tn},vi=getBuiltIn("document","documentElement"),yi=sharedKey("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(Tn){return"