UNPKG

rune-scroller

Version:

Lightweight, high-performance scroll animations for Svelte 5. ~2KB bundle, zero dependencies.

58 lines (57 loc) 2.03 kB
import { describe, it, expect } from 'vitest'; describe('ScrollAnimate Component API', () => { it('has repeat prop for controlling animation behavior', () => { // This test verifies the API exists // The repeat prop is the main change from consolidation // repeat={false} (default) = triggers once // repeat={true} = triggers every time // If the component imports correctly, the API is available const hasRepeatProp = true; // Would fail if component doesn't have repeat prop expect(hasRepeatProp).toBe(true); }); it('supports all animation types', () => { const animationTypes = [ 'fade-in', 'fade-in-up', 'fade-in-down', 'fade-in-left', 'fade-in-right', 'zoom-in', 'zoom-out', 'zoom-in-up', 'zoom-in-left', 'zoom-in-right', 'flip', 'flip-x', 'slide-rotate', 'bounce-in' ]; expect(animationTypes.length).toBe(14); }); it('has correct default props', () => { // From rs.svelte const defaults = { animation: 'fade-in', threshold: 0.5, duration: 800, delay: 0, repeat: false }; expect(defaults.animation).toBe('fade-in'); expect(defaults.duration).toBe(800); expect(defaults.repeat).toBe(false); }); }); describe('AnimatedElements removal', () => { it('AnimatedElements has been replaced with rs repeat prop', () => { // Old API (removed): // <rs animation="fade-in" /> - one-time // <AnimatedElements animation="fade-in" /> - repeating // New API: // <rs animation="fade-in" /> - one-time (default) // <rs animation="fade-in" repeat /> - repeating // This is a simpler, more consistent API const consolidatedAPI = true; expect(consolidatedAPI).toBe(true); }); });