@@ -57,8 +57,9 @@ async function runTests() {
5757 await testOutputModeHidden ( ) ;
5858
5959 await testOutputPlaceholder ( ) ;
60- await testOutputNoTail ( ) ;
61- await testOutputTail ( ) ;
60+ await testOutputTailOff ( ) ;
61+ await testOutputTailOn ( ) ;
62+ await testOutputTailAuto ( ) ;
6263
6364 await testTemplate ( ) ;
6465 await testTemplateChange ( ) ;
@@ -763,9 +764,9 @@ async function testOutputPlaceholder() {
763764 } ) ;
764765}
765766
766- async function testOutputNoTail ( ) {
767+ async function testOutputTailOff ( ) {
767768 return new Promise ( ( resolve , reject ) => {
768- t . log ( "testOutputNoTail ..." ) ;
769+ t . log ( "testOutputTailOff ..." ) ;
769770 const ui = createSnippet ( `
770771 <pre><code>console.log("hello");
771772console.log("---");
@@ -781,9 +782,9 @@ console.log("world");</code></pre>
781782 } ) ;
782783}
783784
784- async function testOutputTail ( ) {
785+ async function testOutputTailOn ( ) {
785786 return new Promise ( ( resolve , reject ) => {
786- t . log ( "testOutputTail ..." ) ;
787+ t . log ( "testOutputTailOn ..." ) ;
787788 const ui = createSnippet ( `
788789 <pre><code>console.log("hello");
789790console.log("---");
@@ -799,6 +800,26 @@ console.log("world");</code></pre>
799800 } ) ;
800801}
801802
803+ async function testOutputTailAuto ( ) {
804+ return new Promise ( ( resolve , reject ) => {
805+ t . log ( "testOutputTailAuto..." ) ;
806+ const html = `
807+ <pre><code>console.log("hello")</code></pre>
808+ <codapi-snippet id="step-1" engine="browser" sandbox="javascript">
809+ </codapi-snippet>
810+ <pre><code>console.log("world")</code></pre>
811+ <codapi-snippet engine="browser" sandbox="javascript" depends-on="step-1" output-tail>
812+ </codapi-snippet>
813+ ` ;
814+ const ui = createSnippet ( html ) ;
815+ ui . snip . addEventListener ( "result" , ( event ) => {
816+ t . assert ( "output" , ui . output . out . innerHTML == "world" ) ;
817+ resolve ( ) ;
818+ } ) ;
819+ ui . toolbar . run . click ( ) ;
820+ } ) ;
821+ }
822+
802823async function testTemplate ( ) {
803824 return new Promise ( ( resolve , reject ) => {
804825 t . log ( "testTemplate..." ) ;
0 commit comments