1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

[CL-18] toast component and service (#6490)

Update toast styles and new service to CL.
This commit is contained in:
Will Martin
2024-04-18 13:23:35 -04:00
committed by GitHub
parent 9277465951
commit d5f503a0d6
32 changed files with 440 additions and 534 deletions

View File

@@ -0,0 +1,16 @@
import { calculateToastTimeout } from "./utils";
describe("Toast default timer", () => {
it("should have a minimum of 5000ms", () => {
expect(calculateToastTimeout("")).toBe(5000);
expect(calculateToastTimeout([""])).toBe(5000);
expect(calculateToastTimeout(" ")).toBe(5000);
});
it("should return an extra second for each 120 words", () => {
expect(calculateToastTimeout("foo ".repeat(119))).toBe(5000);
expect(calculateToastTimeout("foo ".repeat(120))).toBe(6000);
expect(calculateToastTimeout("foo ".repeat(240))).toBe(7000);
expect(calculateToastTimeout(["foo ".repeat(120), " \n foo ".repeat(120)])).toBe(7000);
});
});