File tree Expand file tree Collapse file tree
packages/core/src/studio-api/helpers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -300,4 +300,20 @@ describe("probeElementInSource", () => {
300300 const html = `<div class="item">A</div><div class="item">B</div>` ;
301301 expect ( probeElementInSource ( html , { selector : ".item" , selectorIndex : 5 } ) ) . toBe ( false ) ;
302302 } ) ;
303+
304+ it ( "returns false for an element that would only exist after JS execution" , ( ) => {
305+ const sourceHtml = `<!doctype html><html><head></head><body>
306+ <div id="root" data-composition-id="main">
307+ <div id="canvas"></div>
308+ <script>
309+ const svg = document.createElement("div");
310+ svg.id = "arrows-svg";
311+ document.getElementById("canvas").appendChild(svg);
312+ </script>
313+ </div>
314+ </body></html>` ;
315+
316+ expect ( probeElementInSource ( sourceHtml , { id : "arrows-svg" } ) ) . toBe ( false ) ;
317+ expect ( probeElementInSource ( sourceHtml , { id : "canvas" } ) ) . toBe ( true ) ;
318+ } ) ;
303319} ) ;
You can’t perform that action at this time.
0 commit comments