@@ -3050,6 +3050,233 @@ describe("SVG draw-on rules", () => {
30503050 expect ( finding ) . toBeUndefined ( ) ;
30513051 } ) ;
30523052
3053+ it ( "gsap_repeated_fromto_without_baseline: warns for repeated future fromTo state" , async ( ) => {
3054+ const html = `
3055+ <html><body>
3056+ <style>#ring { opacity: 0; }</style>
3057+ <div data-composition-id="main" data-width="1920" data-height="1080">
3058+ <div id="ring"></div>
3059+ </div>
3060+ <script src="https://cdn.jsdelivr.net/npm/gsap@3/dist/gsap.min.js"></script>
3061+ <script>
3062+ window.__timelines = window.__timelines || {};
3063+ const tl = gsap.timeline({ paused: true });
3064+ tl.fromTo("#ring", { opacity: 0, scale: 1 }, { opacity: 1, duration: 0.5 }, 5);
3065+ tl.fromTo("#ring", { opacity: 1, scale: 0.4 }, { opacity: 0, duration: 0.5 }, 10);
3066+ window.__timelines.main = tl;
3067+ </script>
3068+ </body></html>` ;
3069+ const result = await lintHyperframeHtml ( html ) ;
3070+ const finding = result . findings . find (
3071+ ( candidate ) => candidate . code === "gsap_repeated_fromto_without_baseline" ,
3072+ ) ;
3073+
3074+ expect ( finding ?. severity ) . toBe ( "warning" ) ;
3075+ expect ( finding ?. selector ) . toBe ( "#ring" ) ;
3076+ } ) ;
3077+
3078+ it ( "gsap_repeated_fromto_without_baseline: accepts explicit immediateRender false" , async ( ) => {
3079+ const html = `
3080+ <html><body>
3081+ <div data-composition-id="main" data-width="1920" data-height="1080"><div id="ring"></div></div>
3082+ <script src="https://cdn.jsdelivr.net/npm/gsap@3/dist/gsap.min.js"></script>
3083+ <script>
3084+ window.__timelines = window.__timelines || {};
3085+ const tl = gsap.timeline({ paused: true });
3086+ tl.fromTo("#ring", { opacity: 0 }, { opacity: 1, duration: 0.5, immediateRender: false }, 5);
3087+ tl.fromTo("#ring", { opacity: 1 }, { opacity: 0, duration: 0.5, immediateRender: false }, 10);
3088+ window.__timelines.main = tl;
3089+ </script>
3090+ </body></html>` ;
3091+ const result = await lintHyperframeHtml ( html ) ;
3092+ const finding = result . findings . find (
3093+ ( candidate ) => candidate . code === "gsap_repeated_fromto_without_baseline" ,
3094+ ) ;
3095+
3096+ expect ( finding ) . toBeUndefined ( ) ;
3097+ } ) ;
3098+
3099+ it ( "gsap_repeated_fromto_without_baseline: accepts an earlier timeline set baseline" , async ( ) => {
3100+ const html = `
3101+ <html><body>
3102+ <div data-composition-id="main" data-width="1920" data-height="1080"><div id="ring"></div></div>
3103+ <script src="https://cdn.jsdelivr.net/npm/gsap@3/dist/gsap.min.js"></script>
3104+ <script>
3105+ window.__timelines = window.__timelines || {};
3106+ const tl = gsap.timeline({ paused: true });
3107+ tl.set("#ring", { opacity: 0, scale: 1 }, 0);
3108+ tl.fromTo("#ring", { opacity: 0 }, { opacity: 1, duration: 0.5 }, 5);
3109+ tl.fromTo("#ring", { opacity: 1 }, { opacity: 0, duration: 0.5 }, 10);
3110+ window.__timelines.main = tl;
3111+ </script>
3112+ </body></html>` ;
3113+ const result = await lintHyperframeHtml ( html ) ;
3114+ const finding = result . findings . find (
3115+ ( candidate ) => candidate . code === "gsap_repeated_fromto_without_baseline" ,
3116+ ) ;
3117+
3118+ expect ( finding ) . toBeUndefined ( ) ;
3119+ } ) ;
3120+
3121+ it ( "gsap_repeated_fromto_without_baseline: rejects an earlier standalone set" , async ( ) => {
3122+ const html = `
3123+ <html><body>
3124+ <div data-composition-id="main" data-width="1920" data-height="1080"><div id="ring"></div></div>
3125+ <script src="https://cdn.jsdelivr.net/npm/gsap@3/dist/gsap.min.js"></script>
3126+ <script>
3127+ window.__timelines = window.__timelines || {};
3128+ const tl = gsap.timeline({ paused: true });
3129+ gsap.set("#ring", { opacity: 0, scale: 1 });
3130+ tl.fromTo("#ring", { opacity: 0, scale: 1 }, { opacity: 1, duration: 0.5 }, 5);
3131+ tl.fromTo("#ring", { opacity: 1, scale: 0.4 }, { opacity: 0, duration: 0.5 }, 10);
3132+ window.__timelines.main = tl;
3133+ </script>
3134+ </body></html>` ;
3135+ const result = await lintHyperframeHtml ( html ) ;
3136+ const finding = result . findings . find (
3137+ ( candidate ) => candidate . code === "gsap_repeated_fromto_without_baseline" ,
3138+ ) ;
3139+
3140+ expect ( finding ?. severity ) . toBe ( "warning" ) ;
3141+ } ) ;
3142+
3143+ it ( "gsap_repeated_fromto_without_baseline: rejects a later incomplete standalone set" , async ( ) => {
3144+ const html = `
3145+ <html><body>
3146+ <div data-composition-id="main" data-width="1920" data-height="1080"><div id="ring"></div></div>
3147+ <script src="https://cdn.jsdelivr.net/npm/gsap@3/dist/gsap.min.js"></script>
3148+ <script>
3149+ window.__timelines = window.__timelines || {};
3150+ const tl = gsap.timeline({ paused: true });
3151+ tl.fromTo("#ring", { opacity: 0, scale: 1 }, { opacity: 1, duration: 0.5 }, 5);
3152+ tl.fromTo("#ring", { opacity: 1, scale: 0.4 }, { opacity: 0, duration: 0.5 }, 10);
3153+ gsap.set("#ring", { x: 0 });
3154+ window.__timelines.main = tl;
3155+ </script>
3156+ </body></html>` ;
3157+ const result = await lintHyperframeHtml ( html ) ;
3158+ const finding = result . findings . find (
3159+ ( candidate ) => candidate . code === "gsap_repeated_fromto_without_baseline" ,
3160+ ) ;
3161+
3162+ expect ( finding ?. severity ) . toBe ( "warning" ) ;
3163+ } ) ;
3164+
3165+ it ( "gsap_repeated_fromto_without_baseline: does not guess that a later standalone set is a timeline baseline" , async ( ) => {
3166+ const html = `
3167+ <html><body>
3168+ <div data-composition-id="main" data-width="1920" data-height="1080"><div id="ring"></div></div>
3169+ <script src="https://cdn.jsdelivr.net/npm/gsap@3/dist/gsap.min.js"></script>
3170+ <script>
3171+ window.__timelines = window.__timelines || {};
3172+ const tl = gsap.timeline({ paused: true });
3173+ tl.fromTo("#ring", { opacity: 0, scale: 1 }, { opacity: 1, duration: 0.5 }, 5);
3174+ tl.fromTo("#ring", { opacity: 1, scale: 0.4 }, { opacity: 0, duration: 0.5 }, 10);
3175+ gsap.set("#ring", { opacity: 0, scale: 1 });
3176+ window.__timelines.main = tl;
3177+ </script>
3178+ </body></html>` ;
3179+ const result = await lintHyperframeHtml ( html ) ;
3180+ const finding = result . findings . find (
3181+ ( candidate ) => candidate . code === "gsap_repeated_fromto_without_baseline" ,
3182+ ) ;
3183+
3184+ expect ( finding ?. severity ) . toBe ( "warning" ) ;
3185+ } ) ;
3186+
3187+ it ( "gsap_repeated_fromto_without_baseline: does not treat a deferred callback set as baseline" , async ( ) => {
3188+ const html = `
3189+ <html><body>
3190+ <div data-composition-id="main" data-width="1920" data-height="1080">
3191+ <div id="ring"></div><button id="reset"></button>
3192+ </div>
3193+ <script src="https://cdn.jsdelivr.net/npm/gsap@3/dist/gsap.min.js"></script>
3194+ <script>
3195+ window.__timelines = window.__timelines || {};
3196+ const tl = gsap.timeline({ paused: true });
3197+ document.getElementById("reset").addEventListener("click", () => {
3198+ gsap.set("#ring", { opacity: 0, scale: 1 });
3199+ });
3200+ tl.fromTo("#ring", { opacity: 0 }, { opacity: 1, duration: 0.5 }, 5);
3201+ tl.fromTo("#ring", { opacity: 1 }, { opacity: 0, duration: 0.5 }, 10);
3202+ window.__timelines.main = tl;
3203+ </script>
3204+ </body></html>` ;
3205+ const result = await lintHyperframeHtml ( html ) ;
3206+ const finding = result . findings . find (
3207+ ( candidate ) => candidate . code === "gsap_repeated_fromto_without_baseline" ,
3208+ ) ;
3209+
3210+ expect ( finding ?. severity ) . toBe ( "warning" ) ;
3211+ } ) ;
3212+
3213+ it ( "gsap_repeated_fromto_without_baseline: requires a timeline baseline to be authored first" , async ( ) => {
3214+ const html = `
3215+ <html><body>
3216+ <div data-composition-id="main" data-width="1920" data-height="1080"><div id="ring"></div></div>
3217+ <script src="https://cdn.jsdelivr.net/npm/gsap@3/dist/gsap.min.js"></script>
3218+ <script>
3219+ window.__timelines = window.__timelines || {};
3220+ const tl = gsap.timeline({ paused: true });
3221+ tl.fromTo("#ring", { opacity: 0 }, { opacity: 1, duration: 0.5 }, 5);
3222+ tl.fromTo("#ring", { opacity: 1 }, { opacity: 0, duration: 0.5 }, 10);
3223+ tl.set("#ring", { opacity: 0 }, 0);
3224+ window.__timelines.main = tl;
3225+ </script>
3226+ </body></html>` ;
3227+ const result = await lintHyperframeHtml ( html ) ;
3228+ const finding = result . findings . find (
3229+ ( candidate ) => candidate . code === "gsap_repeated_fromto_without_baseline" ,
3230+ ) ;
3231+
3232+ expect ( finding ?. severity ) . toBe ( "warning" ) ;
3233+ } ) ;
3234+
3235+ it ( "gsap_repeated_fromto_without_baseline: accepts one future fromTo writer" , async ( ) => {
3236+ const html = `
3237+ <html><body>
3238+ <div data-composition-id="main" data-width="1920" data-height="1080"><div id="ring"></div></div>
3239+ <script src="https://cdn.jsdelivr.net/npm/gsap@3/dist/gsap.min.js"></script>
3240+ <script>
3241+ window.__timelines = window.__timelines || {};
3242+ const tl = gsap.timeline({ paused: true });
3243+ tl.fromTo("#ring", { opacity: 0 }, { opacity: 1, duration: 0.5 }, 5);
3244+ window.__timelines.main = tl;
3245+ </script>
3246+ </body></html>` ;
3247+ const result = await lintHyperframeHtml ( html ) ;
3248+
3249+ expect (
3250+ result . findings . find (
3251+ ( candidate ) => candidate . code === "gsap_repeated_fromto_without_baseline" ,
3252+ ) ,
3253+ ) . toBeUndefined ( ) ;
3254+ } ) ;
3255+
3256+ it ( "gsap_repeated_fromto_without_baseline: keeps different selectors independent" , async ( ) => {
3257+ const html = `
3258+ <html><body>
3259+ <div data-composition-id="main" data-width="1920" data-height="1080">
3260+ <div id="ring-a"></div><div id="ring-b"></div>
3261+ </div>
3262+ <script src="https://cdn.jsdelivr.net/npm/gsap@3/dist/gsap.min.js"></script>
3263+ <script>
3264+ window.__timelines = window.__timelines || {};
3265+ const tl = gsap.timeline({ paused: true });
3266+ tl.fromTo("#ring-a", { opacity: 0 }, { opacity: 1, duration: 0.5 }, 5);
3267+ tl.fromTo("#ring-b", { opacity: 1 }, { opacity: 0, duration: 0.5 }, 10);
3268+ window.__timelines.main = tl;
3269+ </script>
3270+ </body></html>` ;
3271+ const result = await lintHyperframeHtml ( html ) ;
3272+
3273+ expect (
3274+ result . findings . find (
3275+ ( candidate ) => candidate . code === "gsap_repeated_fromto_without_baseline" ,
3276+ ) ,
3277+ ) . toBeUndefined ( ) ;
3278+ } ) ;
3279+
30533280 // ── svg_measure_before_path_d ──────────────────────────────────────────────
30543281
30553282 it ( "svg_measure_before_path_d: ERROR when no d assignment exists anywhere" , async ( ) => {
0 commit comments