Merge branch 'master' of https://github.com/SVG-Edit/svgedit into V7-preview
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import '../../../instrumented/editor/jquery.min.js';
|
||||
|
||||
import * as select from '../../../instrumented/svgcanvas/select.js';
|
||||
import {NS} from '../../../instrumented/common/namespaces.js';
|
||||
import { NS } from '../../../instrumented/common/namespaces.js';
|
||||
|
||||
describe('select', function () {
|
||||
const sandbox = document.createElement('div');
|
||||
@@ -10,7 +10,29 @@ describe('select', function () {
|
||||
let svgroot;
|
||||
let svgcontent;
|
||||
const mockConfig = {
|
||||
dimensions: [640, 480]
|
||||
dimensions: [ 640, 480 ]
|
||||
};
|
||||
const dataStorage = {
|
||||
_storage: new WeakMap(),
|
||||
put: function (element, key, obj) {
|
||||
if (!this._storage.has(element)) {
|
||||
this._storage.set(element, new Map());
|
||||
}
|
||||
this._storage.get(element).set(key, obj);
|
||||
},
|
||||
get: function (element, key) {
|
||||
return this._storage.get(element).get(key);
|
||||
},
|
||||
has: function (element, key) {
|
||||
return this._storage.has(element) && this._storage.get(element).has(key);
|
||||
},
|
||||
remove: function (element, key) {
|
||||
var ret = this._storage.get(element).delete(key);
|
||||
if (!this._storage.get(element).size === 0) {
|
||||
this._storage.delete(element);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
const dataStorage = {
|
||||
_storage: new WeakMap(),
|
||||
@@ -41,7 +63,7 @@ describe('select', function () {
|
||||
const mockFactory = {
|
||||
createSVGElement (jsonMap) {
|
||||
const elem = document.createElementNS(NS.SVG, jsonMap.element);
|
||||
Object.entries(jsonMap.attr).forEach(([attr, value]) => {
|
||||
Object.entries(jsonMap.attr).forEach(([ attr, value ]) => {
|
||||
elem.setAttribute(attr, value);
|
||||
});
|
||||
return elem;
|
||||
@@ -58,11 +80,11 @@ describe('select', function () {
|
||||
beforeEach(() => {
|
||||
svgroot = mockFactory.createSVGElement({
|
||||
element: 'svg',
|
||||
attr: {id: 'svgroot'}
|
||||
attr: { id: 'svgroot' }
|
||||
});
|
||||
svgcontent = mockFactory.createSVGElement({
|
||||
element: 'svg',
|
||||
attr: {id: 'svgcontent'}
|
||||
attr: { id: 'svgcontent' }
|
||||
});
|
||||
|
||||
svgroot.append(svgcontent);
|
||||
|
||||
Reference in New Issue
Block a user