MCPcopy Create free account
hub / github.com/dailydotdev/apps / attach

Function attach

packages/shared/src/hooks/useFittedLineClamp.spec.ts:43–57  ·  view source on GitHub ↗
(
  result: { current: ReturnType<typeof useFittedLineClamp> },
  room: number,
)

Source from the content-addressed store, hash-verified

41
42/** A container whose floor sits `room` pixels below where the text starts. */
43const attach = (
44 result: { current: ReturnType<typeof useFittedLineClamp> },
45 room: number,
46) => {
47 const container = document.createElement('div');
48 const text = document.createElement('p');
49
50 container.getBoundingClientRect = () => ({ bottom: room }) as DOMRect;
51 text.getBoundingClientRect = () => ({ top: 0 }) as DOMRect;
52
53 act(() => {
54 result.current.containerRef(container);
55 result.current.textRef(text);
56 });
57};
58
59describe('useFittedLineClamp', () => {
60 it('clamps to the whole lines that fit', () => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected