Skip to content

Commit

Permalink
fix: πŸ› revert useMeasure defaults to zeros
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed May 16, 2020
1 parent d06688b commit dc92b64
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions src/useMeasure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ export type UseMeasureRef = (element: HTMLElement) => void;
export type UseMeasureResult = [UseMeasureRef, UseMeasureRect];

const defaultState: UseMeasureRect = {
x: -1,
y: -1,
width: -1,
height: -1,
top: -1,
left: -1,
bottom: -1,
right: -1,
x: 0,
y: 0,
width: 0,
height: 0,
top: 0,
left: 0,
bottom: 0,
right: 0,
};

const useMeasure = (): UseMeasureResult => {
Expand Down
12 changes: 6 additions & 6 deletions tests/useMeasure.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ it('by default, state defaults every value to -1', () => {
});

expect(result.current[1]).toMatchObject({
width: -1,
height: -1,
top: -1,
bottom: -1,
left: -1,
right: -1,
width: 0,
height: 0,
top: 0,
bottom: 0,
left: 0,
right: 0,
});
});

Expand Down

0 comments on commit dc92b64

Please sign in to comment.