Files
ServerKit/frontend/tests/browser/controls.jsx
T
Juan Denis 9a8b116eda feat(ui): explain the remaining disabled buttons
Button: the disabledReason description now sits beside the button instead
of inside it, so the accessible name stays the label and the reason is only
the description. Controls test asserts both (text and icon buttons).

disabledReason added to: backup schedule Save, job progress Close, service
Settings attach domain (x2), DNS Add record, New service Connect GitHub,
shared variable groups (Create group, Add, Attach), .htaccess Convert,
deploy console prev/next match, DataTable sort direction, Cron job form,
Recipes Start, filter drawer Clear all, saved view Save, ChangeBar
Undo/Redo/Save, log viewer Refresh/Download, server Packages Uninstall,
grid Column menu (move left/right, clear filter), File manager Up, grid
Tools scope, grid view Create, OAuth Connect, DB table Next page, DB
console Export, DB import dump, Operations dock Continue, Notifications
Reset, integrity Baseline/Check, AI composer Send, Terminal journal
toolbar (remote), and the page primary action / phone header "+".
2026-11-10 20:26:35 -05:00

35 lines
2.4 KiB
React

import { createElement } from 'react';
import { createRoot } from 'react-dom/client';
import { Button } from '../../src/components/ui/button';
import { Card, CardHeader, CardContent } from '../../src/components/ui/card';
import '../../src/styles/main.scss';
window.controlEvents = { submits: 0, clicks: 0 };
const submit = (event) => { event.preventDefault(); window.controlEvents.submits += 1; };
const click = () => { window.controlEvents.clicks += 1; };
export const NativeButton = (props) => createElement('button', props);
createRoot(document.getElementById('root')).render(
<>
<form onSubmit={submit}>
<NativeButton id="native-submit" className="btn btn-primary">Submit</NativeButton>
<Button id="shared-submit" variant="primary" className="btn btn-primary">Submit</Button>
<NativeButton id="native-custom" type="button" className="shell-panel__action">Action</NativeButton>
<Button id="shared-custom" type="button" variant="unstyled" className="shell-panel__action"
ref={(node) => { window.controlRef = node; }} onClick={click}>Action</Button>
<NativeButton id="native-disabled" type="button" className="btn btn-secondary" disabled>Disabled</NativeButton>
<Button id="shared-disabled" type="button" variant="outline" className="btn btn-secondary" disabled onClick={click}>Disabled</Button>
<Button id="shared-reason" variant="outline" disabled disabledReason="Install it first" onClick={click}>Reasoned</Button>
<Button id="shared-reason-icon" size="icon" variant="outline" title="Go back" disabled disabledReason="Nothing to go back to" onClick={click}><span aria-hidden="true">&lt;</span></Button>
</form>
<Button asChild variant="unstyled"><a id="shared-link" href="#destination">Link</a></Button>
{createElement('div', { id: 'native-card', className: 'card' },
createElement('div', { id: 'native-header', className: 'card-header' }, 'Header'),
createElement('div', { id: 'native-content', className: 'card-body' }, 'Content'))}
<Card id="shared-card" variant="legacy" className="card">
<CardHeader id="shared-header" variant="legacy" className="card-header">Header</CardHeader>
<CardContent id="shared-content" variant="legacy" className="card-body">Content</CardContent>
</Card>
</>,
);