- Refactoring (minor): Add favicon to canvas demo
- Linting (ESLint Markdown JavaScript): Add `eslint-plugin-markdown` with
slightly loosened config (`no-undef` and `padded-blocks` off and
`no-unused-vars` as a warning)
- Linting (ESLint JSDoc code comments): Add `eslint-plugin-jsdoc` and apply to
JSDoc code comments
- Linting (ESLint): Completely avoid unescaped tabs in files
- Docs (Linting): Add linting info file
- npm: Rename `copy-deps` script to `copy`
- Refactoring: Add stackblur-canvas as a dependency and copy it in (until such time as we can do so for canvg)
26 lines
801 B
JavaScript
26 lines
801 B
JavaScript
/* eslint-env qunit */
|
|
import {NS} from '../editor/namespaces.js';
|
|
import * as sanitize from '../editor/sanitize.js';
|
|
|
|
// log function
|
|
QUnit.log((details) => {
|
|
if (window.console && window.console.log) {
|
|
window.console.log(details.result + ' :: ' + details.message);
|
|
}
|
|
});
|
|
|
|
const svg = document.createElementNS(NS.SVG, 'svg');
|
|
|
|
QUnit.test('Test sanitizeSvg() strips ws from style attr', function (assert) {
|
|
assert.expect(2);
|
|
|
|
const rect = document.createElementNS(NS.SVG, 'rect');
|
|
rect.setAttribute('style', 'stroke: blue ;\t\tstroke-width :\t\t40;');
|
|
// sanitizeSvg() requires the node to have a parent and a document.
|
|
svg.append(rect);
|
|
sanitize.sanitizeSvg(rect);
|
|
|
|
assert.equal(rect.getAttribute('stroke'), 'blue');
|
|
assert.equal(rect.getAttribute('stroke-width'), '40');
|
|
});
|