Skip to content

Commit e68c8c6

Browse files
Corrects tests; runs prettier.
1 parent 6378cf8 commit e68c8c6

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

src/components/Grid/Cell.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ export const Cell = memo(
5959
const cellRef = useRef<HTMLDivElement>(null);
6060

6161
useEffect(() => {
62-
if (!rowAutoHeight) {return;}
62+
if (!rowAutoHeight) {
63+
return;
64+
}
6365
if (cellRef.current) {
6466
const height = cellRef.current.getBoundingClientRect().height;
6567
updateRowHeight(rowIndex, height);

src/components/Grid/Grid.test.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,31 +120,29 @@ describe("Grid", () => {
120120
});
121121

122122
it("should set row height to default (33px) when rowAutoHeight is false", async () => {
123-
const { queryByTestId } = renderGrid({
123+
const { getByTestId } = renderGrid({
124124
rowCount: 10,
125125
columnCount: 10,
126126
rowAutoHeight: false,
127127
});
128128

129-
const cell = queryByTestId("row-cell-0-0");
130-
expect(cell).toBeDefined();
129+
const cell = getByTestId("row-cell-0-0");
131130

132-
const computedHeight = window.getComputedStyle(cell!).height;
131+
const computedHeight = window.getComputedStyle(cell).height;
133132
const heightValue = parseFloat(computedHeight);
134133
expect(heightValue).toBe(33);
135134
});
136135

137136
it("should expand row height to 100% when rowAutoHeight is true", async () => {
138-
const { queryByTestId } = renderGrid({
137+
const { getByTestId } = renderGrid({
139138
rowCount: 1,
140139
columnCount: 1,
141140
rowAutoHeight: true,
142141
});
143142

144-
const cell = queryByTestId("row-cell-0-0");
145-
expect(cell).toBeDefined();
143+
const cell = getByTestId("row-cell-0-0");
146144

147-
const computedHeight = window.getComputedStyle(cell!).height;
145+
const computedHeight = window.getComputedStyle(cell).height;
148146
expect(computedHeight).toBe("100%");
149147
});
150148
});

src/components/Grid/Grid.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ export const Grid = forwardRef<HTMLDivElement, GridProps>(
227227

228228
const updateRowHeight = useCallback(
229229
(rowIndex: number, height: number) => {
230-
if (!rowAutoHeight) {return;}
230+
if (!rowAutoHeight) {
231+
return;
232+
}
231233
const prevHeight = rowHeightsRef.current.get(rowIndex) ?? 0;
232234
if (height > prevHeight) {
233235
rowHeightsRef.current.set(rowIndex, height);

0 commit comments

Comments
 (0)