mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Add user list component + snap to user functionality (#1749)
This commit is contained in:
parent
8f65e37dac
commit
ca87ca6fe9
18 changed files with 333 additions and 32 deletions
39
src/tests/clients.test.ts
Normal file
39
src/tests/clients.test.ts
Normal file
|
@ -0,0 +1,39 @@
|
|||
import { getClientInitials } from "../clients";
|
||||
|
||||
describe("getClientInitials", () => {
|
||||
it("returns substring if one name provided", () => {
|
||||
const result = getClientInitials("Alan");
|
||||
expect(result).toBe("AL");
|
||||
});
|
||||
|
||||
it("returns initials", () => {
|
||||
const result = getClientInitials("John Doe");
|
||||
expect(result).toBe("JD");
|
||||
});
|
||||
|
||||
it("returns correct initials if many names provided", () => {
|
||||
const result = getClientInitials("John Alan Doe");
|
||||
expect(result).toBe("JD");
|
||||
});
|
||||
|
||||
it("returns single initial if 1 letter provided", () => {
|
||||
const result = getClientInitials("z");
|
||||
expect(result).toBe("Z");
|
||||
});
|
||||
|
||||
it("trims trailing whitespace", () => {
|
||||
const result = getClientInitials(" q ");
|
||||
expect(result).toBe("Q");
|
||||
});
|
||||
|
||||
it('returns "?" if falsey value provided', () => {
|
||||
let result = getClientInitials("");
|
||||
expect(result).toBe("?");
|
||||
|
||||
result = getClientInitials(undefined);
|
||||
expect(result).toBe("?");
|
||||
|
||||
result = getClientInitials(null);
|
||||
expect(result).toBe("?");
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue