increase test coverage
extend test coverage
This commit is contained in:
@@ -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],
|
||||
|
||||
@@ -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 }))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
41
src/editor/tests/unit-harness.html
Normal file
41
src/editor/tests/unit-harness.html
Normal 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>
|
||||
Reference in New Issue
Block a user