2021-05-12 23:00:09 +00:00
|
|
|
import { NS } from '../../../instrumented/common/namespaces.js';
|
2020-07-14 16:06:33 +00:00
|
|
|
import * as sanitize from '../../../instrumented/svgcanvas/sanitize.js';
|
2019-11-24 03:29:24 +00:00
|
|
|
|
|
|
|
describe('sanitize', function () {
|
|
|
|
const svg = document.createElementNS(NS.SVG, 'svg');
|
|
|
|
|
|
|
|
it('Test sanitizeSvg() strips ws from style attr', function () {
|
|
|
|
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');
|
|
|
|
});
|
|
|
|
});
|