Test summary: two tests failing: draw.js (releaseId), svgedit.recalculate (text w/tspan with simple translate)

- Testing: Add node-static to get tests working
- Testing: Fix timing for ensuring expanding iframe size to fit content
- Testing: Add favicon to test files
- Refactoring: Move scripts to own files and lint
master
Brett Zamir 2018-05-17 12:57:51 +08:00
parent a3b3525789
commit fff77db4f1
24 changed files with 88 additions and 21 deletions

View File

@ -27,14 +27,6 @@
<a href="http://code.google.com/chrome/chromeframe/">Google Chrome Frame plugin</a>.</p>
</div>
<script>
/*globals $*/
var viewportHeight = window.innerHeight || ($(window).height() - 140);
var iframe = document.createElement('iframe');
iframe.style.width = '100%';
iframe.style.height = viewportHeight + 'px';
iframe.src = 'http://caniuse.com/#cats=SVG';
document.body.appendChild(iframe);
</script>
<script src="browser-not-supported.js"></script>
</body>
</html>

View File

@ -0,0 +1,8 @@
/* eslint-disable no-var */
/* globals $ */
var viewportHeight = window.innerHeight || ($(window).height() - 140);
var iframe = document.createElement('iframe');
iframe.style.width = '100%';
iframe.style.height = viewportHeight + 'px';
iframe.src = 'http://caniuse.com/#cats=SVG';
document.body.appendChild(iframe);

View File

@ -5,7 +5,7 @@
<title>SVG Edit</title>
<link rel="stylesheet" href="style.css">
<script>
/** this method adds the script that overrides the default open/save handlers */
// This method adds the script that overrides the default open/save handlers
function addHandlers () {
var cdoc = document.getElementById('container').contentDocument;
if (cdoc) {

41
package-lock.json generated
View File

@ -250,6 +250,12 @@
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
"dev": true
},
"colors": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.2.5.tgz",
"integrity": "sha512-erNRLao/Y3Fv54qUa0LBB+//Uf3YwMUmdJinN20yMXm9zdKKqH9wt7R9IIVZ+K7ShzfpLV/Zg8+VyrBJYB4lpg==",
"dev": true
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@ -934,6 +940,12 @@
"yallist": "^2.1.2"
}
},
"mime": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
"dev": true
},
"mimic-fn": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",
@ -982,6 +994,17 @@
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
"dev": true
},
"node-static": {
"version": "0.7.10",
"resolved": "https://registry.npmjs.org/node-static/-/node-static-0.7.10.tgz",
"integrity": "sha512-bd7zO5hvCWzdglgwz9t82T4mYTEUzEG5pXnSqEzitvmEacusbhl8/VwuCbMaYR9g2PNK5191yBtAEQLJEmQh1A==",
"dev": true,
"requires": {
"colors": ">=0.6.0",
"mime": "^1.2.9",
"optimist": ">=0.3.4"
}
},
"normalize-package-data": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz",
@ -1018,6 +1041,24 @@
"mimic-fn": "^1.0.0"
}
},
"optimist": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz",
"integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=",
"dev": true,
"requires": {
"minimist": "~0.0.1",
"wordwrap": "~0.0.2"
},
"dependencies": {
"wordwrap": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz",
"integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=",
"dev": true
}
}
},
"optionator": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz",

View File

@ -11,6 +11,7 @@
"engines": {},
"scripts": {
"eslint": "eslint .",
"start": "echo \"Open file to http://localhost:8000/test/all_tests.html\" && static -p 8000",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
@ -36,7 +37,9 @@
"url": "https://github.com/SVG-Edit/svgedit/issues"
},
"homepage": "https://github.com/SVG-Edit/svgedit#readme",
"dependencies": {},
"dependencies": {
"static-cli": "0.0.13"
},
"devDependencies": {
"eslint": "4.19.1",
"eslint-config-standard": "11.0.0",

View File

@ -289,7 +289,7 @@ svgEditor.addExtension("Hello World", function () {
<script
src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js">
</script>
<script>CFInstall.check({ mode: "overlay" });</script>
<script>CFInstall.check({mode: 'overlay'});</script>
<![endif]-->
</body>

View File

@ -2,6 +2,7 @@
<html>
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/png" href="../editor/images/logo.png"/>
<title>All SVG-edit Tests</title>
</head>
<body>

View File

@ -1,8 +1,12 @@
/* eslint-disable no-var */
window.setTimeout(function () {
var iframes = document.getElementsByTagName('iframe');
for (var i = 0, len = iframes.length; i < len; ++i) {
var f = iframes[i];
f.style.height = (f.contentDocument.body.scrollHeight + 20) + 'px';
}
}, 5000);
var iframes = document.getElementsByTagName('iframe');
for (var i = 0, len = iframes.length; i < len; ++i) {
var f = iframes[i];
(function (f) {
f.addEventListener('load', function () {
f.contentWindow.QUnit.done = function () {
f.style.height = (f.contentDocument.body.scrollHeight + 20) + 'px';
};
});
})(f);
}

View File

@ -3,11 +3,14 @@
<head>
<meta charset="utf-8" />
<title>Unit Tests for contextmenu.js</title>
<link rel="icon" type="image/png" href="../editor/images/logo.png"/>
<link rel="stylesheet" href="qunit/qunit.css"/>
<script src="../editor/jquery.js"></script>
<script>
// Mock for browser.js
window.svgEditor = {ready: function(){}};
window.svgEditor = {
ready: function () {}
};
</script>
<script src="../editor/contextmenu.js"></script>
<script src="qunit/qunit.js"></script>

View File

@ -3,6 +3,7 @@
<head>
<meta charset="utf-8" />
<title>Unit Tests for coords.js</title>
<link rel="icon" type="image/png" href="../editor/images/logo.png"/>
<link rel="stylesheet" href="qunit/qunit.css"/>
<script src="../editor/jquery.js"></script>
<script src="../editor/svgedit.js"></script>

View File

@ -3,6 +3,7 @@
<head>
<meta charset="utf-8" />
<title>Unit Tests for draw.js</title>
<link rel="icon" type="image/png" href="../editor/images/logo.png"/>
<link rel="stylesheet" href="qunit/qunit.css"/>
<script src="../editor/jquery.js"></script>
<script src="../editor/svgedit.js"></script>

View File

@ -3,6 +3,7 @@
<head>
<meta charset="utf-8" />
<title>Unit Tests for history.js</title>
<link rel="icon" type="image/png" href="../editor/images/logo.png"/>
<link rel="stylesheet" href="qunit/qunit.css"/>
<script src="../editor/jquery.js"></script>
<script src="../editor/svgedit.js"></script>

View File

@ -3,6 +3,7 @@
<head>
<meta charset="utf-8" />
<title>Unit Tests for jquery-svg.js</title>
<link rel="icon" type="image/png" href="../editor/images/logo.png"/>
<link rel="stylesheet" href="qunit/qunit.css"/>
<script src="../editor/jquery.js"></script>
<script src="qunit/qunit.js"></script>

View File

@ -3,6 +3,7 @@
<head>
<meta charset="utf-8" />
<title>Unit Tests for math.js</title>
<link rel="icon" type="image/png" href="../editor/images/logo.png"/>
<link rel="stylesheet" href="qunit/qunit.css"/>
<script src="../editor/jquery.js"></script>
<script src="../editor/svgedit.js"></script>

View File

@ -3,6 +3,7 @@
<head>
<meta charset="utf-8" />
<title>Unit Tests for path.js</title>
<link rel="icon" type="image/png" href="../editor/images/logo.png"/>
<link rel="stylesheet" href="qunit/qunit.css"/>
<script src="../editor/jquery.js"></script>
<script src="../editor/svgedit.js"></script>

View File

@ -3,6 +3,7 @@
<head>
<meta charset="utf-8" />
<title>Unit Tests for recalculate.js</title>
<link rel="icon" type="image/png" href="../editor/images/logo.png"/>
<link rel="stylesheet" href="qunit/qunit.css"/>
<script src="../editor/jquery.js"></script>
<script src="../editor/jquery-svg.js"></script>

View File

@ -3,6 +3,7 @@
<head>
<meta charset="utf-8" />
<title>Unit Tests for sanitize.js</title>
<link rel="icon" type="image/png" href="../editor/images/logo.png"/>
<link rel="stylesheet" href="qunit/qunit.css"/>
<script src="../editor/jquery.js"></script>
<script src="../editor/svgedit.js"></script>

View File

@ -3,6 +3,7 @@
<head>
<meta charset="utf-8" />
<title>Unit Tests for select.js</title>
<link rel="icon" type="image/png" href="../editor/images/logo.png"/>
<link rel="stylesheet" href="qunit/qunit.css"/>
<script src="../editor/jquery.js"></script>
<script src="../editor/svgedit.js"></script>

View File

@ -3,13 +3,14 @@
<head>
<meta charset="utf-8" />
<title>Unit Tests for svgtransformlist.js</title>
<link rel="icon" type="image/png" href="../editor/images/logo.png"/>
<link rel="stylesheet" href="qunit/qunit.css"/>
<script src="../editor/jquery.js"></script>
<script src="../editor/svgedit.js"></script>
<script>
// Mock for browser.js
svgedit.browser = {};
svgedit.browser.supportsNativeTransformLists = function() { return false;}
svgedit.browser.supportsNativeTransformLists = function () { return false; }
</script>
<script src="../editor/svgtransformlist.js"></script>
<script src="qunit/qunit.js"></script>

View File

@ -3,6 +3,7 @@
<head>
<meta charset="utf-8" />
<title>Unit Tests for svgutils.js BBox functions</title>
<link rel="icon" type="image/png" href="../editor/images/logo.png"/>
<link rel="stylesheet" href="qunit/qunit.css"/>
<script src="../editor/jquery.js"></script>
<script src="../editor/svgedit.js"></script>

View File

@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<title>Performance Unit Tests for svgutils.js</title>
<link rel="icon" type="image/png" href="../editor/images/logo.png"/>
<link rel="stylesheet" href="qunit/qunit.css"/>
<script src="../editor/jquery.js"></script>
<script src="../editor/svgedit.js"></script>

View File

@ -3,6 +3,7 @@
<head>
<meta charset="utf-8" />
<title>Unit Tests for svgutils.js</title>
<link rel="icon" type="image/png" href="../editor/images/logo.png"/>
<link rel="stylesheet" href="qunit/qunit.css"/>
<script src="../editor/jquery.js"></script>
<script src="../editor/svgedit.js"></script>

View File

@ -3,6 +3,7 @@
<head>
<meta charset="utf-8" />
<title>Unit Tests for SvgCanvas</title>
<link rel="icon" type="image/png" href="../editor/images/logo.png"/>
<link rel="stylesheet" href="qunit/qunit.css"/>
<script src="../editor/jquery.js"></script>
<script src="../editor/jquerybbq/jquery.bbq.min.js"></script>

View File

@ -3,6 +3,7 @@
<head>
<meta charset="utf-8" />
<title>Unit Tests for units.js</title>
<link rel="icon" type="image/png" href="../editor/images/logo.png"/>
<link rel="stylesheet" href="qunit/qunit.css"/>
<script src="../editor/jquery.js"></script>
<script src="../editor/svgedit.js"></script>