File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -587,4 +587,24 @@ suite('include-fragment-element', function () {
587587 assert . equal ( document . querySelector ( '#replaced' ) . textContent , 'hello' )
588588 } )
589589 } )
590+
591+ test ( 'include-fragment-replaced is only called once' , function ( ) {
592+ const div = document . createElement ( 'div' )
593+ div . hidden = true
594+ document . body . append ( div )
595+
596+ div . innerHTML = `<include-fragment src="/hello">loading</include-fragment>`
597+ div . firstChild . addEventListener ( 'include-fragment-replaced' , ( ) => ( loadCount += 1 ) )
598+
599+ let loadCount = 0
600+ setTimeout ( ( ) => {
601+ div . hidden = false
602+ } , 0 )
603+
604+ return when ( div . firstChild , 'include-fragment-replaced' ) . then ( ( ) => {
605+ assert . equal ( loadCount , 1 , 'Load occured too many times' )
606+ assert . equal ( document . querySelector ( 'include-fragment' ) , null )
607+ assert . equal ( document . querySelector ( '#replaced' ) . textContent , 'hello' )
608+ } )
609+ } )
590610} )
You can’t perform that action at this time.
0 commit comments