2013-02-13 15:04:58 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
2013-10-29 03:32:01 +00:00
|
|
|
<meta charset="utf-8" />
|
2013-02-17 17:28:19 +00:00
|
|
|
<title>Unit Tests for sanitize.js</title>
|
- Linting (HTML): Use double-quotes for attributes, remove redundant `type=text/css`,
indent/lbs, consistent non-use of HTML namespace, consistent indents, consistent charset
casing
- Linting (Markdown): Add `.remarkrc`, use proper hierarchical headings, use consistent
heading format, trailing spaces
- `composer.json`: consistent property spacing
- License: Add `.txt` extension, update copyright date, and reflect type (MIT) in file name
- Credits: Add self
- npm: Add `package.json` (version 3.0.0-alpha.1 for npm release only; just reserving name)
2018-05-13 01:58:13 +00:00
|
|
|
<link rel="stylesheet" href="qunit/qunit.css"/>
|
|
|
|
<script src="../editor/jquery.js"></script>
|
|
|
|
<script src="../editor/svgedit.js"></script>
|
|
|
|
<script src="../editor/pathseg.js"></script>
|
|
|
|
<script src="../editor/browser.js"></script>
|
|
|
|
<script src="../editor/svgutils.js"></script>
|
|
|
|
<script src="../editor/sanitize.js"></script>
|
|
|
|
<script src="qunit/qunit.js"></script>
|
2013-02-17 17:28:19 +00:00
|
|
|
<script>
|
|
|
|
$(function() {
|
|
|
|
// log function
|
2014-04-07 05:33:44 +00:00
|
|
|
QUnit.log = function(details) {
|
2013-02-13 15:04:58 +00:00
|
|
|
if (window.console && window.console.log) {
|
2014-04-07 05:33:44 +00:00
|
|
|
window.console.log(details.result +' :: '+ details.message);
|
2013-02-13 15:04:58 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-02-16 15:02:26 +00:00
|
|
|
var svg = document.createElementNS(svgedit.NS.SVG, 'svg');
|
|
|
|
|
2013-02-13 15:04:58 +00:00
|
|
|
test('Test sanitizeSvg() strips ws from style attr', function() {
|
|
|
|
expect(2);
|
|
|
|
|
2013-02-16 15:02:26 +00:00
|
|
|
var rect = document.createElementNS(svgedit.NS.SVG, 'rect');
|
2013-02-13 15:04:58 +00:00
|
|
|
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');
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
</script>
|
2013-02-16 15:02:26 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
- Linting (HTML): Use double-quotes for attributes, remove redundant `type=text/css`,
indent/lbs, consistent non-use of HTML namespace, consistent indents, consistent charset
casing
- Linting (Markdown): Add `.remarkrc`, use proper hierarchical headings, use consistent
heading format, trailing spaces
- `composer.json`: consistent property spacing
- License: Add `.txt` extension, update copyright date, and reflect type (MIT) in file name
- Credits: Add self
- npm: Add `package.json` (version 3.0.0-alpha.1 for npm release only; just reserving name)
2018-05-13 01:58:13 +00:00
|
|
|
<h1 id="qunit-header">Unit Tests for sanitize.js</h1>
|
|
|
|
<h2 id="qunit-banner"></h2>
|
|
|
|
<h2 id="qunit-userAgent"></h2>
|
|
|
|
<ol id="qunit-tests"></ol>
|
|
|
|
<div id="anchor" style="visibility:hidden"></div>
|
2013-02-16 15:02:26 +00:00
|
|
|
</body>
|
2013-02-13 15:04:58 +00:00
|
|
|
</html>
|