Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
import '@testing-library/jest-dom';
import { fireEvent, render, screen } from '@testing-library/react';
import { Chip } from './Chip';
describe('Chip', () => {
it('renders a theme-aware surface tone for non-status context', () => {
render(<Chip tone="surface">Context</Chip>);
expect(screen.getByText('Context').parentElement).toHaveClass(
'border-border-chrome',
'bg-surface-secondary',
'text-text-secondary',
);
});
it('renders semantic tone classes', () => {
render(<Chip tone="info">Search result</Chip>);
expect(screen.getByText('Search result').parentElement).toHaveClass(
'bg-status-info-subtle',
'text-status-info',
);
});
it('renders the merged tone as purple text on the plain surface', () => {
render(<Chip tone="merged">Merged</Chip>);
const chip = screen.getByText('Merged').parentElement;
expect(chip).toHaveClass('text-brand-purple', 'bg-transparent');
});
it('does not tint the merged tone, which would drop its dark-theme text contrast below 4.5:1', () => {
render(<Chip tone="merged">Merged</Chip>);
expect(screen.getByText('Merged').parentElement?.className).not.toMatch(/bg-brand-purple/);
});
it('stops propagation and calls the remove handler', () => {
const onRemove = jest.fn();
const onParentClick = jest.fn();
render(
<div onClick={onParentClick}>
<Chip onRemove={onRemove} removeLabel="Remove filter">
Filter
</Chip>
</div>,
);
fireEvent.click(screen.getByRole('button', { name: 'Remove filter' }));
expect(onRemove).toHaveBeenCalledTimes(1);
expect(onParentClick).not.toHaveBeenCalled();
});
it('exposes theme-owned shape and density recipes', () => {
render(
<Chip size="theme" shape="theme" onRemove={jest.fn()} removeLabel="Remove theme">
Themeable
</Chip>,
);
expect(screen.getByText('Themeable').parentElement).toHaveClass(
'h-theme-control',
'rounded-theme-control',
'gap-theme-control-gap',
'px-theme-control-x',
);
expect(screen.getByRole('button', { name: 'Remove theme' })).toHaveClass(
'rounded-theme-control-round',
);
});
});