feat: Support Links in Exported SVG (#4791)

This commit is contained in:
Jesse Jurman 2022-02-25 15:42:10 -05:00 committed by GitHub
parent bd35b682fa
commit 46e43baad1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 7 deletions

View file

@ -37,3 +37,8 @@ export const diamondFixture: ExcalidrawElement = {
...elementBase,
type: "diamond",
};
export const rectangleWithLinkFixture: ExcalidrawElement = {
...elementBase,
type: "rectangle",
link: "excalidraw.com",
};

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,10 @@
import { NonDeletedExcalidrawElement } from "../../element/types";
import * as exportUtils from "../../scene/export";
import { diamondFixture, ellipseFixture } from "../fixtures/elementFixture";
import {
diamondFixture,
ellipseFixture,
rectangleWithLinkFixture,
} from "../fixtures/elementFixture";
describe("exportToSvg", () => {
const ELEMENT_HEIGHT = 100;
@ -112,4 +116,13 @@ describe("exportToSvg", () => {
);
expect(svgElement.innerHTML).toMatchSnapshot();
});
it("with elements that have a link", async () => {
const svgElement = await exportUtils.exportToSvg(
[rectangleWithLinkFixture],
DEFAULT_OPTIONS,
null,
);
expect(svgElement.innerHTML).toMatchSnapshot();
});
});