Skip to content
Draft
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
38 changes: 38 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: E2E tests

on:
push:
pull_request:

jobs:
e2e:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm

- name: Install dependencies
run: npm ci

- name: Install Playwright browsers
run: npx playwright install --with-deps chromium

- name: Run E2E tests
run: npm run test:e2e

- name: Upload Playwright report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: |
playwright-report/
test-results/
if-no-files-found: ignore
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ dist/
# generated types
.astro/

# Playwright output
test-results/
playwright-report/
blob-report/

# dependencies
node_modules/

Expand All @@ -24,4 +29,4 @@ pnpm-debug.log*
.idea/

# Local planning / scratch (not for commit)
.local/
.local/
76 changes: 73 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"build:all": "npm run build:packages && npm run build",
"release": "npx tsx scripts/release.ts",
"test:smoke": "npm run build:packages && npx tsx scripts/smoke-test.ts",
"test:e2e": "playwright test",
"test:e2e:ui": "playwright test --ui",
"cli:dev": "npm run dev -w bearnie",
"cli:build": "npm run build -w bearnie",
"cli:link": "npm link -w bearnie",
Expand All @@ -44,6 +46,8 @@
},
"devDependencies": {
"@astrojs/check": "^0.9.10",
"@axe-core/playwright": "^4.13.0",
"@playwright/test": "^1.52.0",
"@tailwindcss/vite": "^4.3.3",
"@types/fs-extra": "^11.0.4",
"@types/node": "^26.1.2",
Expand Down
17 changes: 17 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { defineConfig } from "@playwright/test";

export default defineConfig({
testDir: "./tests/e2e",
fullyParallel: true,
forbidOnly: !!process.env.CI,
reporter: "list",
use: {
baseURL: "http://127.0.0.1:4321",
trace: "on-first-retry",
},
webServer: {
command: "npm run dev -- --host 127.0.0.1 --port 4321",
url: "http://127.0.0.1:4321",
reuseExistingServer: !process.env.CI,
},
});
3 changes: 2 additions & 1 deletion public/registry/dropdown-menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"devDependencies": [],
"registryDependencies": [
"cn",
"button",
"ui-runtime-loader",
"ui-runtime-dropdown-menu"
],
Expand Down Expand Up @@ -68,7 +69,7 @@
{
"name": "DropdownMenuTrigger.astro",
"path": "dropdown-menu/DropdownMenuTrigger.astro",
"content": "---\nimport { cn } from '@/utils/cn';\nimport type { HTMLAttributes } from 'astro/types';\n\nexport interface Props extends HTMLAttributes<'span'> {}\n\nconst { class: className, ...props } = Astro.props;\n---\n\n<span\n role=\"button\"\n tabindex=\"0\"\n class={cn(\"inline-flex cursor-pointer\", className)}\n data-dropdown-trigger\n data-state=\"closed\"\n aria-expanded=\"false\"\n aria-haspopup=\"true\"\n {...props}\n>\n <slot />\n</span>\n"
"content": "---\nimport Button, { type Props as ButtonProps } from '@/components/ui/button/Button.astro';\n\nexport interface Props extends Omit<ButtonProps, 'href'> {}\n\nconst {\n type: _type,\n role: _role,\n tabindex: _tabindex,\n 'aria-expanded': _expanded,\n 'aria-controls': _controls,\n 'aria-haspopup': _haspopup,\n 'data-dropdown-trigger': _trigger,\n 'data-state': _state,\n ...props\n} = Astro.props;\n---\n\n<Button\n {...props}\n type=\"button\"\n data-dropdown-trigger\n data-state=\"closed\"\n aria-expanded=\"false\"\n aria-haspopup=\"menu\"\n>\n <slot name=\"left-icon\" slot=\"left-icon\" />\n <slot />\n <slot name=\"right-icon\" slot=\"right-icon\" />\n</Button>\n"
}
]
}
2 changes: 1 addition & 1 deletion public/registry/ui-runtime-dropdown-menu.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/generate-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ const COMPONENT_META: Record<
"dropdown-menu": {
description: "A menu that appears when triggered by a button",
category: "navigation",
registryDependencies: ["ui-runtime-loader", "ui-runtime-dropdown-menu"],
registryDependencies: ["button", "ui-runtime-loader", "ui-runtime-dropdown-menu"],
},
empty: {
description: "A placeholder for empty states",
Expand Down
1 change: 1 addition & 0 deletions src/components/assets/Logo.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const { class: className = "", ...rest } = Astro.props;
viewBox="0 0 649 649"
fill="none"
xmlns="http://www.w3.org/2000/svg"
data-testid="logo"
>
<path
fill-rule="evenodd"
Expand Down
7 changes: 5 additions & 2 deletions src/components/docs/ComponentPreview.astro
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export interface Props {
component?: string;
// Full width preview without padding/max-width (for sidebars, etc.)
fullWidth?: boolean;
// Unique ID for the component preview container
id?: string;
class?: string;
}

Expand All @@ -25,6 +27,7 @@ const {
displayCode,
component,
fullWidth = false,
id,
class: className,
} = Astro.props;

Expand Down Expand Up @@ -53,7 +56,7 @@ if (Astro.slots.has("code")) {
}

// Generate a unique ID for this preview
const id = `preview-${Math.random().toString(36).substring(2, 9)}`;
const uniqueId = `preview-${id ?? Math.random().toString(36).substring(2, 9)}`;

// Package manager commands
const packageManagers = component
Expand Down Expand Up @@ -99,7 +102,7 @@ const normalizedCode = displayCode

<div
class={cn("not-prose w-full max-w-full min-w-0", className)}
data-component-preview={id}
data-component-preview={uniqueId}
data-mode={isInstallMode ? "install" : "preview"}
>
{
Expand Down
29 changes: 18 additions & 11 deletions src/components/ui/dropdown-menu/DropdownMenuTrigger.astro
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
---
import { cn } from '@/utils/cn';
import type { HTMLAttributes } from 'astro/types';
import Button, { type Props as ButtonProps } from '@/components/ui/button/Button.astro';

export interface Props extends HTMLAttributes<'span'> {}
export interface Props extends Omit<ButtonProps, 'href'> {}

const { class: className, ...props } = Astro.props;
const {
// These attributes belong to the dropdown runtime and must not be overridden.
'aria-expanded': _expanded,
'aria-controls': _controls,
'aria-haspopup': _haspopup,
'data-dropdown-trigger': _trigger,
'data-state': _state,
...props
} = Astro.props;
---

<span
role="button"
tabindex="0"
class={cn("inline-flex cursor-pointer", className)}
<Button
{...props}
type="button"
data-dropdown-trigger
data-state="closed"
aria-expanded="false"
aria-haspopup="true"
{...props}
aria-haspopup="menu"
>
<slot name="left-icon" slot="left-icon" />
<slot />
</span>
<slot name="right-icon" slot="right-icon" />
</Button>
14 changes: 7 additions & 7 deletions src/content/components/accordion.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import Button from "@/components/ui/button/Button.astro";



<ComponentPreview>
<ComponentPreview id="single">
<Fragment slot="code">
```html
<Accordion type="single">
Expand Down Expand Up @@ -113,7 +113,7 @@ import {
Multiple items can be open simultaneously. Useful when users may need to compare content across sections.
</Prose>

<ComponentPreview>
<ComponentPreview id="multiple">
<Fragment slot="code">
```html
<Accordion type="multiple">
Expand Down Expand Up @@ -156,7 +156,7 @@ Multiple items can be open simultaneously. Useful when users may need to compare
Add icons to accordion triggers to provide visual context for each section.
</Prose>

<ComponentPreview>
<ComponentPreview id="with-icon">
<Fragment slot="code">
```html
<Accordion type="single">
Expand Down Expand Up @@ -243,7 +243,7 @@ Add a subtitle or description below the main trigger text for additional context
Use `AccordionLabel` for the main trigger text and `AccordionDescription` for the supporting text. The components also provide the appropriate accessible name and description for the trigger.
</Prose>

<ComponentPreview>
<ComponentPreview id="with-description">
<Fragment slot="code">
```html
<Accordion type="single">
Expand Down Expand Up @@ -340,7 +340,7 @@ Use `AccordionLabel` for the main trigger text and `AccordionDescription` for th
Combine icons with descriptions for a rich, informative accordion header.
</Prose>

<ComponentPreview>
<ComponentPreview id="with-icon-description">
<Fragment slot="code">
```html
<Accordion type="single">
Expand Down Expand Up @@ -455,7 +455,7 @@ Combine icons with descriptions for a rich, informative accordion header.
Accordions can be nested inside each other for hierarchical content organization.
</Prose>

<ComponentPreview>
<ComponentPreview id="nested">
<Fragment slot="code">
```html
<Accordion type="single">
Expand Down Expand Up @@ -570,7 +570,7 @@ Accordions can be nested inside each other for hierarchical content organization
Accordion content can contain any elements including lists, badges, buttons, and more.
</Prose>

<ComponentPreview>
<ComponentPreview id="rich-content">
<Fragment slot="code">
```html
<Accordion type="single">
Expand Down
Loading
Loading