import React from 'react'; import { describe, it, expect, vi } from 'vitest'; import { render, fireEvent } from '@testing-library/react'; import { PixelTextLink } from '../../data/PixelTextLink'; describe('PixelTextLink — anchor mode (href)', () => { it('renders an with the given href and children', () => { const { container } = render( Read the docs, ); const a = container.querySelector('a'); expect(a).not.toBeNull(); expect(a!.getAttribute('href')).toBe('/docs'); expect(a!.textContent).toBe('Read the docs'); expect(container.querySelector('button')).toBeNull(); }); it('forwards anchor attributes (target, rel)', () => { const { container } = render( x , ); const a = container.querySelector('a')!; expect(a.getAttribute('target')).toBe('_blank'); expect(a.getAttribute('rel')).toBe('noopener'); }); }); describe('PixelTextLink — button mode (no href)', () => { it('renders a