@@ -664,6 +664,45 @@ describe("__hfSwapScenes", () => {
664664 expect ( sceneHost ( "a" ) . querySelector ( "video" ) ) . toBe ( kept ) ;
665665 } ) ;
666666
667+ it . each ( [
668+ [ "the edit flash" , "__hf-flash" ] ,
669+ [ "the picker's hover" , "__hf-pick-highlight" ] ,
670+ ] ) ( "keeps a video that carries %s class at the swap" , async ( _ , name ) => {
671+ quietMedia ( ) ;
672+ const { html } = bootWithHeadingScript (
673+ "void video" ,
674+ '<video class="clip" src="clip.mp4"></video>' ,
675+ ) ;
676+ await tick ( ) ;
677+ const video = sceneHost ( "a" ) . querySelector ( "video" ) ! ;
678+ video . classList . add ( name ) ;
679+ await window . __hfSwapScenes ! ( html ) ;
680+ expect ( sceneHost ( "a" ) . querySelector ( "video" ) ) . toBe ( video ) ;
681+ } ) ;
682+
683+ it ( "keeps a video that carries the edit flash as its only class at the swap" , async ( ) => {
684+ quietMedia ( ) ;
685+ const { html } = bootWithHeadingScript ( "void video" ) ;
686+ await tick ( ) ;
687+ const video = sceneHost ( "a" ) . querySelector ( "video" ) ! ;
688+ video . classList . add ( "__hf-flash" ) ;
689+ await window . __hfSwapScenes ! ( html ) ;
690+ expect ( sceneHost ( "a" ) . querySelector ( "video" ) ) . toBe ( video ) ;
691+ } ) ;
692+
693+ it ( "keeps a video whose unchanged script removes an attribute and puts it back as it was" , async ( ) => {
694+ quietMedia ( ) ;
695+ const { html } = bootWithHeadingScript (
696+ "video.removeAttribute('title'), video.setAttribute('title', 'clip')" ,
697+ '<video title="clip" data-id="v" src="clip.mp4"></video>' ,
698+ ) ;
699+ await tick ( ) ;
700+ const video = sceneHost ( "a" ) . querySelector ( "video" ) ! ;
701+ expect ( video . getAttributeNames ( ) . at ( - 1 ) ) . toBe ( "title" ) ;
702+ await window . __hfSwapScenes ! ( html ) ;
703+ expect ( sceneHost ( "a" ) . querySelector ( "video" ) ) . toBe ( video ) ;
704+ } ) ;
705+
667706 it ( "unmutes a kept video though stopping Web Audio puts back the mute it saved from the old script" , async ( ) => {
668707 quietMedia ( ) ;
669708 const { html } = bootWithHeadingScript ( "video.muted = true" ) ;
0 commit comments