increase test coverage

extend test coverage
This commit is contained in:
JFH
2025-12-01 01:22:26 +01:00
parent a37fbac749
commit fa380402e1
52 changed files with 3813 additions and 169 deletions

View File

@@ -107,6 +107,12 @@ export default class ConfigObj {
* @property {boolean} [layerView=false] Set for 'ext-layer_view.js'; determines whether or not only current layer is shown by default
* Set and used in `svgcanvas.js` (`mouseUp`).
*/
const defaultExtPath = (() => {
if (typeof document === 'undefined' || !document.baseURI) return './extensions'
const url = new URL('./extensions/', document.baseURI).toString()
return url.endsWith('/') ? url.slice(0, -1) : url
})()
this.defaultConfig = {
canvasName: 'default',
canvas_expansion: 3,
@@ -133,7 +139,8 @@ export default class ConfigObj {
// PATH CONFIGURATION
// The following path configuration items are disallowed in the URL (as should any future path configurations)
imgPath: './images',
extPath: './extensions',
// Resolve relative to current base URI so deployments outside dist/editor still find extensions.
extPath: defaultExtPath,
// DOCUMENT PROPERTIES
// Change the following to a preference (already in the Document Properties dialog)?
dimensions: [640, 480],

View File

@@ -647,6 +647,8 @@ class EditorStartup {
})
// run callbacks stored by this.ready
await this.runCallbacks()
// Signal readiness to same-document listeners (tests/debugging hooks)
document.dispatchEvent(new CustomEvent('svgedit:ready', { detail: this }))
}
/**

View File

@@ -0,0 +1,41 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>SVG-Edit Unit Harness</title>
<script type="module">
import './vendor/pathseg/pathseg.js'
import * as namespaces from './vendor/svgcanvas/core/namespaces.js'
import * as utilities from './vendor/svgcanvas/core/utilities.js'
import * as math from './vendor/svgcanvas/core/math.js'
import * as pathModule from './vendor/svgcanvas/core/path.js'
import * as coords from './vendor/svgcanvas/core/coords.js'
import * as units from './vendor/svgcanvas/core/units.js'
import * as draw from './vendor/svgcanvas/core/draw.js'
import * as history from './vendor/svgcanvas/core/history.js'
import * as recalculate from './vendor/svgcanvas/core/recalculate.js'
import * as util from './vendor/svgcanvas/common/util.js'
import * as touch from './vendor/svgcanvas/core/touch.js'
import * as clearModule from './vendor/svgcanvas/core/clear.js'
// Expose modules for Playwright specs.
window.svgHarness = {
namespaces,
utilities,
math,
pathModule,
coords,
units,
draw,
history,
recalculate,
util,
touch,
clearModule
}
</script>
</head>
<body>
<div id="root"></div>
</body>
</html>