feat(FN-863): tokenize create-row input and select styling in Agents View
- Add tokenized input styling to AgentListModal create-row with themed placeholder and chip-like tokens - Add custom select dropdown styling to AgentsView with color-matched appearance - Add comprehensive tests for both AgentListModal and AgentsView token/select behavior - Update Agents View README with tokenized input/select styling documentation
This commit is contained in:
@@ -570,6 +570,42 @@ export function AgentListModal({ isOpen, onClose, addToast, projectId }: AgentLi
|
||||
|
||||
.agent-create-form .input {
|
||||
flex: 1;
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 6px 10px;
|
||||
font-size: 13px;
|
||||
font-family: var(--font-primary);
|
||||
outline: none;
|
||||
transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
|
||||
}
|
||||
|
||||
.agent-create-form .input:focus {
|
||||
border-color: var(--todo);
|
||||
box-shadow: var(--focus-ring);
|
||||
}
|
||||
|
||||
.agent-create-form .input::placeholder {
|
||||
color: var(--text-dim);
|
||||
}
|
||||
|
||||
.agent-create-form .select {
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 6px 10px;
|
||||
font-size: 13px;
|
||||
font-family: var(--font-primary);
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
|
||||
}
|
||||
|
||||
.agent-create-form .select:focus {
|
||||
border-color: var(--todo);
|
||||
box-shadow: var(--focus-ring);
|
||||
}
|
||||
|
||||
.agent-list {
|
||||
|
||||
@@ -617,6 +617,42 @@ export function AgentsView({ addToast, projectId }: AgentsViewProps) {
|
||||
|
||||
.agent-create-form .input {
|
||||
flex: 1;
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 6px 10px;
|
||||
font-size: 13px;
|
||||
font-family: var(--font-primary);
|
||||
outline: none;
|
||||
transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
|
||||
}
|
||||
|
||||
.agent-create-form .input:focus {
|
||||
border-color: var(--todo);
|
||||
box-shadow: var(--focus-ring);
|
||||
}
|
||||
|
||||
.agent-create-form .input::placeholder {
|
||||
color: var(--text-dim);
|
||||
}
|
||||
|
||||
.agent-create-form .select {
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 6px 10px;
|
||||
font-size: 13px;
|
||||
font-family: var(--font-primary);
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
|
||||
}
|
||||
|
||||
.agent-create-form .select:focus {
|
||||
border-color: var(--todo);
|
||||
box-shadow: var(--focus-ring);
|
||||
}
|
||||
|
||||
.agent-list {
|
||||
|
||||
@@ -789,6 +789,52 @@ describe("AgentListModal", () => {
|
||||
expect(foundCreateFormRule).toBe(true);
|
||||
});
|
||||
|
||||
it("create form input and select use theme tokens", async () => {
|
||||
render(
|
||||
<AgentListModal
|
||||
isOpen={true}
|
||||
onClose={mockOnClose}
|
||||
addToast={mockAddToast}
|
||||
/>
|
||||
);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText("New Agent")).toBeTruthy();
|
||||
});
|
||||
|
||||
fireEvent.click(screen.getByText("New Agent"));
|
||||
|
||||
const styleElements = document.querySelectorAll("style");
|
||||
let foundInputRule = false;
|
||||
let foundSelectRule = false;
|
||||
styleElements.forEach(styleEl => {
|
||||
const css = styleEl.textContent ?? "";
|
||||
if (css.includes(".agent-create-form .input")) {
|
||||
foundInputRule = true;
|
||||
// Assert theme token usage
|
||||
expect(css).toContain("var(--surface)");
|
||||
expect(css).toContain("var(--text)");
|
||||
expect(css).toContain("var(--border)");
|
||||
expect(css).toContain("var(--radius-sm)");
|
||||
// Focus ring token
|
||||
expect(css).toContain("var(--focus-ring)");
|
||||
// Guard against hardcoded light-only styles
|
||||
expect(css).not.toMatch(/background:\s*#fff/);
|
||||
expect(css).not.toMatch(/background:\s*white/);
|
||||
}
|
||||
if (css.includes(".agent-create-form .select")) {
|
||||
foundSelectRule = true;
|
||||
expect(css).toContain("var(--surface)");
|
||||
expect(css).toContain("var(--text)");
|
||||
expect(css).toContain("var(--border)");
|
||||
expect(css).toContain("var(--radius-sm)");
|
||||
expect(css).toContain("var(--focus-ring)");
|
||||
}
|
||||
});
|
||||
expect(foundInputRule).toBe(true);
|
||||
expect(foundSelectRule).toBe(true);
|
||||
});
|
||||
|
||||
it("renders filter with styled container matching AgentsView", async () => {
|
||||
render(
|
||||
<AgentListModal
|
||||
|
||||
@@ -376,6 +376,46 @@ describe("AgentsView", () => {
|
||||
});
|
||||
expect(foundCreateFormRule).toBe(true);
|
||||
});
|
||||
|
||||
it("create form input and select use theme tokens", async () => {
|
||||
render(<AgentsView addToast={mockAddToast} />);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText("New Agent")).toBeTruthy();
|
||||
});
|
||||
|
||||
fireEvent.click(screen.getByText("New Agent"));
|
||||
|
||||
const styleElements = document.querySelectorAll("style");
|
||||
let foundInputRule = false;
|
||||
let foundSelectRule = false;
|
||||
styleElements.forEach(styleEl => {
|
||||
const css = styleEl.textContent ?? "";
|
||||
if (css.includes(".agent-create-form .input")) {
|
||||
foundInputRule = true;
|
||||
// Assert theme token usage
|
||||
expect(css).toContain("var(--surface)");
|
||||
expect(css).toContain("var(--text)");
|
||||
expect(css).toContain("var(--border)");
|
||||
expect(css).toContain("var(--radius-sm)");
|
||||
// Focus ring token
|
||||
expect(css).toContain("var(--focus-ring)");
|
||||
// Guard against hardcoded light-only styles
|
||||
expect(css).not.toMatch(/background:\s*#fff/);
|
||||
expect(css).not.toMatch(/background:\s*white/);
|
||||
}
|
||||
if (css.includes(".agent-create-form .select")) {
|
||||
foundSelectRule = true;
|
||||
expect(css).toContain("var(--surface)");
|
||||
expect(css).toContain("var(--text)");
|
||||
expect(css).toContain("var(--border)");
|
||||
expect(css).toContain("var(--radius-sm)");
|
||||
expect(css).toContain("var(--focus-ring)");
|
||||
}
|
||||
});
|
||||
expect(foundInputRule).toBe(true);
|
||||
expect(foundSelectRule).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("change agent state", () => {
|
||||
|
||||
Reference in New Issue
Block a user