Skip to content

Commit 4b4259b

Browse files
authored
Fix parsing xml entities (#1371)
Ref https://github.com/svg/sax/releases/tag/v0.1.1 This fixes enother case in [regression tests](#1357).
1 parent c1d5f0f commit 4b4259b

File tree

6 files changed

+38
-40
lines changed

6 files changed

+38
-40
lines changed

package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
]
9090
},
9191
"dependencies": {
92-
"@trysound/sax": "0.1.0",
92+
"@trysound/sax": "0.1.1",
9393
"chalk": "^4.1.0",
9494
"commander": "^7.1.0",
9595
"css-select": "^3.1.2",

test/svg2js/_index.js

-28
Original file line numberDiff line numberDiff line change
@@ -457,32 +457,4 @@ describe('svg2js', function() {
457457
});
458458

459459
});
460-
461-
describe('entities', function() {
462-
var filepath = PATH.resolve(__dirname, './test.entities.svg'),
463-
root;
464-
465-
before(function(done) {
466-
FS.readFile(filepath, 'utf8', function(err, data) {
467-
if (err) throw err;
468-
469-
root = SVG2JS(data);
470-
done();
471-
});
472-
});
473-
474-
describe('root', function() {
475-
it('should exist', function() {
476-
expect(root).to.exist;
477-
});
478-
479-
it('should have correctly parsed entities', function() {
480-
var attrs = root.content[root.content.length - 1].attrs;
481-
482-
expect(attrs['xmlns:x'].value).to.be.equal('http://ns.adobe.com/Extensibility/1.0/');
483-
expect(attrs['xmlns:graph'].value).to.be.equal('http://ns.adobe.com/Graphs/1.0/');
484-
});
485-
});
486-
});
487-
488460
});

test/svg2js/test.entities.svg

-8
This file was deleted.

test/svgo/_index.js

+5
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,9 @@ describe('svgo', () => {
6666
const result = optimize(original, { input: 'file', path: 'input.svg', js2svg: { pretty: true } });
6767
expect(normalize(result.data)).to.equal(expected);
6868
});
69+
it('should inline entities', async () => {
70+
const [original, expected] = await parseFixture('entities.svg');
71+
const result = optimize(original, { path: 'input.svg', plugins: [], js2svg: { pretty: true } });
72+
expect(normalize(result.data)).to.equal(expected);
73+
});
6974
});

test/svgo/entities.svg

+29
Loading

0 commit comments

Comments
 (0)