Skip to content

Commit f957dbc

Browse files
test: add React compatibility matrix (#563)
1 parent 5ceace9 commit f957dbc

6 files changed

Lines changed: 104 additions & 10 deletions

File tree

.changeset/clean-radios-fail.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cloudflare/kumo": patch
3+
---
4+
5+
Add React 18 and React 19 compatibility checks for Kumo tests.

.github/workflows/preview.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ jobs:
4040
});
4141
4242
if (prs.length === 0) {
43-
core.setFailed(`No open PR found for branch ${branch}`);
43+
core.warning(`No open PR found for branch ${branch}; skipping PR-scoped preview steps.`);
44+
core.setOutput('pr_number', '');
45+
core.setOutput('is_fork', '');
4446
return;
4547
}
4648

.github/workflows/pullrequest.yml

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@ on:
55
paths-ignore:
66
- "*.md"
77
- ".changeset/**"
8-
# Also trigger on push to PR branches (for bots that push via API)
9-
push:
10-
branches:
11-
- "opencode/**"
12-
paths-ignore:
13-
- "*.md"
14-
- ".changeset/**"
158

169
permissions:
1710
contents: read
@@ -107,3 +100,45 @@ jobs:
107100
name: kumo-ai
108101
path: packages/kumo/ai
109102
- run: pnpm --filter @cloudflare/kumo test
103+
104+
test-react-compatibility:
105+
needs: build
106+
timeout-minutes: 5
107+
runs-on: ubuntu-latest
108+
strategy:
109+
fail-fast: false
110+
matrix:
111+
include:
112+
- react-version: "18.3.1"
113+
types-react-version: "18.3.12"
114+
types-react-dom-version: "18.3.1"
115+
- react-version: "19.2.0"
116+
types-react-version: "19.2.4"
117+
types-react-dom-version: "19.2.3"
118+
steps:
119+
- uses: actions/checkout@v4
120+
with:
121+
fetch-depth: 1
122+
- uses: ./.github/actions/install-dependencies
123+
- name: Install React ${{ matrix.react-version }} test dependencies
124+
run: |
125+
pnpm pkg set \
126+
"pnpm.overrides.react=${{ matrix.react-version }}" \
127+
"pnpm.overrides.react-dom=${{ matrix.react-version }}" \
128+
"pnpm.overrides.@types/react=${{ matrix.types-react-version }}" \
129+
"pnpm.overrides.@types/react-dom=${{ matrix.types-react-dom-version }}"
130+
pnpm install --no-frozen-lockfile --ignore-scripts --filter "@cloudflare/kumo..."
131+
- uses: actions/download-artifact@v4
132+
with:
133+
name: kumo-dist
134+
path: packages/kumo/dist
135+
- uses: actions/download-artifact@v4
136+
with:
137+
name: kumo-ai
138+
path: packages/kumo/ai
139+
- name: Verify React test versions
140+
run: |
141+
pnpm --filter @cloudflare/kumo exec node -e "if (require('react/package.json').version !== '${{ matrix.react-version }}') process.exit(1)"
142+
pnpm --filter @cloudflare/kumo exec node -e "if (require('react-dom/package.json').version !== '${{ matrix.react-version }}') process.exit(1)"
143+
- run: pnpm --filter @cloudflare/kumo typecheck
144+
- run: pnpm --filter @cloudflare/kumo test

packages/kumo/src/components/sidebar/sidebar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,7 +1736,7 @@ const SidebarCollapsibleContent = forwardRef<
17361736
id={contentId}
17371737
role="region"
17381738
aria-hidden={!isOpen}
1739-
inert={!isOpen ? true : undefined}
1739+
inert={!isOpen ? ("true" as unknown as boolean) : undefined}
17401740
data-open={isOpen || undefined}
17411741
className={cn(
17421742
"grid",
@@ -1886,7 +1886,7 @@ const SidebarSlidingView = forwardRef<HTMLDivElement, SidebarSlidingViewProps>(
18861886
data-sidebar="sliding-view"
18871887
data-value={value}
18881888
aria-hidden={!isActive}
1889-
inert={!isActive ? true : undefined}
1889+
inert={!isActive ? ("true" as unknown as boolean) : undefined}
18901890
className={cn(
18911891
"flex w-full shrink-0 flex-col min-h-0",
18921892
!isActive && "pointer-events-none",
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { render, screen } from "@testing-library/react";
2+
import { describe, expect, it } from "vitest";
3+
import { Autocomplete } from "./components/autocomplete";
4+
import { Combobox } from "./components/combobox";
5+
6+
const countries = ["Argentina", "Brazil", "Canada"];
7+
const fruits = ["Apple", "Banana", "Cherry"];
8+
9+
describe("React compatibility", () => {
10+
it("renders Autocomplete and Combobox context providers with React 18-compatible syntax", () => {
11+
render(
12+
<>
13+
<Autocomplete items={countries} label="Country" error="Required">
14+
<Autocomplete.InputGroup placeholder="Search countries..." />
15+
<Autocomplete.Content>
16+
<Autocomplete.List>
17+
{(item: string) => (
18+
<Autocomplete.Item key={item} value={item}>
19+
{item}
20+
</Autocomplete.Item>
21+
)}
22+
</Autocomplete.List>
23+
</Autocomplete.Content>
24+
</Autocomplete>
25+
<Combobox items={fruits} label="Fruit" error="Required">
26+
<Combobox.TriggerInput placeholder="Pick a fruit..." />
27+
<Combobox.Content>
28+
<Combobox.List>
29+
{(item: string) => (
30+
<Combobox.Item key={item} value={item}>
31+
{item}
32+
</Combobox.Item>
33+
)}
34+
</Combobox.List>
35+
</Combobox.Content>
36+
</Combobox>
37+
</>,
38+
);
39+
40+
expect(screen.getByText("Country")).toBeTruthy();
41+
expect(screen.getByPlaceholderText("Search countries...")).toBeTruthy();
42+
expect(screen.getByText("Fruit")).toBeTruthy();
43+
expect(screen.getByPlaceholderText("Pick a fruit...")).toBeTruthy();
44+
});
45+
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import "react";
2+
3+
declare module "react" {
4+
interface HTMLAttributes<T> {
5+
inert?: boolean | undefined;
6+
}
7+
}

0 commit comments

Comments
 (0)