- Testing (math_test): Fix undeclared variables

- Testing: Move JavaScript out of HTML to own files
- Linting: ESLint; unfinished: editor/extensions/, editor/ (root); some of test
This commit is contained in:
Brett Zamir
2018-05-15 23:16:28 +08:00
parent 15331535f8
commit f7bdf6be18
34 changed files with 4062 additions and 4058 deletions

26
test/sanitize_test.js Normal file
View File

@@ -0,0 +1,26 @@
/* eslint-env qunit */
/* globals $, svgedit, equals */
/* eslint-disable no-var */
$(function () {
// log function
QUnit.log = function (details) {
if (window.console && window.console.log) {
window.console.log(details.result + ' :: ' + details.message);
}
};
var svg = document.createElementNS(svgedit.NS.SVG, 'svg');
test('Test sanitizeSvg() strips ws from style attr', function () {
expect(2);
var rect = document.createElementNS(svgedit.NS.SVG, 'rect');
rect.setAttribute('style', 'stroke: blue ; stroke-width : 40;');
// sanitizeSvg() requires the node to have a parent and a document.
svg.appendChild(rect);
svgedit.sanitize.sanitizeSvg(rect);
equals(rect.getAttribute('stroke'), 'blue');
equals(rect.getAttribute('stroke-width'), '40');
});
});