Merge pull request #3 from SVG-Edit/master

update from original project
master
JFH 2020-10-06 15:32:41 +02:00 committed by GitHub
commit 6ffaf5d8b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1122 changed files with 45381 additions and 239501 deletions

View File

@ -1,5 +0,0 @@
{
"presets": [
["@babel/preset-env"]
]
}

View File

@ -5,32 +5,28 @@ coverage
instrumented instrumented
dist dist
docs/jsdoc docs/jsdoc
archive
svgedit-config-es.js jsconfig.json
svgedit-config-iife.js
svgedit-custom.css
editor/xdomain-svgedit-config-iife.js
# Vendor/minified files
editor/jquery.min.js
editor/jquery-ui
# Previously minified though exporting
editor/js-hotkeys
editor/jspdf/jspdf.min.js
editor/jspdf/underscore-min.js
editor/extensions/mathjax
# Todo: We should at least check `compat/compat` in our other files, however
editor/external/*
!editor/external/dom-polyfill
editor/external/dom-polyfill/*
!editor/external/dom-polyfill/dom-polyfill.js
!editor/external/dynamic-import-polyfill
mochawesome-report mochawesome-report
releases releases
!.eslintrc.js !.eslintrc.js
!.ncurc.js !.ncurc.js
es-dev-server.config.js
nyc.config.js
svgedit-custom.css
# Vendor/minified files
src/editor/jquery.min.js
src/editor/jquery-ui
# Previously minified though exporting
src/editor/js-hotkeys
src/editor/jspdf/jspdf.min.js
src/editor/jspdf/underscore-min.js
src/editor/extensions/ext-mathjax/mathjax

View File

@ -3,49 +3,156 @@
module.exports = { module.exports = {
extends: ['ash-nazg/sauron-node'], extends: ['ash-nazg/sauron-node'],
parserOptions: { parserOptions: {
ecmaVersion: 2020,
sourceType: 'module' sourceType: 'module'
}, },
env: { env: {
browser: true browser: true,
es6: true
}, },
settings: { settings: {
polyfills: [ polyfills: [
], // These are the primary polyfills needed by regular users if
jsdoc: { // not present, e.g., with core-js-bundle; also those under
additionalTagNames: { // extensions
// In case we need to extend // 'Array.isArray',
customTags: [] // 'Blob',
}, // 'console',
augmentsExtendsReplacesDocs: true // 'CustomEvent',
// Todo: Figure out why this is not working and why seem to have to // 'document.body',
// disable for all Markdown: // 'document.createElementNS',
/* // 'document.evaluate',
baseConfig: { // 'document.head',
rules: { // 'document.importNode',
'no-multi-spaces': 'off' // 'document.querySelector',
// 'document.querySelectorAll',
// 'DOMParser',
// 'Error',
'fetch',
// 'FileReader',
// 'JSON',
// 'KeyboardEvent',
// 'location.href',
// 'location.origin',
// 'MouseEvent',
// 'MutationObserver',
// 'navigator',
// 'Number.isNaN',
// 'Number.parseFloat',
// 'Number.parseInt',
// 'Object.assign',
// 'Object.defineProperty',
// 'Object.defineProperties',
// 'Object.entries',
// 'Object.getOwnPropertyDescriptor',
// 'Object.keys',
// 'Object.values',
'Promise',
'Promise.all',
// 'Set',
'Uint8Array',
'URL'
// 'URL.createObjectURL',
// 'XMLSerializer',
// 'XMLHttpRequest',
// 'window.getComputedStyle',
// 'window.parent',
// 'window.scrollX',
// 'window.scrollY'
]
},
rules: {
// check-examples is not picking up eslint config properly in some
// environments; see also discussion above
// `mocha-cleanup/no-assertions-outside-it`
'jsdoc/check-examples': ['warn', {
rejectExampleCodeRegex: '^`'
}],
// https://github.com/sindresorhus/eslint-plugin-unicorn/issues/453
'unicorn/regex-shorthand': 0,
// The Babel transform seems to have a problem converting these
'prefer-named-capture-group': 'off',
'jsdoc/require-file-overview': ['error', {
tags: {
file: {
initialCommentsOnly: true,
preventDuplicates: true
},
license: {
initialCommentsOnly: true,
preventDuplicates: true
},
copyright: {
initialCommentsOnly: true,
preventDuplicates: true
},
author: {
initialCommentsOnly: true,
preventDuplicates: true
},
module: {
initialCommentsOnly: true,
preventDuplicates: true
},
exports: {
initialCommentsOnly: true,
preventDuplicates: true
} }
} }
*/ }],
} // Warning or Off for now but should be reviewed
// Override these rules which are difficult for us
// to apply at this time
'unicorn/prefer-string-slice': 'off',
'default-case': 'off',
'require-unicode-regexp': 'off',
'max-len':
[
'warn',
{ignoreComments: true, code: 130}
], // 130 is too much but too many occurences
'unicorn/prefer-query-selector': 'off',
'unicorn/no-fn-reference-in-iterator': 'off',
'unicorn/prefer-node-append': 'off',
'unicorn/no-zero-fractions': 'off',
'unicorn/prefer-number-properties': 'off',
'eslint-comments/require-description': 'off',
'compat/compat': 'error',
'consistent-this': 'off',
'import/no-anonymous-default-export': 'off',
'node/no-unsupported-features/node-builtins': 'warn',
'prefer-exponentiation-operator': 'warn',
'node/no-unsupported-features/es-syntax': 'off',
'no-unsanitized/method': [
'error',
{
escape: {
methods: ['encodeURIComponent', 'encodeURI']
}
}
]
}, },
overrides: [ overrides: [
// Locales have no need for importing outside of SVG-Edit // Locales have no need for importing outside of SVG-Edit
// and translations may need a longer line length
{ {
files: [ files: [
'editor/locale/lang.*.js', 'editor/extensions/ext-locale/**', 'src/editor/locale/lang.*.js', 'src/editor/extensions/*/locale/**',
'docs/tutorials/ExtensionDocs.md' 'docs/tutorials/ExtensionDocs.md'
], ],
rules: { rules: {
'import/no-anonymous-default-export': ['off'] 'import/no-anonymous-default-export': 'off',
'max-len': 'off'
} }
}, },
// These browser files don't do importing or requiring // These browser files don't do importing or requiring
{ {
files: [ files: [
'editor/svgpathseg.js', 'editor/touch.js', 'editor/typedefs.js', 'src/editor/touch.js',
'editor/redirect-on-no-module-support.js', 'src/editor/typedefs.js',
'editor/extensions/imagelib/index.js', 'src/editor/redirect-on-no-module-support.js',
'editor/external/dom-polyfill/dom-polyfill.js', 'src/editor/extensions/ext-imagelib/index.js',
'screencasts/svgopen2010/script.js' 'screencasts/svgopen2010/script.js'
], ],
rules: { rules: {
@ -63,6 +170,8 @@ module.exports = {
'history', 'history',
'history.pushState', 'history.pushState',
'history.replaceState', 'history.replaceState',
'location.hash',
'navigator',
'Number.parseFloat', 'Number.parseFloat',
'Number.parseInt', 'Number.parseInt',
'Number.isNaN' 'Number.isNaN'
@ -95,7 +204,6 @@ module.exports = {
// Used in examples of assert-close.js plugin // Used in examples of assert-close.js plugin
'mocha-cleanup/no-assertions-outside-it': 'off', 'mocha-cleanup/no-assertions-outside-it': 'off',
'eslint-comments/no-unused-disable': 'warn', 'eslint-comments/no-unused-disable': 'warn',
'eol-last': ['off'], 'eol-last': ['off'],
'no-console': ['off'], 'no-console': ['off'],
'no-undef': ['off'], 'no-undef': ['off'],
@ -114,112 +222,6 @@ module.exports = {
indent: 'off' indent: 'off'
} }
}, },
// Dis-apply Node rules mistakenly giving errors with browser files,
// and treating Node global `root` as being present for shadowing
{
files: ['editor/**'],
globals: {
root: 'off'
},
settings: {
polyfills: [
// These are the primary polyfills needed by regular users if
// not present, e.g., with core-js-bundle; also those under
// extensions
'Array.isArray',
'Blob',
'console',
'CustomEvent',
'document.body',
'document.createElementNS',
'document.evaluate',
'document.head',
'document.importNode',
'document.querySelectorAll',
'DOMParser',
'Error',
'FileReader',
'JSON',
'KeyboardEvent',
'location.href',
'MouseEvent',
'MutationObserver',
'Number.isNaN',
'Number.parseFloat',
'Number.parseInt',
'Object.assign',
'Object.defineProperty',
'Object.defineProperties',
'Object.entries',
'Object.getOwnPropertyDescriptor',
'Object.keys',
'Object.values',
'Promise',
'Promise.all',
'Set',
'Uint8Array',
'URL',
'URL.createObjectURL',
'XMLSerializer',
'XMLHttpRequest',
'window.getComputedStyle',
'window.parent',
'window.scrollX',
'window.scrollY'
]
},
rules: {
'node/no-unsupported-features/node-builtins': 'off'
}
},
// For extensions, `this` is generally assigned to be the more
// descriptive `svgEditor`; they also have no need for importing outside
// of SVG-Edit
{
files: ['editor/extensions/**'],
settings: {
polyfills: [
'console',
'fetch',
'location.origin',
'Number.isNaN',
'Number.parseFloat',
'Number.parseInt',
'window.postMessage'
]
},
rules: {
'consistent-this': ['error', 'svgEditor'],
'import/no-anonymous-default-export': ['off']
}
},
{
// Node files
files: [
'docs/jsdoc-config.js',
'build/build-html.js',
'rollup.config.js', 'rollup-config.config.js'
],
env: {
node: true
},
settings: {
polyfills: [
'console',
'Promise.resolve'
]
},
globals: {
require: true
},
rules: {
// We can't put Rollup in npmignore or user can't get access,
// and we have too many modules to add to `peerDependencies`
// so this rule can know them to be available, so we instead
// disable
'node/no-unpublished-import': 'off'
}
},
{ {
// As consumed by jsdoc, cannot be expressed as ESM // As consumed by jsdoc, cannot be expressed as ESM
files: ['docs/jsdoc-config.js'], files: ['docs/jsdoc-config.js'],
@ -234,18 +236,6 @@ module.exports = {
strict: 'off' strict: 'off'
} }
}, },
{
// Should probably have as external, but should still check
files: ['canvg/rgbcolor.js'],
settings: {
polyfills: [
'Number.isNaN',
'Number.parseInt',
'Object.assign',
'Object.keys'
]
}
},
{ {
files: ['cypress/plugins/index.js'], files: ['cypress/plugins/index.js'],
extends: [ extends: [
@ -284,9 +274,9 @@ module.exports = {
// These errors are caused in Cypress files if user has not // These errors are caused in Cypress files if user has not
// yet instrumented code; need to reinvestigate why we had to // yet instrumented code; need to reinvestigate why we had to
// instrument separately from nyc mocha // instrument separately from nyc mocha
'import/no-unresolved': 'warn', 'import/no-unresolved': ['error', {ignore: ['/instrumented/']}],
'node/no-missing-import': 'warn', 'node/no-missing-import': 'off',
'jsdoc/check-examples': 'off',
'chai-expect-keywords/no-unsupported-keywords': [ 'chai-expect-keywords/no-unsupported-keywords': [
'error', { 'error', {
allowChaiDOM: true allowChaiDOM: true
@ -326,63 +316,33 @@ module.exports = {
'no-console': 0, 'no-console': 0,
'import/unambiguous': 0 'import/unambiguous': 0
} }
} },
], {
rules: { // Node files
// check-examples is not picking up eslint config properly in some files: [
// environments; see also discussion above 'docs/jsdoc-config.js',
// `mocha-cleanup/no-assertions-outside-it` 'build/build-html.js',
'jsdoc/check-examples': ['warn', { 'rollup.config.js', 'rollup-config.config.js'
rejectExampleCodeRegex: '^`' ],
}], env: {
node: true
// https://github.com/sindresorhus/eslint-plugin-unicorn/issues/453 },
'unicorn/regex-shorthand': 0, settings: {
// The Babel transform seems to have a problem converting these polyfills: [
'prefer-named-capture-group': 'off', 'console',
// Override these `ash-nazg/sauron` rules which are difficult for us 'Promise.resolve'
// to apply at this time ]
'unicorn/prefer-string-slice': 'off', },
'default-case': 'off', globals: {
'require-unicode-regexp': 'off', require: true
'max-len': 'off', /* , { },
ignoreUrls: true, rules: {
ignoreRegExpLiterals: true // We can't put Rollup in npmignore or user can't get access,
} */ // and we have too many modules to add to `peerDependencies`
'unicorn/prefer-query-selector': 'off', // so this rule can know them to be available, so we instead
'unicorn/prefer-node-append': 'off', // disable
'unicorn/no-zero-fractions': 'off', 'node/no-unpublished-import': 'off'
'unicorn/prefer-number-properties': 'off',
'jsdoc/require-file-overview': ['error', {
tags: {
file: {
initialCommentsOnly: true,
preventDuplicates: true
},
license: {
initialCommentsOnly: true,
preventDuplicates: true
},
copyright: {
initialCommentsOnly: true,
preventDuplicates: true
},
author: {
initialCommentsOnly: true,
preventDuplicates: true
},
module: {
initialCommentsOnly: true,
preventDuplicates: true
},
exports: {
initialCommentsOnly: true,
preventDuplicates: true
}
} }
}], }
]
// Disable for now
'eslint-comments/require-description': 0
}
}; };

1
.gitignore vendored
View File

@ -18,3 +18,4 @@ mochawesome.json
.vscode .vscode
.eslintcache .eslintcache
.DS_Store

0
.gitmodules vendored
View File

View File

@ -1,3 +0,0 @@
{
"title-require": false
}

View File

@ -1,8 +0,0 @@
'use strict';
module.exports = {
reject: [
// Todo: Old copy with jspdf which needs updating: https://github.com/SVG-Edit/svgedit/issues/51
'underscore'
]
};

View File

@ -5,7 +5,6 @@ screencasts
gh-disabled-workflows gh-disabled-workflows
build build
lgtm.yml lgtm.yml
.travis.yml
cypress/** cypress/**
cypress.env.json cypress.env.json

View File

@ -1,4 +0,0 @@
language: ruby
rvm:
- 2.3
script: "bundle exec jekyll build"

View File

@ -41,6 +41,11 @@
- Fix: remove "null" attributes in svg source #76 (@cuixiping) - Fix: remove "null" attributes in svg source #76 (@cuixiping)
- Fix: A bug of `convertPath` function when converting H and V to - Fix: A bug of `convertPath` function when converting H and V to
relative (@cuixiping) relative (@cuixiping)
- Fix: Layer `removeGroup` not returning element (@brettz9)
- Fix: issue with undo because `this.elem` was overwritten with
`node.remove()`; #359 (@jhenon)
- Fix: Double click not working to edit text within a group. #407 (@jhenon)
- Fix: Showing SVG content when the context is changed. #408 (@jhenon)
- Optimization: Remove unused `jquery-ui-1.8.custom.min.js` file - Optimization: Remove unused `jquery-ui-1.8.custom.min.js` file
- Optimization: Remove old build/tools closure/yuicompressor code - Optimization: Remove old build/tools closure/yuicompressor code
- Optimization: Remove unmaintained chrome-app, firefox-extension, - Optimization: Remove unmaintained chrome-app, firefox-extension,
@ -60,12 +65,14 @@
- Docs: Update license badges to reflect lack of (known) CC-BY-SA-2.0 usage - Docs: Update license badges to reflect lack of (known) CC-BY-SA-2.0 usage
- Docs: Update Contributing, Testing (renamed to Development), - Docs: Update Contributing, Testing (renamed to Development),
Linting and ReleaseInstructions Linting and ReleaseInstructions
- Docs: Add feature and PR templates
- Update: Cypress code coverage plugin - Update: Cypress code coverage plugin
- Refactoring: Switch from `$.param.querystring` to `URL` - Refactoring: Switch from `$.param.querystring` to `URL`
- Refactoring: Ensure file-global jsdoc tags are at beginning of file - Refactoring: Ensure file-global jsdoc tags are at beginning of file
- Refactoring: Move `build-html` to `build` directory - Refactoring: Move `build-html` to `build` directory
- Refactoring: Add favicon no-op to suppress favicon 404s until - Refactoring: Add favicon no-op to suppress favicon 404s until
loaded dynamically (might make configurable in future) loaded dynamically (might make configurable in future)
- Refactoring: create a src folder and subfolders for svgcanvas, editor, common and externals.
- Linting (ESLint): Simplify regexes - Linting (ESLint): Simplify regexes
- Linting (ESLint): Replace `innerHTML` with `textContent` from old demo - Linting (ESLint): Replace `innerHTML` with `textContent` from old demo
- Linting (ESLint): Update as per latest ash-nazg - Linting (ESLint): Update as per latest ash-nazg
@ -86,6 +93,8 @@
- Testing: Produce mochawesome report - Testing: Produce mochawesome report
- Testing: Cypress with multiple reporters in case we need - Testing: Cypress with multiple reporters in case we need
- Build: Update underscore and core-js-bundle copies - Build: Update underscore and core-js-bundle copies
- Build: Use "json" extension for babelrc (easier out-of-the-box syntax
recognition by IDEs, etc.)
- npm: Add `underscore` to copy script - npm: Add `underscore` to copy script
- npm: Make `copy`, `compress-images`, `start-embedded`, `build-docs-remove` - npm: Make `copy`, `compress-images`, `start-embedded`, `build-docs-remove`
scripts cross-platform; add `start-allow-origin` script scripts cross-platform; add `start-allow-origin` script

76
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team. All complaints will be reviewed and
investigated and will result in a response that is deemed necessary and
appropriate to the circumstances. The project team is obligated to maintain
confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

View File

@ -1,6 +1,6 @@
# These are supported funding model platforms # These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] github: [brettz9] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username ko_fi: # Replace with a single Ko-fi username

View File

@ -1,4 +1,4 @@
# ![LOGO](editor/images/logo.png) SVG-edit # ![LOGO](src/editor/images/logo.png) SVG-edit
[![npm](https://img.shields.io/npm/v/svgedit.svg)](https://www.npmjs.com/package/svgedit) [![npm](https://img.shields.io/npm/v/svgedit.svg)](https://www.npmjs.com/package/svgedit)
[![Dependencies](https://img.shields.io/david/SVG-Edit/svgedit.svg)](https://david-dm.org/SVG-Edit/svgedit) [![Dependencies](https://img.shields.io/david/SVG-Edit/svgedit.svg)](https://david-dm.org/SVG-Edit/svgedit)
@ -44,24 +44,19 @@ to join the project.
## Demo ## Demo
### [Try SVG-edit here](https://svg-edit.github.io/svgedit/editor/svg-editor.html) ### [Try SVG-edit here](https://svg-edit.github.io/svgedit/dist/editor/index.html)
<!-- See the [latest release](https://svg-edit.github.io/svgedit/releases/latest/editor/svg-editor.html) <!-- See the [latest release](https://svg-edit.github.io/svgedit/releases/latest/editor/svg-editor.html)
(or its [ES6-Module](https://svg-edit.github.io/svgedit/releases/latest/editor/svg-editor-es.html) (or its [ES6-Module](https://svg-edit.github.io/svgedit/releases/latest/editor/svg-editor-es.html)
version, which requires a modern browser). version, which requires a modern browser).
--> -->
See a working editor on [`master`](https://svg-edit.github.io/svgedit/editor/svg-editor.html) (or its [ES6-Module](https://svg-edit.github.io/svgedit/editor/svg-editor-es.html) See a working editor on [`master`](https://svg-edit.github.io/svgedit/src/editor/index.html)
version, which requires a modern browser). version, which requires a modern browser).
You may also try it at <https://unpkg.com/svgedit/editor/svg-editor.html> We also build a systemJS version at [`master`](https://svg-edit.github.io/svgedit/dist/editor/system/index.html)
(which redirects to a versioned URL).
You may also obtain URLs for specific [releases](https://github.com/SVG-Edit/svgedit/releases). You may also obtain URLs for specific [releases](https://github.com/SVG-Edit/svgedit/releases).
You may test the [latest version in `master`](https://svg-edit.github.io/svgedit/editor/svg-editor-es.html)
which is the ESM version. (The [non-ESM version](https://svg-edit.github.io/svgedit/editor/svg-editor.html)
on `master` may be updated less frequently.)
## Installation ## Installation
### Quick install ### Quick install
@ -79,7 +74,7 @@ on `master` may be updated less frequently.)
([ConfigOptions]{@tutorial ConfigOptions})) within the URL: ([ConfigOptions]{@tutorial ConfigOptions})) within the URL:
```html ```html
<iframe src="svgedit/editor/svg-editor.html?extensions=" <iframe src="svgedit/src/editor/svg-editor.html?extensions="
width="100%" height="100%"></iframe> width="100%" height="100%"></iframe>
``` ```
@ -107,7 +102,7 @@ incorporating SVGEdit. You will need to have Node.js/npm installed.
1. Create your npm package: `npm init` (complete the fields). 1. Create your npm package: `npm init` (complete the fields).
1. Install SVG-edit into your package: 1. Install SVG-edit into your package:
`npm i --save svgedit`. `npm i --save svgedit`.
1. Look within `node_modules/svgedit/`, e.g., `node_modules/svgedit/editor/svg-editor.html` 1. Look within `node_modules/svgedit/`, e.g., `node_modules/svgedit/src/editor/svg-editor.html`
for the files your package needs and use accordingly (from outside of for the files your package needs and use accordingly (from outside of
`node_modules`). `node_modules`).
1. If you want to publish your own work, you can use `npm publish`. 1. If you want to publish your own work, you can use `npm publish`.
@ -203,14 +198,15 @@ incorporating SVGEdit. You will need to have Node.js/npm installed.
## Supported browsers ## Supported browsers
The following browsers had been tested for 2.6 or earlier and will - Opera 59+,
probably continue to work with 3.0. - IE 12+,
- Chrome 75+,
- FireFox 68+,
- Safari 10+
- Firefox 1.5+ Support for old browsers may require to use an older version of the package. However,
- Opera 9.50+ please open an issue if you need support for a specific version of your browser so
- Safari 4+ the project team can decide if we should support with the latest version.
- Chrome 1+
- IE 9+ and Edge
## Further reading and more information ## Further reading and more information
@ -223,3 +219,7 @@ probably continue to work with 3.0.
* Join the [svg-edit mailing list](https://groups.google.com/forum/#!forum/svg-edit). * Join the [svg-edit mailing list](https://groups.google.com/forum/#!forum/svg-edit).
* Join us on `#svg-edit` on `freenode.net` (or use the * Join us on `#svg-edit` on `freenode.net` (or use the
[web client](https://webchat.freenode.net/?channels=svg-edit)). [web client](https://webchat.freenode.net/?channels=svg-edit)).
# Hosting
SVGedit versions are deployed to:
[![Deploys by Netlify](https://www.netlify.com/img/global/badges/netlify-color-accent.svg)](https://www.netlify.com)

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 500 B

After

Width:  |  Height:  |  Size: 500 B

View File

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -1,3 +1,4 @@
@@ -1,156 +0,0 @@
# To-do: Change to a sample service-worker # To-do: Change to a sample service-worker
CACHE MANIFEST CACHE MANIFEST

11
babel.config.json Normal file
View File

@ -0,0 +1,11 @@
{
"presets": [
[
"@babel/env",
{
"useBuiltIns": "usage",
"corejs": "3.6.5"
}
]
]
}

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="428" height="20"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="orange" stroke="#000" d="M0 0h120v20H0zM120 0h109v20H120zM229 0h87v20h-87zM316 0h112v20H316z"/><path fill="url(#smooth)" d="M0 0h428v20H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">Statements 42.48%</text><text class="high" x="5" y="14">Statements 42.48%</text><text class="shadow" x="125.5" y="15">Branches 31.22%</text><text class="high" x="125" y="14">Branches 31.22%</text><text class="shadow" x="234.5" y="15">Lines 43.59%</text><text class="high" x="234" y="14">Lines 43.59%</text><text class="shadow" x="321.5" y="15">Functions 48.57%</text><text class="high" x="321" y="14">Functions 48.57%</text></g></svg> <svg xmlns="http://www.w3.org/2000/svg" width="428" height="20"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="green" stroke="#000" d="M0 0h120v20H0zM120 0h109v20H120zM229 0h87v20h-87zM316 0h112v20H316z"/><path fill="url(#smooth)" d="M0 0h428v20H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">Statements 51.09%</text><text class="high" x="5" y="14">Statements 51.09%</text><text class="shadow" x="125.5" y="15">Branches 40.83%</text><text class="high" x="125" y="14">Branches 40.83%</text><text class="shadow" x="234.5" y="15">Lines 51.81%</text><text class="high" x="234" y="14">Lines 51.81%</text><text class="shadow" x="321.5" y="15">Functions 58.54%</text><text class="high" x="321" y="14">Functions 58.54%</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="839" height="224"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="navy" d="M0 0h88v224H0z"/><path fill="#006400" d="M88 0h131v224H88z"/><path fill="green" d="M219 0h266v224H219z"/><path fill="#cc0" d="M485 0h79v224h-79z"/><path fill="#a9a9a9" d="M564 0h106v224H564z"/><path fill="#d3d3d3" d="M670 0h169v224H670z"/><path fill="url(#smooth)" d="M0 0h839v224H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">License types</text><text class="high" x="5" y="14">License types</text><text class="shadow" x="5.5" y="27">(all devDeps)</text><text class="high" x="5" y="26">(all devDeps)</text><text class="shadow" x="93.5" y="15">Public</text><text class="high" x="93" y="14">Public</text><text class="shadow" x="93.5" y="27">domain</text><text class="high" x="93" y="26">domain</text><text class="shadow" x="93.5" y="51">1. (MIT OR CC0-1.0)</text><text class="high" x="93" y="50">1. (MIT OR CC0-1.0)</text><text class="shadow" x="93.5" y="63">2. CC0-1.0</text><text class="high" x="93" y="62">2. CC0-1.0</text><text class="shadow" x="93.5" y="75">3. Unlicense</text><text class="high" x="93" y="74">3. Unlicense</text><text class="shadow" x="224.5" y="15">Permissive</text><text class="high" x="224" y="14">Permissive</text><text class="shadow" x="224.5" y="39">1. (AFL-2.1 OR BSD-3-Clause)</text><text class="high" x="224" y="38">1. (AFL-2.1 OR BSD-3-Clause)</text><text class="shadow" x="224.5" y="51">2. (BSD-2-Clause OR (MIT OR Apache-2.0))</text><text class="high" x="224" y="50">2. (BSD-2-Clause OR (MIT OR Apache-2.0))</text><text class="shadow" x="224.5" y="63">3. (GPL-3.0-or-later OR MIT)</text><text class="high" x="224" y="62">3. (GPL-3.0-or-later OR MIT)</text><text class="shadow" x="224.5" y="75">4. (MIT OR Apache-2.0)</text><text class="high" x="224" y="74">4. (MIT OR Apache-2.0)</text><text class="shadow" x="224.5" y="87">5. (MPL-2.0 OR Apache-2.0)</text><text class="high" x="224" y="86">5. (MPL-2.0 OR Apache-2.0)</text><text class="shadow" x="224.5" y="99">6. (WTFPL OR MIT)</text><text class="high" x="224" y="98">6. (WTFPL OR MIT)</text><text class="shadow" x="224.5" y="111">7. Apache</text><text class="high" x="224" y="110">7. Apache</text><text class="shadow" x="224.5" y="123">8. Apache-2.0</text><text class="high" x="224" y="122">8. Apache-2.0</text><text class="shadow" x="224.5" y="135">9. Artistic-2.0</text><text class="high" x="224" y="134">9. Artistic-2.0</text><text class="shadow" x="224.5" y="147">10. BSD-2-Clause</text><text class="high" x="224" y="146">10. BSD-2-Clause</text><text class="shadow" x="224.5" y="159">11. BSD-3-Clause</text><text class="high" x="224" y="158">11. BSD-3-Clause</text><text class="shadow" x="224.5" y="171">12. CC-BY-3.0</text><text class="high" x="224" y="170">12. CC-BY-3.0</text><text class="shadow" x="224.5" y="183">13. CC-BY-4.0</text><text class="high" x="224" y="182">13. CC-BY-4.0</text><text class="shadow" x="224.5" y="195">14. ISC</text><text class="high" x="224" y="194">14. ISC</text><text class="shadow" x="224.5" y="207">15. MIT</text><text class="high" x="224" y="206">15. MIT</text><text class="shadow" x="224.5" y="219">16. Zlib</text><text class="high" x="224" y="218">16. Zlib</text><text class="shadow" x="490.5" y="15">Weakly</text><text class="high" x="490" y="14">Weakly</text><text class="shadow" x="490.5" y="27">protective</text><text class="high" x="490" y="26">protective</text><text class="shadow" x="490.5" y="51">1. LGPL-3.0</text><text class="high" x="490" y="50">1. LGPL-3.0</text><text class="shadow" x="490.5" y="63">2. MPL-2.0</text><text class="high" x="490" y="62">2. MPL-2.0</text><text class="shadow" x="569.5" y="15">Uncategorized</text><text class="high" x="569" y="14">Uncategorized</text><text class="shadow" x="569.5" y="39">1. jsonify (0.0.0)</text><text class="high" x="569" y="38">1. jsonify (0.0.0)</text><text class="shadow" x="675.5" y="15">Missing</text><text class="high" x="675" y="14">Missing</text><text class="shadow" x="675.5" y="39">1. boundary (1.0.1)</text><text class="high" x="675" y="38">1. boundary (1.0.1)</text><text class="shadow" x="675.5" y="51">2. structured-source (3.0.2)</text><text class="high" x="675" y="50">2. structured-source (3.0.2)</text><text class="shadow" x="675.5" y="63">3. taffydb (2.6.2)</text><text class="high" x="675" y="62">3. taffydb (2.6.2)</text></g></svg> <svg xmlns="http://www.w3.org/2000/svg" width="581" height="188"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="navy" d="M0 0h88v188H0z"/><path fill="#006400" d="M88 0h131v188H88z"/><path fill="green" d="M219 0h189v188H219z"/><path fill="#d3d3d3" d="M408 0h173v188H408z"/><path fill="url(#smooth)" d="M0 0h581v188H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">License types</text><text class="high" x="5" y="14">License types</text><text class="shadow" x="5.5" y="27">(all devDeps)</text><text class="high" x="5" y="26">(all devDeps)</text><text class="shadow" x="93.5" y="15">Public</text><text class="high" x="93" y="14">Public</text><text class="shadow" x="93.5" y="27">domain</text><text class="high" x="93" y="26">domain</text><text class="shadow" x="93.5" y="51">1. (MIT OR CC0-1.0)</text><text class="high" x="93" y="50">1. (MIT OR CC0-1.0)</text><text class="shadow" x="93.5" y="63">2. CC0-1.0</text><text class="high" x="93" y="62">2. CC0-1.0</text><text class="shadow" x="93.5" y="75">3. Unlicense</text><text class="high" x="93" y="74">3. Unlicense</text><text class="shadow" x="224.5" y="15">Permissive</text><text class="high" x="224" y="14">Permissive</text><text class="shadow" x="224.5" y="39">1. (AFL-2.1 OR BSD-3-Clause)</text><text class="high" x="224" y="38">1. (AFL-2.1 OR BSD-3-Clause)</text><text class="shadow" x="224.5" y="51">2. (WTFPL OR ISC)</text><text class="high" x="224" y="50">2. (WTFPL OR ISC)</text><text class="shadow" x="224.5" y="63">3. 0BSD</text><text class="high" x="224" y="62">3. 0BSD</text><text class="shadow" x="224.5" y="75">4. Apache-2.0</text><text class="high" x="224" y="74">4. Apache-2.0</text><text class="shadow" x="224.5" y="87">5. BSD</text><text class="high" x="224" y="86">5. BSD</text><text class="shadow" x="224.5" y="99">6. BSD-2-Clause</text><text class="high" x="224" y="98">6. BSD-2-Clause</text><text class="shadow" x="224.5" y="111">7. BSD-3-Clause</text><text class="high" x="224" y="110">7. BSD-3-Clause</text><text class="shadow" x="224.5" y="123">8. CC-BY-3.0</text><text class="high" x="224" y="122">8. CC-BY-3.0</text><text class="shadow" x="224.5" y="135">9. CC-BY-4.0</text><text class="high" x="224" y="134">9. CC-BY-4.0</text><text class="shadow" x="224.5" y="147">10. ISC</text><text class="high" x="224" y="146">10. ISC</text><text class="shadow" x="224.5" y="159">11. MIT</text><text class="high" x="224" y="158">11. MIT</text><text class="shadow" x="224.5" y="171">12. WTFPL</text><text class="high" x="224" y="170">12. WTFPL</text><text class="shadow" x="224.5" y="183">13. Zlib</text><text class="high" x="224" y="182">13. Zlib</text><text class="shadow" x="413.5" y="15">Missing</text><text class="high" x="413" y="14">Missing</text><text class="shadow" x="413.5" y="39">1. better-assert (1.0.2)</text><text class="high" x="413" y="38">1. better-assert (1.0.2)</text><text class="shadow" x="413.5" y="51">2. callsite (1.0.0)</text><text class="high" x="413" y="50">2. callsite (1.0.0)</text><text class="shadow" x="413.5" y="63">3. component-bind (1.0.0)</text><text class="high" x="413" y="62">3. component-bind (1.0.0)</text><text class="shadow" x="413.5" y="75">4. component-inherit (0.0.3)</text><text class="high" x="413" y="74">4. component-inherit (0.0.3)</text><text class="shadow" x="413.5" y="87">5. exif-parser (0.1.12)</text><text class="high" x="413" y="86">5. exif-parser (0.1.12)</text><text class="shadow" x="413.5" y="99">6. indexof (0.0.1)</text><text class="high" x="413" y="98">6. indexof (0.0.1)</text><text class="shadow" x="413.5" y="111">7. object-component (0.0.3)</text><text class="high" x="413" y="110">7. object-component (0.0.3)</text><text class="shadow" x="413.5" y="123">8. process (0.5.2)</text><text class="high" x="413" y="122">8. process (0.5.2)</text></g></svg>

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="445" height="80"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="navy" d="M0 0h227v80H0z"/><path fill="green" d="M227 0h90v80h-90z"/><path fill="#cc0" d="M317 0h128v80H317z"/><path fill="url(#smooth)" d="M0 0h445v80H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">License types</text><text class="high" x="5" y="14">License types</text><text class="shadow" x="5.5" y="27">(project, deps, and bundled devDeps)</text><text class="high" x="5" y="26">(project, deps, and bundled devDeps)</text><text class="shadow" x="232.5" y="15">Permissive</text><text class="high" x="232" y="14">Permissive</text><text class="shadow" x="232.5" y="39">1. Apache-2.0</text><text class="high" x="232" y="38">1. Apache-2.0</text><text class="shadow" x="232.5" y="51">2. ISC</text><text class="high" x="232" y="50">2. ISC</text><text class="shadow" x="232.5" y="63">3. MIT</text><text class="high" x="232" y="62">3. MIT</text><text class="shadow" x="232.5" y="75">4. X11</text><text class="high" x="232" y="74">4. X11</text><text class="shadow" x="322.5" y="15">Weakly</text><text class="high" x="322" y="14">Weakly</text><text class="shadow" x="322.5" y="27">protective</text><text class="high" x="322" y="26">protective</text><text class="shadow" x="322.5" y="51">1. LGPL-3.0-or-later</text><text class="high" x="322" y="50">1. LGPL-3.0-or-later</text></g></svg> <svg xmlns="http://www.w3.org/2000/svg" width="1077" height="116"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="navy" d="M0 0h227v116H0z"/><path fill="green" d="M227 0h265v116H227z"/><path fill="#cc0" d="M492 0h128v116H492z"/><path fill="#a9a9a9" d="M620 0h243v116H620z"/><path fill="#d3d3d3" d="M863 0h214v116H863z"/><path fill="url(#smooth)" d="M0 0h1077v116H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">License types</text><text class="high" x="5" y="14">License types</text><text class="shadow" x="5.5" y="27">(project, deps, and bundled devDeps)</text><text class="high" x="5" y="26">(project, deps, and bundled devDeps)</text><text class="shadow" x="232.5" y="15">Permissive</text><text class="high" x="232" y="14">Permissive</text><text class="shadow" x="232.5" y="39">1. (MIT OR Apache-2.0)</text><text class="high" x="232" y="38">1. (MIT OR Apache-2.0)</text><text class="shadow" x="232.5" y="51">2. (MPL-2.0 OR Apache-2.0)</text><text class="high" x="232" y="50">2. (MPL-2.0 OR Apache-2.0)</text><text class="shadow" x="232.5" y="63">3. Apache-2.0</text><text class="high" x="232" y="62">3. Apache-2.0</text><text class="shadow" x="232.5" y="75">4. ISC</text><text class="high" x="232" y="74">4. ISC</text><text class="shadow" x="232.5" y="87">5. MIT</text><text class="high" x="232" y="86">5. MIT</text><text class="shadow" x="232.5" y="99">6. MIT OR SEE LICENSE IN FEEL-FREE.md</text><text class="high" x="232" y="98">6. MIT OR SEE LICENSE IN FEEL-FREE.md</text><text class="shadow" x="232.5" y="111">7. X11</text><text class="high" x="232" y="110">7. X11</text><text class="shadow" x="497.5" y="15">Weakly</text><text class="high" x="497" y="14">Weakly</text><text class="shadow" x="497.5" y="27">protective</text><text class="high" x="497" y="26">protective</text><text class="shadow" x="497.5" y="51">1. LGPL-3.0-or-later</text><text class="high" x="497" y="50">1. LGPL-3.0-or-later</text><text class="shadow" x="625.5" y="15">Uncategorized</text><text class="high" x="625" y="14">Uncategorized</text><text class="shadow" x="625.5" y="39">1. Chromium&apos;s License (pathseg (1.2.0))</text><text class="high" x="625" y="38">1. Chromium&apos;s License (pathseg (1.2.0))</text><text class="shadow" x="868.5" y="15">Missing</text><text class="high" x="868" y="14">Missing</text><text class="shadow" x="868.5" y="39">1. null (base64-arraybuffer (0.2.0))</text><text class="high" x="868" y="38">1. null (base64-arraybuffer (0.2.0))</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="97" height="20"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="#696969" d="M0 0h41v20H0z"/><path fill="#e05d44" d="M41 0h56v20H41z"/><path fill="url(#smooth)" d="M0 0h97v20H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">Tests</text><text class="high" x="5" y="14">Tests</text><text class="shadow" x="46.5" y="15">125/128</text><text class="high" x="46" y="14">125/128</text></g></svg> <svg xmlns="http://www.w3.org/2000/svg" width="97" height="20"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="#696969" d="M0 0h41v20H0z"/><path fill="#4c1" d="M41 0h56v20H41z"/><path fill="url(#smooth)" d="M0 0h97v20H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">Tests</text><text class="high" x="5" y="14">Tests</text><text class="shadow" x="46.5" y="15">139/139</text><text class="high" x="46" y="14">139/139</text></g></svg>

Before

Width:  |  Height:  |  Size: 823 B

After

Width:  |  Height:  |  Size: 820 B

View File

@ -1,148 +0,0 @@
/* eslint-env node */
import fs from 'promise-fs';
const filesAndReplacements = [
{
input: 'editor/svg-editor-es.html',
output: 'editor/xdomain-svg-editor-es.html',
replacements: [
[
'<script type="module" src="../svgedit-config-es.js"></script>',
'<script type="module" src="xdomain-svgedit-config-es.js"></script>'
]
]
},
{
input: 'editor/xdomain-svg-editor-es.html',
output: 'editor/xdomain-svg-editor.html',
replacements: [
[
'<!DOCTYPE html>',
`<!DOCTYPE html>
<!-- AUTO-GENERATED FROM xdomain-svg-editor-es.html; DO NOT EDIT; use build/build-html.js to build -->`
],
[
'<script type="module" src="redirect-on-lacking-support.js"></script>',
'<script defer="defer" src="../dist/redirect-on-lacking-support.js"></script>'
],
[
'<script type="module" src="xdomain-svgedit-config-es.js"></script>',
'<script defer="defer" src="xdomain-svgedit-config-iife.js"></script>'
],
[
'<script src="external/dom-polyfill/dom-polyfill.js"></script>',
'<script src="../dist/dom-polyfill.js"></script>'
],
[
'<script nomodule="" src="redirect-on-no-module-support.js"></script>',
''
]
]
},
// Now that file has copied, we can replace the DOCTYPE in xdomain
{
input: 'editor/xdomain-svg-editor-es.html',
output: 'editor/xdomain-svg-editor-es.html',
replacements: [
[
'<!DOCTYPE html>',
`<!DOCTYPE html>
<!-- AUTO-GENERATED FROM svg-editor-es.html; DO NOT EDIT; use build/build-html.js to build -->`
]
]
},
{
input: 'editor/svg-editor-es.html',
output: 'editor/svg-editor.html',
replacements: [
[
'<!DOCTYPE html>',
`<!DOCTYPE html>
<!-- AUTO-GENERATED FROM svg-editor-es.html; DO NOT EDIT; use build/build-html.js to build -->`
],
[
'<script type="module" src="redirect-on-lacking-support.js"></script>',
'<script defer="defer" src="../dist/redirect-on-lacking-support.js"></script>'
],
[
'<script type="module" src="../svgedit-config-es.js"></script>',
'<script defer="defer" src="../svgedit-config-iife.js"></script>'
],
[
'<script src="external/dom-polyfill/dom-polyfill.js"></script>',
'<script src="../dist/dom-polyfill.js"></script>'
],
[
'<script nomodule="" src="redirect-on-no-module-support.js"></script>',
''
]
]
},
{
input: 'editor/extensions/imagelib/openclipart-es.html',
output: 'editor/extensions/imagelib/openclipart.html',
replacements: [
[
'<!DOCTYPE html>',
`<!DOCTYPE html>
<!-- AUTO-GENERATED FROM imagelib/openclipart-es.html; DO NOT EDIT; use build/build-html.js to build -->`
],
[
'<script src="../../external/dom-polyfill/dom-polyfill.js"></script>',
'<script src="../../../dist/dom-polyfill.js"></script>'
],
[
'<script type="module" src="openclipart.js"></script>',
'<script defer="defer" src="../../../dist/extensions/imagelib/openclipart.js"></script>'
],
[
'<script nomodule="" src="redirect-on-no-module-support.js"></script>',
''
]
]
},
{
input: 'editor/extensions/imagelib/index-es.html',
output: 'editor/extensions/imagelib/index.html',
replacements: [
[
'<!DOCTYPE html>',
`<!DOCTYPE html>
<!-- AUTO-GENERATED FROM imagelib/index-es.html; DO NOT EDIT; use build/build-html.js to build -->`
],
[
'<script type="module" src="index.js"></script>',
'<script defer="defer" src="../../../dist/extensions/imagelib/index.js"></script>'
],
[
'<script nomodule="" src="redirect-on-no-module-support.js"></script>',
''
]
]
}
];
(async () => {
await filesAndReplacements.reduce(async (p, {input, output, replacements}) => {
await p;
let data;
try {
data = await fs.readFile(input, 'utf8');
} catch (err) {
console.log(`Error reading ${input} file`, err); // eslint-disable-line no-console
}
data = replacements.reduce((s, [fnd, replacement]) => {
return s.replace(fnd, replacement);
}, data);
try {
await fs.writeFile(output, data);
} catch (err) {
console.log(`Error writing file: ${err}`, err); // eslint-disable-line no-console
return;
}
console.log(`Completed file ${input} rewriting!`); // eslint-disable-line no-console
}, Promise.resolve());
console.log('Finished!'); // eslint-disable-line no-console
})();

View File

@ -1,7 +1,17 @@
{ {
"baseUrl": "http://localhost:8000", "baseUrl": "http://localhost:8000",
"reporter": "cypress-multi-reporters", "reporter": "cypress-multi-reporters",
"video": false,
"reporterOptions": { "reporterOptions": {
"configFile": "mocha-multi-reporters.json" "configFile": "mocha-multi-reporters.json"
},
"ignoreTestFiles": ["**/__snapshots__/*", "**/__image_snapshots__/*"],
"defaultCommandTimeout": 10000,
"pageLoadTimeout": 120000,
"cypress-plugin-snapshots": {
"autoCleanUp": true,
"prettier": true,
"updateSnapshots": false,
"diffLines": 5
} }
} }

View File

@ -0,0 +1,364 @@
exports[`use various parts of svg-edit > check tool_source #0`] = `
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
width="640"
height="480"
id="svgcontent"
overflow="visible"
x="640"
y="480"
viewBox="0 0 640 480"
>
<g class="layer" style="pointer-events:all">
<title style="pointer-events:inherit">Layer 1</title>
<rect
id="rect"
fill="#FF0000"
height="70"
stroke="#000000"
stroke-width="5"
width="94"
x="69.5"
y="51.5"
style="pointer-events:inherit"
></rect>
</g>
</svg>
`;
exports[`use various parts of svg-edit > check tool_fhpath #0`] = `
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
width="640"
height="480"
id="svgcontent"
overflow="visible"
x="640"
y="480"
viewBox="0 0 640 480"
>
<g class="layer" style="pointer-events:all">
<title style="pointer-events:inherit">Layer 1</title>
<rect
id="rect"
fill="#FF0000"
height="70"
stroke="#000000"
stroke-width="5"
width="94"
x="69.5"
y="51.5"
style="pointer-events:inherit"
fill-opacity="1"
stroke-opacity="1"
></rect>
</g>
</svg>
`;
exports[`use various parts of svg-edit > check tool_text #0`] = `
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
width="640"
height="480"
id="svgcontent"
overflow="visible"
x="640"
y="480"
viewBox="0 0 640 480"
>
<g class="layer" style="pointer-events:all">
<title style="pointer-events:inherit">Layer 1</title>
<rect
id="rect"
fill="#FF0000"
height="70"
stroke="#000000"
stroke-width="5"
width="94"
x="69.5"
y="51.5"
style="pointer-events:inherit"
fill-opacity="1"
stroke-opacity="1"
></rect>
<text
fill="#000000"
stroke="#000000"
stroke-width="0"
style="pointer-events: inherit; cursor: text;"
x="116"
y="87"
id="svg_1"
font-size="24"
font-family="serif"
text-anchor="middle"
xml:space="preserve"
fill-opacity="1"
stroke-opacity="1"
>
B
</text>
</g>
</svg>
`;
exports[`use various parts of svg-edit > check tool_clone #0`] = `
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
width="640"
height="480"
id="svgcontent"
overflow="visible"
x="640"
y="480"
viewBox="0 0 640 480"
>
<g class="layer" style="pointer-events:all">
<title style="pointer-events:inherit">Layer 1</title>
<rect
id="rect"
fill="#FF0000"
height="70"
stroke="#000000"
stroke-width="5"
width="94"
x="69.5"
y="51.5"
style="pointer-events:inherit"
fill-opacity="1"
stroke-opacity="1"
></rect>
<text
fill="#000000"
stroke="#000000"
stroke-width="0"
x="116"
y="87"
id="svg_1"
font-size="24"
font-family="serif"
text-anchor="middle"
xml:space="preserve"
fill-opacity="1"
stroke-opacity="1"
>
B
</text>
<text
fill="#000000"
stroke="#000000"
stroke-width="0"
x="136"
y="107"
font-size="24"
font-family="serif"
text-anchor="middle"
xml:space="preserve"
fill-opacity="1"
stroke-opacity="1"
id="svg_2"
>
B
</text>
</g>
</svg>
`;
exports[`use various parts of svg-edit > check tool_italic #0`] = `
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
width="640"
height="480"
id="svgcontent"
overflow="visible"
x="640"
y="480"
viewBox="0 0 640 480"
>
<g class="layer" style="pointer-events:all">
<title style="pointer-events:inherit">Layer 1</title>
<rect
id="rect"
fill="#FF0000"
height="70"
stroke="#000000"
stroke-width="5"
width="94"
x="69.5"
y="51.5"
style="pointer-events:inherit"
fill-opacity="1"
stroke-opacity="1"
></rect>
<text
fill="#000000"
stroke="#000000"
stroke-width="0"
x="116"
y="87"
id="svg_1"
font-size="24"
font-family="serif"
text-anchor="middle"
xml:space="preserve"
fill-opacity="1"
stroke-opacity="1"
font-style="italic"
>
B
</text>
<text
fill="#000000"
stroke="#000000"
stroke-width="0"
x="136"
y="107"
font-size="24"
font-family="serif"
text-anchor="middle"
xml:space="preserve"
fill-opacity="1"
stroke-opacity="1"
id="svg_2"
>
B
</text>
</g>
</svg>
`;
exports[`use various parts of svg-edit > check tool_bold #0`] = `
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
width="640"
height="480"
id="svgcontent"
overflow="visible"
x="640"
y="480"
viewBox="0 0 640 480"
>
<g class="layer" style="pointer-events:all">
<title style="pointer-events:inherit">Layer 1</title>
<rect
id="rect"
fill="#FF0000"
height="70"
stroke="#000000"
stroke-width="5"
width="94"
x="69.5"
y="51.5"
style="pointer-events:inherit"
fill-opacity="1"
stroke-opacity="1"
></rect>
<text
fill="#000000"
stroke="#000000"
stroke-width="0"
x="116"
y="87"
id="svg_1"
font-size="24"
font-family="serif"
text-anchor="middle"
xml:space="preserve"
fill-opacity="1"
stroke-opacity="1"
font-style="italic"
font-weight="bold"
>
B
</text>
<text
fill="#000000"
stroke="#000000"
stroke-width="0"
x="136"
y="107"
font-size="24"
font-family="serif"
text-anchor="middle"
xml:space="preserve"
fill-opacity="1"
stroke-opacity="1"
id="svg_2"
>
B
</text>
</g>
</svg>
`;
exports[`use various parts of svg-edit > check change color #0`] = `
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
width="640"
height="480"
id="svgcontent"
overflow="visible"
x="640"
y="480"
viewBox="0 0 640 480"
>
<g class="layer" style="pointer-events:all">
<title style="pointer-events:inherit">Layer 1</title>
<rect
id="rect"
fill="#FF0000"
height="70"
stroke="#000000"
stroke-width="5"
width="94"
x="69.5"
y="51.5"
style="pointer-events:inherit"
fill-opacity="1"
stroke-opacity="1"
></rect>
<text
fill="#ffff00"
stroke="#000000"
stroke-width="0"
x="116"
y="87"
id="svg_1"
font-size="24"
font-family="serif"
text-anchor="middle"
xml:space="preserve"
fill-opacity="1"
stroke-opacity="1"
font-style="italic"
font-weight="bold"
>
B
</text>
<text
fill="#000000"
stroke="#000000"
stroke-width="0"
x="136"
y="107"
font-size="24"
font-family="serif"
text-anchor="middle"
xml:space="preserve"
fill-opacity="1"
stroke-opacity="1"
id="svg_2"
>
B
</text>
</g>
</svg>
`;

View File

@ -1,6 +1,6 @@
describe('UI - Accessibility', function () { describe('UI - Accessibility', function () {
beforeEach(() => { beforeEach(() => {
cy.visit('/instrumented/svg-editor-es.html'); cy.visit('/instrumented/editor/index.html');
cy.injectAxe(); cy.injectAxe();
}); });
@ -25,6 +25,16 @@ describe('UI - Accessibility', function () {
locale: Object locale: Object
*/ */
}); });
cy.checkA11y(); cy.checkA11y(
{},
{
rules: {
'label-title-only': {enabled: false},
'page-has-heading-one': {enabled: false},
region: {enabled: false},
'scrollable-region-focusable': {enabled: false}
}
}
);
}); });
}); });

View File

@ -22,10 +22,10 @@ describe('UI - Control Points', function () {
cy.get('#tool_source_save').click(); cy.get('#tool_source_save').click();
cy.get('#svg_1').click().click(); cy.get('#svg_1').click().click();
cy.get('#pathpointgrip_0').trigger('mousedown', {which: 1}) cy.get('#pathpointgrip_0').trigger('mousedown', {which: 1, force: true})
.trigger('mousemove', randomOffset(), randomOffset(), {force: true}) .trigger('mousemove', randomOffset(), randomOffset(), {force: true})
.trigger('mouseup', {force: true}); .trigger('mouseup', {force: true});
cy.get('#pathpointgrip_1').trigger('mousedown', {which: 1}) cy.get('#pathpointgrip_1').trigger('mousedown', {which: 1, force: true})
.trigger('mousemove', randomOffset(), randomOffset(), {force: true}) .trigger('mousemove', randomOffset(), randomOffset(), {force: true})
.trigger('mouseup', {force: true}); .trigger('mouseup', {force: true});

View File

@ -14,7 +14,7 @@ describe('UI - Export tests', function () {
it('Editor - No parameters: Export button clicking; dialog opens', () => { it('Editor - No parameters: Export button clicking; dialog opens', () => {
openMainMenu(); openMainMenu();
cy.get('#tool_export').click(); cy.get('#tool_export').click({force: true});
cy.get('#dialog_content select'); cy.get('#dialog_content select');
}); });
}); });

View File

@ -11,13 +11,13 @@ describe('Fix issue 359', function () {
it('can undo without throwing', function () { it('can undo without throwing', function () {
cy.get('#tool_source').click(); cy.get('#tool_source').click();
cy.get('#svg_source_textarea') cy.get('#svg_source_textarea')
.type('{selectall}') .type('{selectall}', {force: true})
.type(`<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg"> .type(`<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg">
<g class="layer"> <g class="layer">
<title>Layer 1</title> <title>Layer 1</title>
<rect fill="#ffff00" height="70" width="165" x="179.5" y="146.5"/> <rect fill="#ffff00" height="70" width="165" x="179.5" y="146.5"/>
</g> </g>
</svg>`, {parseSpecialCharSequences: false}); </svg>`, {parseSpecialCharSequences: false, force: true});
cy.get('#tool_source_save').click(); cy.get('#tool_source_save').click();
cy.get('#tool_undo').click(); cy.get('#tool_undo').click();
cy.get('#tool_redo').click(); // test also redo to make the test more comprehensive cy.get('#tool_redo').click(); // test also redo to make the test more comprehensive

View File

@ -9,8 +9,10 @@ describe('Issue 364; IE errorwith rectangle selection by click', function () {
}); });
it('should set rectangle selection after click', function () { it('should set rectangle selection after click', function () {
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.get('#tools_rect_show') cy.get('#tools_rect_show')
.trigger('mousedown', {force: true}) .trigger('mousedown', {force: true})
.wait(100) // this delay seems necessary
.trigger('mouseup', {force: true}) .trigger('mouseup', {force: true})
.should((button) => { .should((button) => {
expect(button).to.have.class('tool_button_current'); expect(button).to.have.class('tool_button_current');

View File

@ -11,7 +11,7 @@ describe('Fix issue 407', function () {
it('can enter edit on text child', function () { it('can enter edit on text child', function () {
cy.get('#tool_source').click(); cy.get('#tool_source').click();
cy.get('#svg_source_textarea') cy.get('#svg_source_textarea')
.type('{selectall}') .type('{selectall}', {force: true})
.type(`<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg"> .type(`<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg">
<g class="layer"> <g class="layer">
<title>Layer 1</title> <title>Layer 1</title>
@ -24,7 +24,12 @@ describe('Fix issue 407', function () {
cy.get('#tool_source_save').click(); cy.get('#tool_source_save').click();
cy.get('#svg_1').click().dblclick(); cy.get('#svg_1').click().dblclick();
cy.get('#a_text').should('exist'); cy.get('#a_text').should('exist');
cy.get('#a_text').trigger('mousedown', {which: 1}).trigger('mouseup').dblclick().type('1234'); cy.get('#a_text')
.trigger('mousedown', {which: 1, force: true})
.trigger('mouseup', {force: true})
.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', 'he1234llo');
}); });
}); });

View File

@ -0,0 +1,33 @@
import {
visitAndApproveStorage
} from '../../../support/ui-test-helper.js';
// See https://github.com/SVG-Edit/svgedit/issues/423
describe('Fix issue 423', function () {
beforeEach(() => {
visitAndApproveStorage();
});
it('should not throw when undoing the move', function () {
cy.get('#tool_source').click();
cy.get('#svg_source_textarea')
.type('{selectall}', {force: true})
.type(`<svg width="300" height="300" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<g class="layer">
<title>Layer 1</title>
<g class="layer" id="svg_1">
<clipPath id="svg_2">
<rect height="150" id="svg_3" width="50" x="50" y="50"/>
</clipPath>
<rect clip-path="url(#svg_2)" fill="#0033b5" height="174.9" id="TANK1" width="78" x="77.5" y="29"/>
</g>
</g>
</svg>`, {parseSpecialCharSequences: false, force: true});
cy.get('#tool_source_save').click({force: true});
cy.get('#TANK1')
.trigger('mousedown', {force: true})
.trigger('mousemove', 50, 0, {force: true})
.trigger('mouseup', {force: true});
cy.get('#tool_undo').click({force: true});
});
});

View File

@ -0,0 +1,76 @@
import {
visitAndApproveStorage
} 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();
};
describe('use various parts of svg-edit', function () {
before(() => {
visitAndApproveStorage();
});
it('check tool_source', function () {
cy.get('#tool_source').click({force: true});
cy.get('#svg_source_textarea')
.type('{selectall}', {force: true})
.type(`<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<g class="layer">
<title>Layer 1</title>
<rect id="rect" fill="#FF0000" height="70" stroke="#000000" stroke-width="5" width="94" x="69.5" y="51.5"/>
</g>
</svg>`, {parseSpecialCharSequences: false});
cy.get('#tool_source_save').click({force: true});
testSnapshot();
});
it('check tool_fhpath', function () {
cy.get('#tool_fhpath')
.click({force: true});
cy.get('#rect')
.trigger('mousemove', 200, 200, {force: true})
.trigger('mousedown', 200, 200, {force: true})
.trigger('mousemove', 20, 20, {force: true})
.trigger('mouseup', {force: true});
cy.get('#svgcontent').toMatchSnapshot();
});
it('check tool_text', function () {
cy.get('#tool_text')
.click({force: true});
cy.get('#rect')
.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();
});
it('check tool_clone', function () {
cy.get('#svg_1').click({force: true});
cy.get('#tool_clone')
.click({force: true});
testSnapshot();
});
it('check tool_italic', function () {
cy.get('#svg_1').click({force: true});
cy.get('#tool_italic')
.click({force: true});
testSnapshot();
});
it('check tool_bold', function () {
cy.get('#svg_1').click({force: true});
cy.get('#tool_bold')
.click({force: true});
testSnapshot();
});
it('check change color', function () {
cy.get('#svg_1').click({force: true});
cy.get('[data-rgb="#ffff00"]')
.click({force: true});
testSnapshot();
});
});

View File

@ -1,5 +1,5 @@
import '../../../instrumented/jquery.min.js'; import '../../../instrumented/editor/jquery.min.js';
import * as contextmenu from '../../../instrumented/contextmenu.js'; import * as contextmenu from '../../../instrumented/editor/contextmenu.js';
describe('contextmenu', function () { describe('contextmenu', function () {
/** /**
@ -38,7 +38,7 @@ describe('contextmenu', function () {
}); });
it('Test svgedit.contextmenu adds valid menu item', function () { it('Test svgedit.contextmenu adds valid menu item', function () {
const validItem = {id: 'valid', label: 'anicelabel', action () { /* */ }}; const validItem = {id: 'valid', label: 'anicelabel', action () { /* empty fn */ }};
contextmenu.add(validItem); contextmenu.add(validItem);
assert.ok(contextmenu.hasCustomHandler('valid'), 'Valid menu item is added.'); assert.ok(contextmenu.hasCustomHandler('valid'), 'Valid menu item is added.');
@ -46,8 +46,8 @@ describe('contextmenu', function () {
}); });
it('Test svgedit.contextmenu rejects valid duplicate menu item id', function () { it('Test svgedit.contextmenu rejects valid duplicate menu item id', function () {
const validItem1 = {id: 'valid', label: 'anicelabel', action () { /**/ }}; const validItem1 = {id: 'valid', label: 'anicelabel', action () { /* empty fn */ }};
const validItem2 = {id: 'valid', label: 'anicelabel', action () { /**/ }}; const validItem2 = {id: 'valid', label: 'anicelabel', action () { /* empty fn */ }};
contextmenu.add(validItem1); contextmenu.add(validItem1);
assert.throws( assert.throws(

View File

@ -1,8 +1,8 @@
import '../../../instrumented/jquery.min.js'; import '../../../instrumented/editor/jquery.min.js';
import {NS} from '../../../instrumented/namespaces.js'; import {NS} from '../../../instrumented/common/namespaces.js';
import * as utilities from '../../../instrumented/utilities.js'; import * as utilities from '../../../instrumented/common/utilities.js';
import * as coords from '../../../instrumented/coords.js'; import * as coords from '../../../instrumented/svgcanvas/coords.js';
describe('coords', function () { describe('coords', function () {
let elemId = 1; let elemId = 1;

View File

@ -1,8 +1,8 @@
import '../../../instrumented/jquery.min.js'; import '../../../instrumented/editor/jquery.min.js';
import {NS} from '../../../instrumented/namespaces.js'; import {NS} from '../../../instrumented/common/namespaces.js';
import * as draw from '../../../instrumented/draw.js'; import * as draw from '../../../instrumented/svgcanvas/draw.js';
import * as units from '../../../instrumented/units.js'; import * as units from '../../../instrumented/common/units.js';
describe('draw.Drawing', function () { describe('draw.Drawing', function () {
const addOwnSpies = (obj) => { const addOwnSpies = (obj) => {
@ -20,6 +20,7 @@ describe('draw.Drawing', function () {
const PATH_ATTR = { const PATH_ATTR = {
// clone will convert relative to absolute, so the test for equality fails. // clone will convert relative to absolute, so the test for equality fails.
// d: 'm7.38867,57.38867c0,-27.62431 22.37569,-50 50,-50c27.62431,0 50,22.37569 50,50c0,27.62431 -22.37569,50 -50,50c-27.62431,0 -50,-22.37569 -50,-50z', // d: 'm7.38867,57.38867c0,-27.62431 22.37569,-50 50,-50c27.62431,0 50,22.37569 50,50c0,27.62431 -22.37569,50 -50,50c-27.62431,0 -50,-22.37569 -50,-50z',
// eslint-disable-next-line max-len
d: 'M7.389,57.389C7.389,29.764 29.764,7.389 57.389,7.389C85.013,7.389 107.389,29.764 107.389,57.389C107.389,85.013 85.013,107.389 57.389,107.389C29.764,107.389 7.389,85.013 7.389,57.389z', d: 'M7.389,57.389C7.389,29.764 29.764,7.389 57.389,7.389C85.013,7.389 107.389,29.764 107.389,57.389C107.389,85.013 85.013,107.389 57.389,107.389C29.764,107.389 7.389,85.013 7.389,57.389z',
transform: 'rotate(45 57.388671875000036,57.388671874999986) ', transform: 'rotate(45 57.388671875000036,57.388671874999986) ',
'stroke-width': '5', 'stroke-width': '5',
@ -43,7 +44,7 @@ describe('draw.Drawing', function () {
const getCurrentDrawing = function () { const getCurrentDrawing = function () {
return currentDrawing_; return currentDrawing_;
}; };
const setCurrentGroup = (cg) => { /* */ }; const setCurrentGroup = (cg) => { /* empty fn */ };
draw.init( draw.init(
/** /**
* @implements {module:draw.DrawCanvasInit} * @implements {module:draw.DrawCanvasInit}
@ -148,7 +149,7 @@ describe('draw.Drawing', function () {
assert.equal(typeof draw, typeof {}); assert.equal(typeof draw, typeof {});
assert.ok(draw.Drawing); assert.ok(draw.Drawing);
assert.equal(typeof draw.Drawing, typeof function () { /* */ }); assert.equal(typeof draw.Drawing, typeof function () { /* empty fn */ });
}); });
it('Test document creation', function () { it('Test document creation', function () {
@ -287,7 +288,7 @@ describe('draw.Drawing', function () {
it('Test getNumLayers', function () { it('Test getNumLayers', function () {
const drawing = new draw.Drawing(svg); const drawing = new draw.Drawing(svg);
assert.equal(typeof drawing.getNumLayers, typeof function () { /* */ }); assert.equal(typeof drawing.getNumLayers, typeof function () { /* empty fn */ });
assert.equal(drawing.getNumLayers(), 0); assert.equal(drawing.getNumLayers(), 0);
setupSVGWith3Layers(svg); setupSVGWith3Layers(svg);
@ -303,7 +304,7 @@ describe('draw.Drawing', function () {
const drawing = new draw.Drawing(svg); const drawing = new draw.Drawing(svg);
drawing.identifyLayers(); drawing.identifyLayers();
assert.equal(typeof drawing.hasLayer, typeof function () { /* */ }); assert.equal(typeof drawing.hasLayer, typeof function () { /* empty fn */ });
assert.ok(!drawing.hasLayer('invalid-layer')); assert.ok(!drawing.hasLayer('invalid-layer'));
assert.ok(drawing.hasLayer(LAYER3)); assert.ok(drawing.hasLayer(LAYER3));
@ -411,7 +412,7 @@ describe('draw.Drawing', function () {
drawing.identifyLayers(); drawing.identifyLayers();
assert.ok(drawing.getCurrentLayer); assert.ok(drawing.getCurrentLayer);
assert.equal(typeof drawing.getCurrentLayer, typeof function () { /* */ }); assert.equal(typeof drawing.getCurrentLayer, typeof function () { /* empty fn */ });
assert.ok(drawing.getCurrentLayer()); assert.ok(drawing.getCurrentLayer());
assert.equal(drawing.getCurrentLayer(), drawing.all_layers[2].getGroup()); assert.equal(drawing.getCurrentLayer(), drawing.all_layers[2].getGroup());
@ -424,7 +425,7 @@ describe('draw.Drawing', function () {
drawing.identifyLayers(); drawing.identifyLayers();
assert.ok(drawing.setCurrentLayer); assert.ok(drawing.setCurrentLayer);
assert.equal(typeof drawing.setCurrentLayer, typeof function () { /* */ }); assert.equal(typeof drawing.setCurrentLayer, typeof function () { /* empty fn */ });
drawing.setCurrentLayer(LAYER2); drawing.setCurrentLayer(LAYER2);
assert.equal(drawing.getCurrentLayerName(), LAYER2); assert.equal(drawing.getCurrentLayerName(), LAYER2);
@ -450,7 +451,7 @@ describe('draw.Drawing', function () {
drawing.identifyLayers(); drawing.identifyLayers();
assert.ok(drawing.setCurrentLayerName); assert.ok(drawing.setCurrentLayerName);
assert.equal(typeof drawing.setCurrentLayerName, typeof function () { /* */ }); assert.equal(typeof drawing.setCurrentLayerName, typeof function () { /* empty fn */ });
const oldName = drawing.getCurrentLayerName(); const oldName = drawing.getCurrentLayerName();
const newName = 'New Name'; const newName = 'New Name';
@ -472,9 +473,9 @@ describe('draw.Drawing', function () {
it('Test createLayer()', function () { it('Test createLayer()', function () {
const mockHrService = { const mockHrService = {
startBatchCommand () { /**/ }, startBatchCommand () { /* empty fn */ },
endBatchCommand () { /**/ }, endBatchCommand () { /* empty fn */ },
insertElement () { /**/ } insertElement () { /* empty fn */ }
}; };
addOwnSpies(mockHrService); addOwnSpies(mockHrService);
@ -483,7 +484,7 @@ describe('draw.Drawing', function () {
drawing.identifyLayers(); drawing.identifyLayers();
assert.ok(drawing.createLayer); assert.ok(drawing.createLayer);
assert.equal(typeof drawing.createLayer, typeof function () { /* */ }); assert.equal(typeof drawing.createLayer, typeof function () { /* empty fn */ });
const NEW_LAYER_NAME = 'Layer A'; const NEW_LAYER_NAME = 'Layer A';
const layerG = drawing.createLayer(NEW_LAYER_NAME, mockHrService); const layerG = drawing.createLayer(NEW_LAYER_NAME, mockHrService);
@ -502,10 +503,10 @@ describe('draw.Drawing', function () {
it('Test mergeLayer()', function () { it('Test mergeLayer()', function () {
const mockHrService = { const mockHrService = {
startBatchCommand () { /**/ }, startBatchCommand () { /* empty fn */ },
endBatchCommand () { /**/ }, endBatchCommand () { /* empty fn */ },
moveElement () { /**/ }, moveElement () { /* empty fn */ },
removeElement () { /**/ } removeElement () { /* empty fn */ }
}; };
addOwnSpies(mockHrService); addOwnSpies(mockHrService);
@ -518,7 +519,7 @@ describe('draw.Drawing', function () {
assert.equal(drawing.getCurrentLayer(), layers[2]); assert.equal(drawing.getCurrentLayer(), layers[2]);
assert.ok(drawing.mergeLayer); assert.ok(drawing.mergeLayer);
assert.equal(typeof drawing.mergeLayer, typeof function () { /* */ }); assert.equal(typeof drawing.mergeLayer, typeof function () { /* empty fn */ });
drawing.mergeLayer(mockHrService); drawing.mergeLayer(mockHrService);
@ -539,10 +540,10 @@ describe('draw.Drawing', function () {
it('Test mergeLayer() when no previous layer to merge', function () { it('Test mergeLayer() when no previous layer to merge', function () {
const mockHrService = { const mockHrService = {
startBatchCommand () { /**/ }, startBatchCommand () { /* empty fn */ },
endBatchCommand () { /**/ }, endBatchCommand () { /* empty fn */ },
moveElement () { /**/ }, moveElement () { /* empty fn */ },
removeElement () { /**/ } removeElement () { /* empty fn */ }
}; };
addOwnSpies(mockHrService); addOwnSpies(mockHrService);
@ -572,10 +573,10 @@ describe('draw.Drawing', function () {
it('Test mergeAllLayers()', function () { it('Test mergeAllLayers()', function () {
const mockHrService = { const mockHrService = {
startBatchCommand () { /**/ }, startBatchCommand () { /* empty fn */ },
endBatchCommand () { /**/ }, endBatchCommand () { /* empty fn */ },
moveElement () { /**/ }, moveElement () { /* empty fn */ },
removeElement () { /**/ } removeElement () { /* empty fn */ }
}; };
addOwnSpies(mockHrService); addOwnSpies(mockHrService);
@ -590,7 +591,7 @@ describe('draw.Drawing', function () {
drawing.identifyLayers(); drawing.identifyLayers();
assert.ok(drawing.mergeAllLayers); assert.ok(drawing.mergeAllLayers);
assert.equal(typeof drawing.mergeAllLayers, typeof function () { /* */ }); assert.equal(typeof drawing.mergeAllLayers, typeof function () { /* empty fn */ });
drawing.mergeAllLayers(mockHrService); drawing.mergeAllLayers(mockHrService);
@ -615,9 +616,9 @@ describe('draw.Drawing', function () {
it('Test cloneLayer()', function () { it('Test cloneLayer()', function () {
const mockHrService = { const mockHrService = {
startBatchCommand () { /**/ }, startBatchCommand () { /* empty fn */ },
endBatchCommand () { /**/ }, endBatchCommand () { /* empty fn */ },
insertElement () { /**/ } insertElement () { /* empty fn */ }
}; };
addOwnSpies(mockHrService); addOwnSpies(mockHrService);
@ -629,7 +630,7 @@ describe('draw.Drawing', function () {
drawing.identifyLayers(); drawing.identifyLayers();
assert.ok(drawing.cloneLayer); assert.ok(drawing.cloneLayer);
assert.equal(typeof drawing.cloneLayer, typeof function () { /* */ }); assert.equal(typeof drawing.cloneLayer, typeof function () { /* empty fn */ });
const clone = drawing.cloneLayer('clone', mockHrService); const clone = drawing.cloneLayer('clone', mockHrService);
@ -669,7 +670,7 @@ describe('draw.Drawing', function () {
drawing.identifyLayers(); drawing.identifyLayers();
assert.ok(drawing.getLayerVisibility); assert.ok(drawing.getLayerVisibility);
assert.equal(typeof drawing.getLayerVisibility, typeof function () { /* */ }); assert.equal(typeof drawing.getLayerVisibility, typeof function () { /* empty fn */ });
assert.ok(drawing.getLayerVisibility(LAYER1)); assert.ok(drawing.getLayerVisibility(LAYER1));
assert.ok(drawing.getLayerVisibility(LAYER2)); assert.ok(drawing.getLayerVisibility(LAYER2));
assert.ok(drawing.getLayerVisibility(LAYER3)); assert.ok(drawing.getLayerVisibility(LAYER3));
@ -683,7 +684,7 @@ describe('draw.Drawing', function () {
drawing.identifyLayers(); drawing.identifyLayers();
assert.ok(drawing.setLayerVisibility); assert.ok(drawing.setLayerVisibility);
assert.equal(typeof drawing.setLayerVisibility, typeof function () { /* */ }); assert.equal(typeof drawing.setLayerVisibility, typeof function () { /* empty fn */ });
drawing.setLayerVisibility(LAYER3, false); drawing.setLayerVisibility(LAYER3, false);
drawing.setLayerVisibility(LAYER2, true); drawing.setLayerVisibility(LAYER2, true);
@ -705,7 +706,7 @@ describe('draw.Drawing', function () {
drawing.identifyLayers(); drawing.identifyLayers();
assert.ok(drawing.getLayerOpacity); assert.ok(drawing.getLayerOpacity);
assert.equal(typeof drawing.getLayerOpacity, typeof function () { /* */ }); assert.equal(typeof drawing.getLayerOpacity, typeof function () { /* empty fn */ });
assert.strictEqual(drawing.getLayerOpacity(LAYER1), 1.0); assert.strictEqual(drawing.getLayerOpacity(LAYER1), 1.0);
assert.strictEqual(drawing.getLayerOpacity(LAYER2), 1.0); assert.strictEqual(drawing.getLayerOpacity(LAYER2), 1.0);
assert.strictEqual(drawing.getLayerOpacity(LAYER3), 1.0); assert.strictEqual(drawing.getLayerOpacity(LAYER3), 1.0);
@ -719,7 +720,7 @@ describe('draw.Drawing', function () {
drawing.identifyLayers(); drawing.identifyLayers();
assert.ok(drawing.setLayerOpacity); assert.ok(drawing.setLayerOpacity);
assert.equal(typeof drawing.setLayerOpacity, typeof function () { /* */ }); assert.equal(typeof drawing.setLayerOpacity, typeof function () { /* empty fn */ });
drawing.setLayerOpacity(LAYER1, 0.4); drawing.setLayerOpacity(LAYER1, 0.4);
drawing.setLayerOpacity(LAYER2, 'invalid-string'); drawing.setLayerOpacity(LAYER2, 'invalid-string');

View File

@ -1,30 +1,36 @@
import '../../../instrumented/jquery.min.js'; import '../../../instrumented/editor/jquery.min.js';
import {NS} from '../../../instrumented/namespaces.js'; import {NS} from '../../../instrumented/common/namespaces.js';
import * as transformlist from '../../../instrumented/svgtransformlist.js'; import * as transformlist from '../../../instrumented/common/svgtransformlist.js';
import * as utilities from '../../../instrumented/utilities.js'; import * as utilities from '../../../instrumented/common/utilities.js';
import * as hstory from '../../../instrumented/history.js'; import * as hstory from '../../../instrumented/svgcanvas/history.js';
describe('history', function () { describe('history', function () {
// TODO(codedread): Write tests for handling history events. // TODO(codedread): Write tests for handling history events.
// Mocked out methods. // Mocked out methods.
transformlist.changeRemoveElementFromListMap((elem) => { /* */ }); transformlist.changeRemoveElementFromListMap((elem) => { /* empty fn */ });
utilities.mock({ utilities.mock({
getHref (elem) { return '#foo'; }, getHref (elem) { return '#foo'; },
setHref (elem, val) { /* */ }, setHref (elem, val) { /* empty fn */ },
getRotationAngle (elem) { return 0; } getRotationAngle (elem) { return 0; }
}); });
// const svg = document.createElementNS(NS.SVG, 'svg'); // const svg = document.createElementNS(NS.SVG, 'svg');
let undoMgr = null; let undoMgr = null;
class MockCommand { class MockCommand extends hstory.Command {
constructor (optText) { this.text_ = optText; } constructor (optText) {
apply () { /* */ } // eslint-disable-line class-methods-use-this super();
unapply () { /* */ } // eslint-disable-line class-methods-use-this this.text = optText;
getText () { return this.text_; } }
apply (handler) {
super.apply(handler, () => { /* empty fn */ });
}
unapply (handler) {
super.unapply(handler, () => { /* empty fn */ });
}
elements () { return []; } // eslint-disable-line class-methods-use-this elements () { return []; } // eslint-disable-line class-methods-use-this
} }
@ -76,12 +82,12 @@ describe('history', function () {
assert.ok(hstory.RemoveElementCommand); assert.ok(hstory.RemoveElementCommand);
assert.ok(hstory.BatchCommand); assert.ok(hstory.BatchCommand);
assert.ok(hstory.UndoManager); assert.ok(hstory.UndoManager);
assert.equal(typeof hstory.MoveElementCommand, typeof function () { /* */ }); assert.equal(typeof hstory.MoveElementCommand, typeof function () { /* empty fn */ });
assert.equal(typeof hstory.InsertElementCommand, typeof function () { /* */ }); assert.equal(typeof hstory.InsertElementCommand, typeof function () { /* empty fn */ });
assert.equal(typeof hstory.ChangeElementCommand, typeof function () { /* */ }); assert.equal(typeof hstory.ChangeElementCommand, typeof function () { /* empty fn */ });
assert.equal(typeof hstory.RemoveElementCommand, typeof function () { /* */ }); assert.equal(typeof hstory.RemoveElementCommand, typeof function () { /* empty fn */ });
assert.equal(typeof hstory.BatchCommand, typeof function () { /* */ }); assert.equal(typeof hstory.BatchCommand, typeof function () { /* empty fn */ });
assert.equal(typeof hstory.UndoManager, typeof function () { /* */ }); assert.equal(typeof hstory.UndoManager, typeof function () { /* empty fn */ });
}); });
it('Test UndoManager methods', function () { it('Test UndoManager methods', function () {
@ -94,12 +100,12 @@ describe('history', function () {
assert.ok(undoMgr.getNextRedoCommandText); assert.ok(undoMgr.getNextRedoCommandText);
assert.equal(typeof undoMgr, typeof {}); assert.equal(typeof undoMgr, typeof {});
assert.equal(typeof undoMgr.addCommandToHistory, typeof function () { /* */ }); assert.equal(typeof undoMgr.addCommandToHistory, typeof function () { /* empty fn */ });
assert.equal(typeof undoMgr.getUndoStackSize, typeof function () { /* */ }); assert.equal(typeof undoMgr.getUndoStackSize, typeof function () { /* empty fn */ });
assert.equal(typeof undoMgr.getRedoStackSize, typeof function () { /* */ }); assert.equal(typeof undoMgr.getRedoStackSize, typeof function () { /* empty fn */ });
assert.equal(typeof undoMgr.resetUndoStack, typeof function () { /* */ }); assert.equal(typeof undoMgr.resetUndoStack, typeof function () { /* empty fn */ });
assert.equal(typeof undoMgr.getNextUndoCommandText, typeof function () { /* */ }); assert.equal(typeof undoMgr.getNextUndoCommandText, typeof function () { /* empty fn */ });
assert.equal(typeof undoMgr.getNextRedoCommandText, typeof function () { /* */ }); assert.equal(typeof undoMgr.getNextRedoCommandText, typeof function () { /* empty fn */ });
}); });
it('Test UndoManager.addCommandToHistory() function', function () { it('Test UndoManager.addCommandToHistory() function', function () {
@ -278,8 +284,8 @@ describe('history', function () {
let move = new hstory.MoveElementCommand(this.div3, this.div1, this.divparent); let move = new hstory.MoveElementCommand(this.div3, this.div1, this.divparent);
assert.ok(move.unapply); assert.ok(move.unapply);
assert.ok(move.apply); assert.ok(move.apply);
assert.equal(typeof move.unapply, typeof function () { /* */ }); assert.equal(typeof move.unapply, typeof function () { /* empty fn */ });
assert.equal(typeof move.apply, typeof function () { /* */ }); assert.equal(typeof move.apply, typeof function () { /* empty fn */ });
move.unapply(); move.unapply();
assert.equal(this.divparent.firstElementChild, this.div3); assert.equal(this.divparent.firstElementChild, this.div3);
@ -324,8 +330,8 @@ describe('history', function () {
let insert = new hstory.InsertElementCommand(this.div3); let insert = new hstory.InsertElementCommand(this.div3);
assert.ok(insert.unapply); assert.ok(insert.unapply);
assert.ok(insert.apply); assert.ok(insert.apply);
assert.equal(typeof insert.unapply, typeof function () { /* */ }); assert.equal(typeof insert.unapply, typeof function () { /* empty fn */ });
assert.equal(typeof insert.apply, typeof function () { /* */ }); assert.equal(typeof insert.apply, typeof function () { /* empty fn */ });
insert.unapply(); insert.unapply();
assert.equal(this.divparent.childElementCount, 2); assert.equal(this.divparent.childElementCount, 2);
@ -361,8 +367,8 @@ describe('history', function () {
let remove = new hstory.RemoveElementCommand(div6, null, this.divparent); let remove = new hstory.RemoveElementCommand(div6, null, this.divparent);
assert.ok(remove.unapply); assert.ok(remove.unapply);
assert.ok(remove.apply); assert.ok(remove.apply);
assert.equal(typeof remove.unapply, typeof function () { /* */ }); assert.equal(typeof remove.unapply, typeof function () { /* empty fn */ });
assert.equal(typeof remove.apply, typeof function () { /* */ }); assert.equal(typeof remove.apply, typeof function () { /* empty fn */ });
remove.unapply(); remove.unapply();
assert.equal(this.divparent.childElementCount, 4); assert.equal(this.divparent.childElementCount, 4);
@ -399,8 +405,8 @@ describe('history', function () {
{title: 'old title', class: 'foo'}); {title: 'old title', class: 'foo'});
assert.ok(change.unapply); assert.ok(change.unapply);
assert.ok(change.apply); assert.ok(change.apply);
assert.equal(typeof change.unapply, typeof function () { /* */ }); assert.equal(typeof change.unapply, typeof function () { /* empty fn */ });
assert.equal(typeof change.apply, typeof function () { /* */ }); assert.equal(typeof change.apply, typeof function () { /* empty fn */ });
change.unapply(); change.unapply();
assert.equal(this.div1.getAttribute('title'), 'old title'); assert.equal(this.div1.getAttribute('title'), 'old title');
@ -470,8 +476,8 @@ describe('history', function () {
assert.ok(change.unapply); assert.ok(change.unapply);
assert.ok(change.apply); assert.ok(change.apply);
assert.equal(typeof change.unapply, typeof function () { /* */ }); assert.equal(typeof change.unapply, typeof function () { /* empty fn */ });
assert.equal(typeof change.apply, typeof function () { /* */ }); assert.equal(typeof change.apply, typeof function () { /* empty fn */ });
change.unapply(); change.unapply();
assert.equal(line.getAttribute('class'), 'oldClass'); assert.equal(line.getAttribute('class'), 'oldClass');
@ -482,17 +488,17 @@ describe('history', function () {
it('Test BatchCommand', function () { it('Test BatchCommand', function () {
let concatResult = ''; let concatResult = '';
MockCommand.prototype.apply = function () { concatResult += this.text_; }; MockCommand.prototype.apply = function (handler) { concatResult += this.text; };
const batch = new hstory.BatchCommand(); const batch = new hstory.BatchCommand();
assert.ok(batch.unapply); assert.ok(batch.unapply);
assert.ok(batch.apply); assert.ok(batch.apply);
assert.ok(batch.addSubCommand); assert.ok(batch.addSubCommand);
assert.ok(batch.isEmpty); assert.ok(batch.isEmpty);
assert.equal(typeof batch.unapply, typeof function () { /* */ }); assert.equal(typeof batch.unapply, 'function');
assert.equal(typeof batch.apply, typeof function () { /* */ }); assert.equal(typeof batch.apply, 'function');
assert.equal(typeof batch.addSubCommand, typeof function () { /* */ }); assert.equal(typeof batch.addSubCommand, 'function');
assert.equal(typeof batch.isEmpty, typeof function () { /* */ }); assert.equal(typeof batch.isEmpty, 'function');
assert.ok(batch.isEmpty()); assert.ok(batch.isEmpty());
@ -505,12 +511,13 @@ describe('history', function () {
batch.apply(); batch.apply();
assert.equal(concatResult, 'abc'); assert.equal(concatResult, 'abc');
MockCommand.prototype.apply = function () { /* */ }; MockCommand.prototype.apply = function () { /* empty fn */ };
MockCommand.prototype.unapply = function () { concatResult += this.text_; }; MockCommand.prototype.unapply = function () { concatResult += this.text; };
concatResult = ''; concatResult = '';
assert.ok(!concatResult);
batch.unapply(); batch.unapply();
assert.equal(concatResult, 'cba'); assert.equal(concatResult, 'cba');
MockCommand.prototype.unapply = function () { /* */ }; MockCommand.prototype.unapply = function () { /* empty fn */ };
}); });
}); });

View File

@ -1,7 +1,7 @@
import '../../../instrumented/jquery.min.js'; import '../../../instrumented/editor/jquery.min.js';
import {NS} from '../../../instrumented/namespaces.js'; import {NS} from '../../../instrumented/common/namespaces.js';
import * as math from '../../../instrumented/math.js'; import * as math from '../../../instrumented/common/math.js';
describe('math', function () { describe('math', function () {
const svg = document.createElementNS(NS.SVG, 'svg'); const svg = document.createElementNS(NS.SVG, 'svg');
@ -11,9 +11,9 @@ describe('math', function () {
assert.ok(math.transformPoint); assert.ok(math.transformPoint);
assert.ok(math.isIdentity); assert.ok(math.isIdentity);
assert.ok(math.matrixMultiply); assert.ok(math.matrixMultiply);
assert.equal(typeof math.transformPoint, typeof function () { /* */ }); assert.equal(typeof math.transformPoint, typeof function () { /* empty fn */ });
assert.equal(typeof math.isIdentity, typeof function () { /* */ }); assert.equal(typeof math.isIdentity, typeof function () { /* empty fn */ });
assert.equal(typeof math.matrixMultiply, typeof function () { /* */ }); assert.equal(typeof math.matrixMultiply, typeof function () { /* empty fn */ });
}); });
it('Test svgedit.math.transformPoint() function', function () { it('Test svgedit.math.transformPoint() function', function () {

View File

@ -1,11 +1,12 @@
/* globals SVGPathSeg */ /* globals SVGPathSeg */
import '../../../instrumented/jquery.min.js'; import 'pathseg';
import '../../../instrumented/svgpathseg.js'; import '../../../instrumented/editor/jquery.min.js';
import {NS} from '../../../instrumented/namespaces.js';
import * as utilities from '../../../instrumented/utilities.js'; import {NS} from '../../../instrumented/common/namespaces.js';
import * as pathModule from '../../../instrumented/path.js'; import * as utilities from '../../../instrumented/common/utilities.js';
import {init as unitsInit} from '../../../instrumented/units.js'; import * as pathModule from '../../../instrumented/svgcanvas/path.js';
import {init as unitsInit} from '../../../instrumented/common/units.js';
describe('path', function () { describe('path', function () {
/** /**

View File

@ -1,9 +1,9 @@
import '../../../instrumented/jquery.min.js'; import '../../../instrumented/editor/jquery.min.js';
import {NS} from '../../../instrumented/namespaces.js'; import {NS} from '../../../instrumented/common/namespaces.js';
import * as utilities from '../../../instrumented/utilities.js'; import * as utilities from '../../../instrumented/common/utilities.js';
import * as coords from '../../../instrumented/coords.js'; import * as coords from '../../../instrumented/svgcanvas/coords.js';
import * as recalculate from '../../../instrumented/recalculate.js'; import * as recalculate from '../../../instrumented/svgcanvas/recalculate.js';
describe('recalculate', function () { describe('recalculate', function () {
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
@ -54,7 +54,7 @@ describe('recalculate', function () {
{ {
getSVGRoot () { return svg; }, getSVGRoot () { return svg; },
getStartTransform () { return ''; }, getStartTransform () { return ''; },
setStartTransform () { /* */ } setStartTransform () { /* empty fn */ }
} }
); );
} }

View File

@ -1,7 +1,7 @@
import '../../../instrumented/jquery.min.js'; import '../../../instrumented/editor/jquery.min.js';
import {NS} from '../../../instrumented/namespaces.js'; import {NS} from '../../../instrumented/common/namespaces.js';
import * as sanitize from '../../../instrumented/sanitize.js'; import * as sanitize from '../../../instrumented/svgcanvas/sanitize.js';
describe('sanitize', function () { describe('sanitize', function () {
const svg = document.createElementNS(NS.SVG, 'svg'); const svg = document.createElementNS(NS.SVG, 'svg');

View File

@ -1,7 +1,7 @@
import '../../../instrumented/jquery.min.js'; import '../../../instrumented/editor/jquery.min.js';
import * as select from '../../../instrumented/select.js'; import * as select from '../../../instrumented/svgcanvas/select.js';
import {NS} from '../../../instrumented/namespaces.js'; import {NS} from '../../../instrumented/common/namespaces.js';
describe('select', function () { describe('select', function () {
const sandbox = document.createElement('div'); const sandbox = document.createElement('div');
@ -81,10 +81,10 @@ describe('select', function () {
assert.ok(select.init); assert.ok(select.init);
assert.ok(select.getSelectorManager); assert.ok(select.getSelectorManager);
assert.equal(typeof select, typeof {}); assert.equal(typeof select, typeof {});
assert.equal(typeof select.Selector, typeof function () { /* */ }); assert.equal(typeof select.Selector, typeof function () { /* empty fn */ });
assert.equal(typeof select.SelectorManager, typeof function () { /* */ }); assert.equal(typeof select.SelectorManager, typeof function () { /* empty fn */ });
assert.equal(typeof select.init, typeof function () { /* */ }); assert.equal(typeof select.init, typeof function () { /* empty fn */ });
assert.equal(typeof select.getSelectorManager, typeof function () { /* */ }); assert.equal(typeof select.getSelectorManager, typeof function () { /* empty fn */ });
}); });
it('Test Selector DOM structure', function () { it('Test Selector DOM structure', function () {

View File

@ -1,8 +1,8 @@
import '../../../instrumented/jquery.min.js'; import '../../../instrumented/editor/jquery.min.js';
import {NS} from '../../../instrumented/namespaces.js'; import {NS} from '../../../instrumented/common/namespaces.js';
import * as transformlist from '../../../instrumented/svgtransformlist.js'; import * as transformlist from '../../../instrumented/common/svgtransformlist.js';
import {disableSupportsNativeTransformLists} from '../../../instrumented/browser.js'; import {disableSupportsNativeTransformLists} from '../../../instrumented/common/browser.js';
import almostEqualsPlugin from '../../support/assert-almostEquals.js'; import almostEqualsPlugin from '../../support/assert-almostEquals.js';
import expectOutOfBoundsExceptionPlugin from '../../support/assert-expectOutOfBoundsException.js'; import expectOutOfBoundsExceptionPlugin from '../../support/assert-expectOutOfBoundsException.js';
@ -73,7 +73,7 @@ describe('svgtransformlist', function () {
const t = svgcontent.createSVGTransform(); const t = svgcontent.createSVGTransform();
assert.ok(t); assert.ok(t);
assert.ok(rxform.initialize); assert.ok(rxform.initialize);
assert.equal(typeof rxform.initialize, typeof function () { /* */ }); assert.equal(typeof rxform.initialize, typeof function () { /* empty fn */ });
rxform.initialize(t); rxform.initialize(t);
assert.equal(rxform.numberOfItems, 1); assert.equal(rxform.numberOfItems, 1);
assert.equal(cxform.numberOfItems, 0); assert.equal(cxform.numberOfItems, 0);
@ -96,8 +96,8 @@ describe('svgtransformlist', function () {
assert.ok(rxform.appendItem); assert.ok(rxform.appendItem);
assert.ok(rxform.getItem); assert.ok(rxform.getItem);
assert.equal(typeof rxform.appendItem, typeof function () { /* */ }); assert.equal(typeof rxform.appendItem, typeof function () { /* empty fn */ });
assert.equal(typeof rxform.getItem, typeof function () { /* */ }); assert.equal(typeof rxform.getItem, typeof function () { /* empty fn */ });
rxform.appendItem(t1); rxform.appendItem(t1);
rxform.appendItem(t2); rxform.appendItem(t2);
@ -127,7 +127,7 @@ describe('svgtransformlist', function () {
const t1 = svgcontent.createSVGTransform(), const t1 = svgcontent.createSVGTransform(),
t2 = svgcontent.createSVGTransform(); t2 = svgcontent.createSVGTransform();
assert.ok(rxform.removeItem); assert.ok(rxform.removeItem);
assert.equal(typeof rxform.removeItem, typeof function () { /* */ }); assert.equal(typeof rxform.removeItem, typeof function () { /* empty fn */ });
rxform.appendItem(t1); rxform.appendItem(t1);
rxform.appendItem(t2); rxform.appendItem(t2);
@ -145,7 +145,7 @@ describe('svgtransformlist', function () {
const cxform = transformlist.getTransformList(circle); const cxform = transformlist.getTransformList(circle);
assert.ok(rxform.replaceItem); assert.ok(rxform.replaceItem);
assert.equal(typeof rxform.replaceItem, typeof function () { /* */ }); assert.equal(typeof rxform.replaceItem, typeof function () { /* empty fn */ });
const t1 = svgcontent.createSVGTransform(), const t1 = svgcontent.createSVGTransform(),
t2 = svgcontent.createSVGTransform(), t2 = svgcontent.createSVGTransform(),
@ -177,7 +177,7 @@ describe('svgtransformlist', function () {
const cxform = transformlist.getTransformList(circle); const cxform = transformlist.getTransformList(circle);
assert.ok(rxform.insertItemBefore); assert.ok(rxform.insertItemBefore);
assert.equal(typeof rxform.insertItemBefore, typeof function () { /* */ }); assert.equal(typeof rxform.insertItemBefore, typeof function () { /* empty fn */ });
const t1 = svgcontent.createSVGTransform(), const t1 = svgcontent.createSVGTransform(),
t2 = svgcontent.createSVGTransform(), t2 = svgcontent.createSVGTransform(),

View File

@ -1,8 +1,10 @@
import '../../../instrumented/jquery.min.js'; /* eslint-disable max-len */
import '../../../instrumented/jquery-ui/jquery-ui-1.8.17.custom.min.js'; import '../../../instrumented/editor/jquery.min.js';
import '../../../instrumented/editor/jquery-ui/jquery-ui-1.8.17.custom.min.js';
import '../../../instrumented/svgpathseg.js'; import SvgCanvas from '../../../instrumented/svgcanvas/svgcanvas.js';
import SvgCanvas from '../../../instrumented/svgcanvas.js';
// import '../../../instrumented/'
describe('Basic Module', function () { describe('Basic Module', function () {
// helper functions // helper functions

View File

@ -1,6 +1,6 @@
import '../../../instrumented/jquery.min.js'; import '../../../instrumented/editor/jquery.min.js';
import * as units from '../../../instrumented/units.js'; import * as units from '../../../instrumented/common/units.js';
describe('units', function () { describe('units', function () {
/** /**
@ -49,7 +49,7 @@ describe('units', function () {
it('Test svgedit.units.shortFloat()', function () { it('Test svgedit.units.shortFloat()', function () {
assert.ok(units.shortFloat); assert.ok(units.shortFloat);
assert.equal(typeof units.shortFloat, typeof function () { /* */ }); assert.equal(typeof units.shortFloat, typeof function () { /* empty fn */ });
const {shortFloat} = units; const {shortFloat} = units;
assert.equal(shortFloat(0.00000001), 0); assert.equal(shortFloat(0.00000001), 0);
@ -61,7 +61,7 @@ describe('units', function () {
it('Test svgedit.units.isValidUnit()', function () { it('Test svgedit.units.isValidUnit()', function () {
assert.ok(units.isValidUnit); assert.ok(units.isValidUnit);
assert.equal(typeof units.isValidUnit, typeof function () { /* */ }); assert.equal(typeof units.isValidUnit, typeof function () { /* empty fn */ });
const {isValidUnit} = units; const {isValidUnit} = units;
assert.ok(isValidUnit('0')); assert.ok(isValidUnit('0'));
@ -85,7 +85,7 @@ describe('units', function () {
it('Test svgedit.units.convertUnit()', function () { it('Test svgedit.units.convertUnit()', function () {
assert.ok(units.convertUnit); assert.ok(units.convertUnit);
assert.equal(typeof units.convertUnit, typeof function () { /* */ }); assert.equal(typeof units.convertUnit, typeof function () { /* empty fn */ });
// cm in default setup // cm in default setup
assert.equal(units.convertUnit(42), 1.1113); assert.equal(units.convertUnit(42), 1.1113);
assert.equal(units.convertUnit(42, 'px'), 42); assert.equal(units.convertUnit(42, 'px'), 42);

View File

@ -1,11 +1,13 @@
import '../../../instrumented/jquery.min.js'; /* eslint-disable max-len */
import 'pathseg';
import '../../../instrumented/svgpathseg.js'; import '../../../instrumented/editor/jquery.min.js';
import {NS} from '../../../instrumented/namespaces.js';
import * as utilities from '../../../instrumented/utilities.js'; import {NS} from '../../../instrumented/common/namespaces.js';
import * as transformlist from '../../../instrumented/svgtransformlist.js'; import * as utilities from '../../../instrumented/common/utilities.js';
import * as math from '../../../instrumented/math.js'; import * as transformlist from '../../../instrumented/common/svgtransformlist.js';
import * as path from '../../../instrumented/path.js'; import * as math from '../../../instrumented/common/math.js';
import * as path from '../../../instrumented/svgcanvas/path.js';
import setAssertionMethods from '../../support/assert-close.js'; import setAssertionMethods from '../../support/assert-close.js';
chai.use(setAssertionMethods); chai.use(setAssertionMethods);

View File

@ -1,10 +1,11 @@
import '../../../instrumented/jquery.min.js'; /* eslint-disable max-len */
import 'pathseg';
import '../../../instrumented/editor/jquery.min.js';
import '../../../instrumented/svgpathseg.js'; import {NS} from '../../../instrumented/common/namespaces.js';
import {NS} from '../../../instrumented/namespaces.js'; import * as utilities from '../../../instrumented/common/utilities.js';
import * as utilities from '../../../instrumented/utilities.js'; import * as transformlist from '../../../instrumented/common/svgtransformlist.js';
import * as transformlist from '../../../instrumented/svgtransformlist.js'; import * as math from '../../../instrumented/common/math.js';
import * as math from '../../../instrumented/math.js';
describe('utilities performance', function () { describe('utilities performance', function () {
let currentLayer, groupWithMatrixTransform, textWithMatrixTransform; let currentLayer, groupWithMatrixTransform, textWithMatrixTransform;

View File

@ -1,8 +1,9 @@
import '../../../instrumented/jquery.min.js'; /* eslint-disable max-len */
import '../../../instrumented/editor/jquery.min.js';
import * as browser from '../../../instrumented/browser.js'; import * as browser from '../../../instrumented/common/browser.js';
import * as utilities from '../../../instrumented/utilities.js'; import * as utilities from '../../../instrumented/common/utilities.js';
import {NS} from '../../../instrumented/namespaces.js'; import {NS} from '../../../instrumented/common/namespaces.js';
describe('utilities', function () { describe('utilities', function () {
/** /**
@ -27,7 +28,7 @@ describe('utilities', function () {
svgroot.append(elem); svgroot.append(elem);
return elem; return elem;
} }
const mockPathActions = {resetOrientation () { /* */ }}; const mockPathActions = {resetOrientation () { /* empty fn */ }};
let mockHistorySubCommands = []; let mockHistorySubCommands = [];
const mockHistory = { const mockHistory = {
BatchCommand: class { BatchCommand: class {
@ -100,7 +101,7 @@ describe('utilities', function () {
it('Test svgedit.utilities package', function () { it('Test svgedit.utilities package', function () {
assert.ok(utilities); assert.ok(utilities);
assert.ok(utilities.toXml); assert.ok(utilities.toXml);
assert.equal(typeof utilities.toXml, typeof function () { /* */ }); assert.equal(typeof utilities.toXml, typeof function () { /* empty fn */ });
}); });
it('Test svgedit.utilities.toXml() function', function () { it('Test svgedit.utilities.toXml() function', function () {

View File

@ -2,8 +2,8 @@
// the project's config changing) // the project's config changing)
import codeCoverageTask from '@cypress/code-coverage/task.js'; import codeCoverageTask from '@cypress/code-coverage/task.js';
import {initPlugin} from 'cypress-plugin-snapshots/plugin.js';
// eslint-disable-next-line import/no-anonymous-default-export
export default (on, config) => { export default (on, config) => {
// `on` is used to hook into various events Cypress emits // `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config // `config` is the resolved Cypress config
@ -13,5 +13,6 @@ export default (on, config) => {
// https://docs.cypress.io/guides/tooling/code-coverage.html#Install-the-plugin // https://docs.cypress.io/guides/tooling/code-coverage.html#Install-the-plugin
codeCoverageTask(on, config); codeCoverageTask(on, config);
initPlugin(on, config);
return config; return config;
}; };

View File

@ -1,4 +1,4 @@
/* eslint-disable jsdoc/check-examples */ /* eslint-disable max-len */
import assertionWrapper from './assertion-wrapper.js'; import assertionWrapper from './assertion-wrapper.js';
/** /**

View File

@ -1,14 +0,0 @@
/* globals require */
/* eslint-disable import/no-commonjs */
const copyfiles = require('copyfiles');
const pkg = require('../../package.json');
copyfiles([
...pkg.nyc.exclude,
'instrumented'
], {
up: 1
}, () => {
console.log('Done');
});

View File

@ -42,3 +42,10 @@ import '@cypress/code-coverage/support.js';
* @see https://www.npmjs.com/package/cypress-axe * @see https://www.npmjs.com/package/cypress-axe
*/ */
import 'cypress-axe'; import 'cypress-axe';
/*****
* SNAPSHOTS
* @see https://www.npmjs.com/package/cypress-plugin-snapshots
*/
import 'cypress-plugin-snapshots/commands.js';

View File

@ -4,7 +4,7 @@ export const approveStorage = () => {
}; };
export const visitAndApproveStorage = () => { export const visitAndApproveStorage = () => {
cy.visit('/instrumented/svg-editor-es.html'); cy.visit('/instrumented/editor/index.html');
approveStorage(); approveStorage();
}; };

View File

@ -3,10 +3,10 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>Minimal demo of SvgCanvas</title> <title>Minimal demo of SvgCanvas</title>
<script src="../editor/jquery.min.js"></script> <script src="../src/editor/jquery.min.js"></script>
<script src="../editor/jquery-ui/jquery-ui-1.8.17.custom.min.js"></script> <script src="../src/editor/jquery-ui/jquery-ui-1.8.17.custom.min.js"></script>
<style> #svgroot { overflow: hidden; } </style> <style> #svgroot { overflow: hidden; } </style>
<link rel="shortcut icon" type="image/x-icon" href="../editor/images/logo.png" /> <link rel="shortcut icon" type="image/x-icon" href="../src/editor/images/logo.png" />
</head> </head>
<body> <body>
@ -26,7 +26,7 @@
<script type="module"> <script type="module">
/* globals canvas */ /* globals canvas */
import SvgCanvas from '../editor/svgcanvas.js'; import SvgCanvas from '../src/svgcanvas/svgcanvas.js';
const container = document.querySelector('#editorContainer'); const container = document.querySelector('#editorContainer');
const {width, height} = {width: 500, height: 300}; const {width, height} = {width: 500, height: 300};

4894
dist/canvg.js vendored

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More