Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
with:
node-version: 25
check-latest: true
- name: Install dependencies
- name: npm install
run: npm i
- name: Biome
run: node --run biome:ci
Expand All @@ -33,8 +33,6 @@ jobs:
- name: Test
run: node --run test
timeout-minutes: 4
- name: Visual regression test
run: node --run visual
- name: Upload coverage
uses: codecov/codecov-action@v5
with:
Expand Down
57 changes: 0 additions & 57 deletions .github/workflows/update-screenshots.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/lib
/node_modules
/package-lock.json
test/browser/**/__screenshots__
__screenshots__

npm-debug.log
**.orig
Expand Down
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@
"preview": "vite preview",
"build:website": "vite build",
"build": "rolldown -c",
"test": "vitest run --project browser --project node --coverage.reportsDirectory='./coverage/test'",
"test:watch": "vitest watch --project browser --project node",
"visual": "vitest run --project visual --coverage.reportsDirectory='./coverage/visual'",
"visual:update": "vitest run --project visual --update",
"test": "vitest run",
"test:watch": "vitest watch",
"format": "biome format --write",
"check": "biome check --error-on-warnings",
"biome:ci": "biome ci --error-on-warnings",
Expand All @@ -65,7 +63,7 @@
"@types/react-dom": "^19.2.0",
"@typescript-eslint/eslint-plugin": "^8.39.1",
"@typescript-eslint/parser": "^8.39.1",
"@vitejs/plugin-react": "5.0.2",
"@vitejs/plugin-react": "5.1.0",
"@vitest/browser-playwright": "^4.0.1",
"@vitest/coverage-istanbul": "^4.0.1",
"@vitest/eslint-plugin": "^1.3.4",
Expand Down
Binary file not shown.
Binary file not shown.
54 changes: 0 additions & 54 deletions test/visual/basicGrid.test.tsx

This file was deleted.

89 changes: 89 additions & 0 deletions test/visual/treeGrid.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import { page } from 'vitest/browser';

import { SelectColumn, TreeDataGrid, type Column } from '../../src';
import { getGrid } from '../browser/utils';

interface Row {
id: number;
country: string;
year: number;
}

type SummaryRow = undefined;

const topSummaryRows: readonly SummaryRow[] = [undefined];
const bottomSummaryRows: readonly SummaryRow[] = [undefined];

const columns: readonly Column<Row, SummaryRow>[] = [
SelectColumn,
{
key: 'sport',
name: 'Sport'
},
{
key: 'country',
name: 'Country'
},
{
key: 'year',
name: 'Year'
},
{
key: 'id',
name: 'Id',
renderGroupCell({ childRows }) {
return Math.min(...childRows.map((c) => c.id));
}
}
];

const rows: readonly Row[] = [
{
id: 1,
country: 'USA',
year: 2020
},
{
id: 2,
country: 'USA',
year: 2021
},
{
id: 3,
country: 'Canada',
year: 2021
},
{
id: 4,
country: 'Canada',
year: 2022
}
];

test('tree grid', async () => {
await page.render(
<TreeDataGrid
rowKeyGetter={rowKeyGetter}
columns={columns}
rows={rows}
topSummaryRows={topSummaryRows}
bottomSummaryRows={bottomSummaryRows}
groupBy={['country', 'year']}
rowGrouper={rowGrouper}
expandedGroupIds={new Set(['USA', 2020])}
onExpandedGroupIdsChange={() => {}}
/>
);

await expect(getGrid()).toMatchScreenshot('tree-grid');
});

function rowKeyGetter(row: Row) {
return row.id;
}

function rowGrouper(rows: readonly Row[], columnKey: string) {
// @ts-expect-error
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return Object.groupBy(rows, (r) => r[columnKey]) as Record<string, readonly R[]>;
}
20 changes: 0 additions & 20 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,26 +137,6 @@ export default defineConfig(
setupFiles: ['test/setupBrowser.ts']
}
},
{
extends: true,
test: {
name: 'visual',
include: ['test/visual/*.test.*'],
browser: {
enabled: true,
provider: playwright({
contextOptions: {
viewport
}
}),
instances: [{ browser: 'chromium' }, { browser: 'firefox' }],
viewport,
headless: true,
screenshotFailures: false
},
setupFiles: ['test/setupBrowser.ts']
}
},
{
extends: true,
test: {
Expand Down