Skip to content
Merged
Show file tree
Hide file tree
Changes from 82 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
df5c390
Vitest 4 beta
amanmahajan7 Sep 18, 2025
4367042
Use SHA
amanmahajan7 Sep 18, 2025
e3347c6
Set up workflow
amanmahajan7 Sep 18, 2025
1d01ddb
first test
amanmahajan7 Sep 18, 2025
1218425
run workflow on lael
amanmahajan7 Sep 18, 2025
e0688c3
format
amanmahajan7 Sep 18, 2025
9fca410
Tweak
amanmahajan7 Sep 18, 2025
afffbe0
manually run workflow
amanmahajan7 Sep 18, 2025
773004e
typo
amanmahajan7 Sep 18, 2025
6ab6ebe
main
amanmahajan7 Sep 18, 2025
0531846
Tweak
amanmahajan7 Sep 18, 2025
62c235e
fix syntax
amanmahajan7 Sep 18, 2025
d217ea3
revert
amanmahajan7 Sep 18, 2025
33f872a
Fix step
amanmahajan7 Sep 18, 2025
9c5d6bf
Update command
amanmahajan7 Sep 18, 2025
7a66594
Do we need this command?
amanmahajan7 Sep 18, 2025
12c4b02
Revert "Do we need this command?"
amanmahajan7 Sep 18, 2025
86503b5
Does this remove label?
amanmahajan7 Sep 18, 2025
70d07b6
set env
amanmahajan7 Sep 18, 2025
0b9b888
try `actions-ecosystem/action-remove-labels`
amanmahajan7 Sep 18, 2025
e88f639
New approach
amanmahajan7 Sep 18, 2025
91c7a38
Does this work
amanmahajan7 Sep 18, 2025
3071496
Update visual regression screenshots
github-actions[bot] Sep 18, 2025
eb73e09
Does this work?
amanmahajan7 Sep 18, 2025
b860495
Try this
amanmahajan7 Sep 18, 2025
08ef1a4
Update visual regression screenshots
github-actions[bot] Sep 18, 2025
0a4e368
Simplify
amanmahajan7 Sep 18, 2025
8fbd3a3
remove name
amanmahajan7 Sep 18, 2025
9bb9984
Update visual regression screenshots
github-actions[bot] Sep 18, 2025
202e746
Tweaks
amanmahajan7 Sep 19, 2025
67c23eb
Fix permissions
amanmahajan7 Sep 19, 2025
3b6ecdf
Tweak
amanmahajan7 Sep 19, 2025
39dfc89
test
amanmahajan7 Sep 19, 2025
1e9a750
Does this work?
amanmahajan7 Sep 19, 2025
83d4230
Update screenshots
github-actions[bot] Sep 19, 2025
8144e00
Tweaks
amanmahajan7 Sep 19, 2025
b8254ea
Tweak coverage
amanmahajan7 Sep 19, 2025
32a7cbf
Tweak coverage
amanmahajan7 Sep 19, 2025
47b1c4f
Does this work?
amanmahajan7 Sep 19, 2025
132eb2e
Does this work?
amanmahajan7 Sep 19, 2025
f45f755
Does this work?
amanmahajan7 Sep 19, 2025
c9b6a14
Does this work?
amanmahajan7 Sep 19, 2025
a456f36
Fix watch
amanmahajan7 Sep 19, 2025
e104bbc
different coverage directories?
amanmahajan7 Sep 19, 2025
26dc08e
Fix typo
amanmahajan7 Sep 19, 2025
7facedb
Another
amanmahajan7 Sep 19, 2025
60f448c
`beta.12`
amanmahajan7 Sep 22, 2025
9c1ebf8
Merge branch 'main' into vrt
amanmahajan7 Sep 22, 2025
4bd9d3f
Run VRT in FF also
amanmahajan7 Sep 22, 2025
e7de47c
install ff
amanmahajan7 Sep 22, 2025
0a7a151
Update screenshots
github-actions[bot] Sep 22, 2025
8972aa5
Fix tests
amanmahajan7 Sep 22, 2025
a87e448
Merge branch 'main' into vrt
amanmahajan7 Sep 23, 2025
7340b7c
Merge branch 'main' into vrt
amanmahajan7 Sep 29, 2025
a1172f3
update package
amanmahajan7 Sep 29, 2025
a4ebf1b
update test
amanmahajan7 Sep 30, 2025
afd10a5
Update screenshots
github-actions[bot] Sep 30, 2025
b22cc3b
add formatter
amanmahajan7 Sep 30, 2025
7ca14b7
Update screenshots
github-actions[bot] Sep 30, 2025
d2596fa
Merge branch 'main' into vrt
amanmahajan7 Oct 1, 2025
62117a9
pin
amanmahajan7 Oct 1, 2025
a86257b
Still need this :(
amanmahajan7 Oct 1, 2025
459fd2f
unpin
amanmahajan7 Oct 1, 2025
795f082
Update deps
amanmahajan7 Oct 1, 2025
3b2c0ff
Import from `vitest/browser`
amanmahajan7 Oct 1, 2025
721c6e3
update deps
amanmahajan7 Oct 3, 2025
20b66fc
Merge branch 'main' into vrt
amanmahajan7 Oct 3, 2025
86711bc
Merge branch 'main' into vrt
amanmahajan7 Oct 22, 2025
226ec0f
Add back clsx
amanmahajan7 Oct 22, 2025
2454377
Fix biome/eslint
amanmahajan7 Oct 22, 2025
ba61ce3
update deps
amanmahajan7 Oct 22, 2025
6c1d0d7
Use async render
amanmahajan7 Oct 22, 2025
d9cefb3
Move async
amanmahajan7 Oct 22, 2025
39359ff
Fix eslint
amanmahajan7 Oct 22, 2025
b36f0d2
Enable tracing
amanmahajan7 Oct 23, 2025
12a1a97
Remove VRT changes
amanmahajan7 Oct 23, 2025
3eb58c5
Revert .gitignore changes
amanmahajan7 Oct 23, 2025
ab7beb5
Fix types
amanmahajan7 Oct 23, 2025
27a299d
fix 2 tests
amanmahajan7 Oct 23, 2025
4a84737
set scale
amanmahajan7 Oct 23, 2025
6c8f8ac
Fix tests for now
amanmahajan7 Oct 23, 2025
7f34ae8
Revert commands
amanmahajan7 Oct 23, 2025
c1becfe
typo
amanmahajan7 Oct 23, 2025
ae4d5be
Update tsconfig.test.json
amanmahajan7 Oct 23, 2025
41445b1
Update package.json
amanmahajan7 Oct 23, 2025
623bf3c
Revert "Update package.json"
amanmahajan7 Oct 24, 2025
27b2e67
remove @vitest/browser
nstepien Oct 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ __screenshots__
npm-debug.log
**.orig
.idea
.vitest-attachments

__traces__
Comment on lines +12 to +14
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do each one contain?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,8 @@ function MyGrid() {
return <DataGrid aria-label="my-grid" columns={columns} rows={rows} />;
}

test('grid', () => {
render(<MyGrid />);
test('grid', async () => {
await render(<MyGrid />);
const grid = screen.getByRole('grid', { name: 'my-grid' });
});
```
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@
"@typescript-eslint/eslint-plugin": "^8.39.1",
"@typescript-eslint/parser": "^8.39.1",
"@vitejs/plugin-react": "5.0.2",
"@vitest/browser": "^3.2.4",
"@vitest/coverage-istanbul": "^3.2.4",
"@vitest/browser": "^4.0.1",
"@vitest/browser-playwright": "^4.0.1",
"@vitest/coverage-istanbul": "^4.0.1",
"@vitest/eslint-plugin": "^1.3.4",
"@wyw-in-js/rollup": "^0.7.0",
"@wyw-in-js/vite": "^0.7.0",
Expand All @@ -78,7 +79,7 @@
"eslint-plugin-testing-library": "^7.10.0",
"jspdf": "^3.0.1",
"jspdf-autotable": "^5.0.2",
"playwright": "^1.54.2",
"playwright": "^1.56.1",
"postcss": "^8.5.2",
"prettier": "3.6.2",
"react": "^19.2.0",
Expand All @@ -87,8 +88,8 @@
"rolldown-plugin-dts": "^0.16.1",
"typescript": "~5.9.2",
"vite": "npm:rolldown-vite@^7.1.3",
"vitest": "^3.2.4",
"vitest-browser-react": "^1.0.1"
"vitest": "^4.0.1",
"vitest-browser-react": "^2.0.0"
},
"peerDependencies": {
"react": "^19.2",
Expand Down
4 changes: 2 additions & 2 deletions test/browser/TextEditor.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react';
import { page, userEvent } from '@vitest/browser/context';
import { page, userEvent } from 'vitest/browser';

import { DataGrid, textEditor } from '../../src';
import type { Column } from '../../src';
Expand Down Expand Up @@ -27,7 +27,7 @@ function Test() {
}

test('TextEditor', async () => {
page.render(<Test />);
await page.render(<Test />);
const cell = page.getByRole('gridcell');
await expect.element(cell).toHaveTextContent(/^Tacitus Kilgore$/);
await userEvent.dblClick(cell);
Expand Down
34 changes: 17 additions & 17 deletions test/browser/TreeDataGrid.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react';
import { page, userEvent } from '@vitest/browser/context';
import { page, userEvent } from 'vitest/browser';

import type { Column } from '../../src';
import { SelectColumn, textEditor, TreeDataGrid } from '../../src';
Expand Down Expand Up @@ -136,7 +136,7 @@ function rowGrouper(rows: readonly Row[], columnKey: string) {
}

function setup(groupBy: string[], groupIdGetter?: (groupKey: string, parentId?: string) => string) {
page.render(<TestGrid groupBy={groupBy} groupIdGetter={groupIdGetter} />);
return page.render(<TestGrid groupBy={groupBy} groupIdGetter={groupIdGetter} />);
}

async function testHeaderCellsContent(expected: readonly string[]) {
Expand All @@ -147,27 +147,27 @@ async function testHeaderCellsContent(expected: readonly string[]) {
}

test('should not group if groupBy is empty', async () => {
setup([]);
await setup([]);
await expect.element(getTreeGrid()).toHaveAttribute('aria-rowcount', '7');
await testHeaderCellsContent(['', 'Sport', 'Country', 'Year', 'Id']);
await testRowCount(7);
});

test('should not group if column does not exist', async () => {
setup(['abc']);
await setup(['abc']);
await expect.element(getTreeGrid()).toHaveAttribute('aria-rowcount', '7');
await testRowCount(7);
});

test('should group by single column', async () => {
setup(['country']);
await setup(['country']);
await expect.element(getTreeGrid()).toHaveAttribute('aria-rowcount', '9');
await testHeaderCellsContent(['', 'Country', 'Sport', 'Year', 'Id']);
await testRowCount(5);
});

test('should group by multiple columns', async () => {
setup(['country', 'year']);
await setup(['country', 'year']);
await expect.element(getTreeGrid()).toHaveAttribute('aria-rowcount', '13');
await testHeaderCellsContent(['', 'Country', 'Year', 'Sport', 'Id']);
await testRowCount(5);
Expand All @@ -177,7 +177,7 @@ test('should use groupIdGetter when provided', async () => {
const groupIdGetter = vi.fn((groupKey: string, parentId?: string) =>
parentId !== undefined ? `${groupKey}#${parentId}` : groupKey
);
setup(['country', 'year'], groupIdGetter);
await setup(['country', 'year'], groupIdGetter);
expect(groupIdGetter).toHaveBeenCalled();
await expect.element(getTreeGrid()).toHaveAttribute('aria-rowcount', '13');
await testHeaderCellsContent(['', 'Country', 'Year', 'Sport', 'Id']);
Expand All @@ -193,20 +193,20 @@ test('should use groupIdGetter when provided', async () => {
});

test('should ignore duplicate groupBy columns', async () => {
setup(['year', 'year', 'year']);
await setup(['year', 'year', 'year']);
await expect.element(getTreeGrid()).toHaveAttribute('aria-rowcount', '10');
await testRowCount(6);
});

test('should use groupBy order while grouping', async () => {
setup(['year', 'country']);
await setup(['year', 'country']);
await expect.element(getTreeGrid()).toHaveAttribute('aria-rowcount', '14');
await testHeaderCellsContent(['', 'Year', 'Country', 'Sport', 'Id']);
await testRowCount(6);
});

test('should toggle group when group cell is clicked', async () => {
setup(['year']);
await setup(['year']);
await testRowCount(6);
const groupCell = getCell('2021');
await userEvent.click(groupCell);
Expand All @@ -216,7 +216,7 @@ test('should toggle group when group cell is clicked', async () => {
});

test('should toggle group using keyboard', async () => {
setup(['year']);
await setup(['year']);
await testRowCount(6);
const groupCell = getCell('2021');
await userEvent.click(groupCell);
Expand All @@ -231,7 +231,7 @@ test('should toggle group using keyboard', async () => {
});

test('should set aria-attributes', async () => {
setup(['year', 'country']);
await setup(['year', 'country']);

const groupRow1 = getRowByCellName('2020');
await expect.element(groupRow1).toHaveAttribute('aria-level', '1');
Expand Down Expand Up @@ -264,7 +264,7 @@ test('should set aria-attributes', async () => {
});

test('should select rows in a group', async () => {
setup(['year', 'country']);
await setup(['year', 'country']);

const headerCheckbox = getSelectAllCheckbox();
await expect.element(headerCheckbox).not.toBeChecked();
Expand Down Expand Up @@ -316,7 +316,7 @@ test('should select rows in a group', async () => {
});

test('cell navigation in a treegrid', async () => {
setup(['country', 'year']);
await setup(['country', 'year']);
await testRowCount(5);
const focusSink = page.getBySelector(`.${focusSinkClassname}`);

Expand Down Expand Up @@ -399,7 +399,7 @@ test('cell navigation in a treegrid', async () => {
});

test('copy/paste when grouping is enabled', async () => {
setup(['year']);
await setup(['year']);
await userEvent.click(getCell('2021'));
await userEvent.copy();
expect(onCellCopySpy).not.toHaveBeenCalled();
Expand Down Expand Up @@ -434,7 +434,7 @@ test('copy/paste when grouping is enabled', async () => {
});

test('update row using cell renderer', async () => {
setup(['year']);
await setup(['year']);
await userEvent.click(getCell('2021'));
await userEvent.click(getCell('USA'));
await userEvent.keyboard('{arrowright}{arrowright}');
Expand All @@ -444,7 +444,7 @@ test('update row using cell renderer', async () => {
});

test('custom renderGroupCell', async () => {
setup(['country']);
await setup(['country']);
await expect.element(getRowByCellName('USA').getByRole('gridcell').nth(4)).toHaveTextContent('1');
await expect
.element(getRowByCellName('Canada').getByRole('gridcell').nth(4))
Expand Down
8 changes: 4 additions & 4 deletions test/browser/column/cellClass.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test('cellClass is undefined', async () => {
name: 'ID'
}
];
setup({ columns, rows });
await setup({ columns, rows });
const [cell1, cell2] = getCellsNew('0', '1');
await expect.element(cell1).toHaveClass(cellClassname, { exact: true });
await expect.element(cell2).toHaveClass(cellClassname, { exact: true });
Expand All @@ -29,7 +29,7 @@ test('cellClass is a string', async () => {
cellClass: 'my-cell'
}
];
setup({ columns, rows });
await setup({ columns, rows });
const [cell1, cell2] = getCellsNew('0', '1');
await expect.element(cell1).toHaveClass(`${cellClassname} my-cell`, { exact: true });
await expect.element(cell2).toHaveClass(`${cellClassname} my-cell`, { exact: true });
Expand All @@ -43,7 +43,7 @@ test('cellClass returns a string', async () => {
cellClass: (row) => `my-cell-${row.id}`
}
];
setup({ columns, rows });
await setup({ columns, rows });
const [cell1, cell2] = getCellsNew('0', '1');
await expect.element(cell1).toHaveClass(`${cellClassname} my-cell-0`, { exact: true });
await expect.element(cell2).toHaveClass(`${cellClassname} my-cell-1`, { exact: true });
Expand All @@ -57,7 +57,7 @@ test('cellClass returns undefined', async () => {
cellClass: () => undefined
}
];
setup({ columns, rows });
await setup({ columns, rows });
const [cell1, cell2] = getCellsNew('0', '1');
await expect.element(cell1).toHaveClass(cellClassname, { exact: true });
await expect.element(cell2).toHaveClass(cellClassname, { exact: true });
Expand Down
14 changes: 7 additions & 7 deletions test/browser/column/colSpan.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { userEvent } from '@vitest/browser/context';
import { userEvent } from 'vitest/browser';

import type { Column } from '../../../src';
import { getCellsAtRowIndex, getHeaderCells, setup, validateCellPosition } from '../utils';

describe('colSpan', () => {
function setupColSpanGrid(colCount = 15) {
function setupColSpanG(colCount = 15) {
type Row = number;
const columns: Column<Row, Row>[] = [];
const rows: readonly Row[] = Array.from({ length: 10 }, (_, i) => i);
Expand Down Expand Up @@ -34,11 +34,11 @@ describe('colSpan', () => {
}
});
}
setup({ columns, rows, bottomSummaryRows: [1, 2], topSummaryRows: [1, 2] });
return setup({ columns, rows, bottomSummaryRows: [1, 2], topSummaryRows: [1, 2] });
}

it('should merges cells', () => {
setupColSpanGrid();
it('should merges cells', async () => {
await setupColSpanG();
// header
expect(getHeaderCells()).toHaveLength(13);

Expand Down Expand Up @@ -93,7 +93,7 @@ describe('colSpan', () => {
});

it('should navigate between merged cells', async () => {
setupColSpanGrid();
await setupColSpanG();
// header row
await userEvent.click(getHeaderCells()[7]);
await validateCellPosition(7, 0);
Expand Down Expand Up @@ -171,7 +171,7 @@ describe('colSpan', () => {
});

it('should scroll to the merged cell when selected', async () => {
setupColSpanGrid(30);
await setupColSpanG(30);
await userEvent.click(getCellsAtRowIndex(10)[23]); // last visible cell (1920/80)
const spy = vi.spyOn(window.HTMLElement.prototype, 'scrollIntoView');
const testScrollIntoView = () => {
Expand Down
4 changes: 2 additions & 2 deletions test/browser/column/draggable.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { userEvent } from '@vitest/browser/context';
import { userEvent } from 'vitest/browser';

import type { Column } from '../../../src';
import { getHeaderCellsNew, setup } from '../utils';
Expand Down Expand Up @@ -27,7 +27,7 @@ const columns: readonly Column<never>[] = [

test('draggable columns', async () => {
const onColumnsReorder = vi.fn();
setup({ columns, rows: [], onColumnsReorder });
await setup({ columns, rows: [], onColumnsReorder });
const [cell1, cell2, cell3, cell4] = getHeaderCellsNew('col1', 'col2', 'col3', 'col4');

await expect.element(cell1).not.toHaveAttribute('draggable');
Expand Down
4 changes: 2 additions & 2 deletions test/browser/column/frozen.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { page } from '@vitest/browser/context';
import { page } from 'vitest/browser';

import type { Column } from '../../../src';
import { cellClassname, cellFrozenClassname } from '../../../src/style/cell';
Expand Down Expand Up @@ -27,7 +27,7 @@ test('frozen column have a specific class, and are stable-sorted before non-froz
}
];

setup({ columns, rows: [] });
await setup({ columns, rows: [] });
await expect.element(page.getByRole('row')).toHaveTextContent('col1col3col2col4');
const [cell1, cell2, cell3, cell4] = getHeaderCellsNew('col1', 'col2', 'col3', 'col4');

Expand Down
6 changes: 3 additions & 3 deletions test/browser/column/grouping.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { page, userEvent } from '@vitest/browser/context';
import { page, userEvent } from 'vitest/browser';

import type { ColumnOrColumnGroup } from '../../../src';
import {
Expand Down Expand Up @@ -95,7 +95,7 @@ const columns: readonly ColumnOrColumnGroup<NonNullable<unknown>>[] = [
];

test('grouping', async () => {
setup({ columns, rows: [{}] });
await setup({ columns, rows: [{}] });

const grid = getGrid();
await expect.element(grid).toHaveAttribute('aria-colcount', '12');
Expand Down Expand Up @@ -253,7 +253,7 @@ test('grouping', async () => {
});

test('keyboard navigation', async () => {
setup({ columns, rows: [{}] }, true);
await setup({ columns, rows: [{}] }, true);

// no initial selection
await expect.element(getSelectedCell()).not.toBeInTheDocument();
Expand Down
8 changes: 4 additions & 4 deletions test/browser/column/headerCellClass.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Column, ColumnGroup } from '../../../src';
import { cellClassname } from '../../../src/style/cell';
import { getHeaderCells, setup } from '../utils';

test('headerCellClass is either nullish or a string', () => {
test('headerCellClass is either nullish or a string', async () => {
const columns: readonly Column<never>[] = [
{
key: 'id',
Expand All @@ -15,13 +15,13 @@ test('headerCellClass is either nullish or a string', () => {
}
];

setup({ columns, rows: [] });
await setup({ columns, rows: [] });
const [cell1, cell2] = getHeaderCells();
expect(cell1).toHaveClass(cellClassname, { exact: true });
expect(cell2).toHaveClass(`${cellClassname} my-header`, { exact: true });
});

test('columnGroup.headerCellClass is either nullish or a string', () => {
test('columnGroup.headerCellClass is either nullish or a string', async () => {
const columns: readonly ColumnGroup<never>[] = [
{
name: 'Group 1',
Expand All @@ -34,7 +34,7 @@ test('columnGroup.headerCellClass is either nullish or a string', () => {
}
];

setup({ columns, rows: [] });
await setup({ columns, rows: [] });
const [cell1, cell2] = getHeaderCells();
expect(cell1).toHaveClass(cellClassname, { exact: true });
expect(cell2).toHaveClass(`${cellClassname} my-header`, { exact: true });
Expand Down
4 changes: 2 additions & 2 deletions test/browser/column/key.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test('key is escaped in query selectors', () => {
}
];

expect(() => {
setup({ columns, rows: [] });
expect(async () => {
await setup({ columns, rows: [] });
}).not.toThrow();
});
2 changes: 1 addition & 1 deletion test/browser/column/name.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test('name is either a string or an element', async () => {
}
];

setup({ columns, rows: [] });
await setup({ columns, rows: [] });
const [cell1, cell2] = getHeaderCellsNew('ID', 'Fancy');
await expect.element(cell1).toBeVisible();
await expect.element(cell2).toBeVisible();
Expand Down
Loading