feat(movimiento): un solo autoplay, tres pasos legibles y parallax en las fotos
ComoEmpezar deja de rotar pasos: las tres anotaciones se leen de una, sin botones ni opacidad. Mecanismo conserva su autoplay pero distingue el paso activo por borde y elevación, no apagando los demás. Las dos fotos (fondo del Mecanismo y panel del ComoEmpezar) reciben un parallax suave ligado al scroll de página. El test de autoplay que Comompezar tenía se retira: afirmaba el comportamiento que este cambio borra, y choca con el test nuevo que pide cero botones.
This commit is contained in:
1 parent
40f8f74d1d
commit
20924544d4
3 files changed
+42
-38
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { render, screen, act } from '@testing-library/react';
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ComoEmpezar } from '../ComoEmpezar';
|
||||
|
||||
describe('<ComoEmpezar />', () => {
|
||||
@@ -24,17 +24,17 @@ describe('<ComoEmpezar />', () => {
|
||||
expect(img).toHaveAttribute('alt', '');
|
||||
});
|
||||
|
||||
describe('auto-advancing step highlight', () => {
|
||||
beforeEach(() => { vi.useFakeTimers(); });
|
||||
afterEach(() => { vi.useRealTimers(); });
|
||||
it('keeps all three steps readable without interaction', () => {
|
||||
const { container } = render(<ComoEmpezar />);
|
||||
// The steps used to sit at opacity-40 until the reader hovered or the
|
||||
// autoplay reached them, which made two of every three illegible.
|
||||
expect(container.innerHTML).not.toContain('opacity-40');
|
||||
});
|
||||
|
||||
it('highlights the first step by default, then advances on its own', () => {
|
||||
render(<ComoEmpezar />);
|
||||
const first = screen.getByText('Escríbeme').closest('button');
|
||||
const second = screen.getByText('Sesión de diagnóstico').closest('button');
|
||||
expect(first).toHaveAttribute('aria-pressed', 'true');
|
||||
act(() => { vi.advanceTimersByTime(3300); });
|
||||
expect(second).toHaveAttribute('aria-pressed', 'true');
|
||||
});
|
||||
it('presents the steps as content, not as controls', () => {
|
||||
render(<ComoEmpezar />);
|
||||
// Without autoplay there is nothing to steer, so the steps stop being
|
||||
// buttons and go back to being a plain ordered list.
|
||||
expect(screen.queryAllByRole('button')).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user