prepare to import svg

This commit is contained in:
fyears
2021-12-11 22:45:21 +08:00
parent b6bae792c6
commit e6591721e2
5 changed files with 32 additions and 0 deletions
+15
View File
@@ -1,6 +1,7 @@
import * as fs from "fs";
import * as path from "path";
import { expect } from "chai";
import { JSDOM } from "jsdom";
import * as misc from "../src/misc";
@@ -133,3 +134,17 @@ describe("Misc: get dirname", () => {
expect(y).to.equal("/");
});
});
describe("Misc: extract svg", () => {
beforeEach(function () {
const fakeBrowser = new JSDOM("");
global.window = fakeBrowser.window as any;
});
it("should extract rect from svg correctly", () => {
const x = "<svg><rect/><g/></svg>";
const y = misc.extractSvgSub(x);
// console.log(x)
expect(y).to.equal("<rect/><g/>");
});
});