2018-05-15 15:16:28 +00:00
|
|
|
/* eslint-env qunit */
|
|
|
|
/* globals $, svgedit, equals */
|
|
|
|
/* eslint-disable no-var */
|
|
|
|
$(function () {
|
2018-05-18 04:12:27 +00:00
|
|
|
// log function
|
|
|
|
QUnit.log = function (details) {
|
|
|
|
if (window.console && window.console.log) {
|
|
|
|
window.console.log(details.result + ' :: ' + details.message);
|
|
|
|
}
|
|
|
|
};
|
2018-05-15 15:16:28 +00:00
|
|
|
|
2018-05-18 04:12:27 +00:00
|
|
|
var svg = document.createElementNS(svgedit.NS.SVG, 'svg');
|
2018-05-15 15:16:28 +00:00
|
|
|
|
2018-05-18 04:12:27 +00:00
|
|
|
test('Test sanitizeSvg() strips ws from style attr', function () {
|
|
|
|
expect(2);
|
2018-05-15 15:16:28 +00:00
|
|
|
|
2018-05-18 04:12:27 +00:00
|
|
|
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);
|
2018-05-15 15:16:28 +00:00
|
|
|
|
2018-05-18 04:12:27 +00:00
|
|
|
equals(rect.getAttribute('stroke'), 'blue');
|
|
|
|
equals(rect.getAttribute('stroke-width'), '40');
|
|
|
|
});
|
2018-05-15 15:16:28 +00:00
|
|
|
});
|