feat(disciplinas): la tarjeta y su hebra pasan a ser la misma cosa
El dibujo de convergencia llevaba desde el principio al lado de las tres tarjetas sin relación con ellas: tres objetos sueltos en una página. Al señalar una disciplina, su hebra se enciende en dorado y engorda, y las otras dos se apagan al 35%. Es mejora solo con puntero, y a propósito: no esconde nada. Las tres tarjetas y las tres hebras están completas sin tocar el ratón, así que quien no lo tenga no pierde nada. Verificado en navegador, no solo en jsdom: al señalar «Digital» la hebra central queda en rgb(196,148,46) —el dorado de marca— a 3,5px, y las otras en rgba(170,170,170,0.35) a 2px. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7af36e2a93
commit
9a8534f10b
4 files changed
+81
-8
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { render, screen, fireEvent } from '@testing-library/react';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { Disciplinas } from '../Disciplinas';
|
||||
|
||||
@@ -16,4 +16,26 @@ describe('<Disciplinas />', () => {
|
||||
const items = list?.querySelectorAll('li');
|
||||
expect(items?.length).toBe(3);
|
||||
});
|
||||
});
|
||||
|
||||
it('lights the strand of the discipline being pointed at', () => {
|
||||
const { container } = render(<Disciplinas />);
|
||||
const tarjetas = container.querySelectorAll('ul > li');
|
||||
expect(tarjetas).toHaveLength(3);
|
||||
|
||||
// Before anything is pointed at, the drawing is neutral.
|
||||
const hebrasDoradas = () =>
|
||||
Array.from(container.querySelectorAll('[data-hebra]')).filter((h) =>
|
||||
(h.getAttribute('class') ?? '').includes('text-dorado'),
|
||||
);
|
||||
expect(hebrasDoradas()).toHaveLength(0);
|
||||
|
||||
// Pointing at "Digital", the second card, has to light the second strand
|
||||
// and nothing else. This wiring is the whole change: without it the three
|
||||
// cards and the drawing beside them are unrelated objects on a page.
|
||||
fireEvent.pointerEnter(tarjetas[1]);
|
||||
expect(hebrasDoradas().map((h) => h.getAttribute('data-hebra'))).toEqual(['1']);
|
||||
|
||||
fireEvent.pointerLeave(tarjetas[1]);
|
||||
expect(hebrasDoradas()).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user