1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-19 09:43:23 +00:00

[CL-573] Move all svg icons to new libs/assets (#16020)

* create libs/assets

* treeshake lib and filter out non-icons from icon story

* update docs

* fix icon colors in browser and desktop

* better name for vault icon

* move illustrations
This commit is contained in:
Vicki League
2025-08-21 12:35:59 -04:00
committed by GitHub
parent f07518084f
commit 805b6fe7aa
179 changed files with 579 additions and 525 deletions

View File

@@ -0,0 +1,38 @@
import * as IconExports from "./icon-service";
import { DynamicContentNotAllowedError, isIcon, svgIcon } from "./icon-service";
describe("Icon", () => {
it("exports should not expose Icon class", () => {
expect(Object.keys(IconExports)).not.toContain("Icon");
});
describe("isIcon", () => {
it("should return true when input is icon", () => {
const result = isIcon(svgIcon`icon`);
expect(result).toBe(true);
});
it("should return false when input is not an icon", () => {
const result = isIcon({ svg: "not an icon" });
expect(result).toBe(false);
});
});
describe("template literal", () => {
it("should throw when attempting to create dynamic icons", () => {
const dynamic = "some user input";
const f = () => svgIcon`static and ${dynamic}`;
expect(f).toThrow(DynamicContentNotAllowedError);
});
it("should return svg content when supplying icon with svg string", () => {
const icon = svgIcon`safe static content`;
expect(icon.svg).toBe("safe static content");
});
});
});