prepare to import svg
This commit is contained in:
@@ -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/>");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user