Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

test(native): check all clipping ancestors

yxlyx41073f69dad7
diff --git a/apps/native/electron/projects-visual.cjs b/apps/native/electron/projects-visual.cjs
index 2573dbc6..d733bee6 100644
--- a/apps/native/electron/projects-visual.cjs
+++ b/apps/native/electron/projects-visual.cjs
@@ -72,7 +72,7 @@ async function runProjectVisuals({ win, origin, output, pressEnter }) {
await js(`window.folderFetchCount=0;window.releaseFolderFetch=[];const folderBaseFetch=window.fetch;window.fetch=(input,options)=>{if(String(input).includes('/api/workspaces')){window.folderFetchCount+=1;const reply=()=>new Response(JSON.stringify({path:'/demo',parent:'/',git:false,home:'/demo',default:'/demo',entries:[{name:'apps',path:'/demo/apps',git:false}]}),{headers:{'content-type':'application/json'}});if(window.folderFetchCount===1)return Promise.resolve(reply());return new Promise(resolve=>window.releaseFolderFetch.push(()=>resolve(reply())));}return folderBaseFetch(input,options);};true`);
await js(`document.querySelector('button[aria-label="Open folder…"]').click()`);
await wait(`document.querySelector('[role="dialog"][aria-label="Open a folder"]')?.textContent.includes('apps')`);
- await js(`(()=>{window.folderListingInvisible=false;window.monitorFolderListing=true;const visible=()=>{const dialog=document.querySelector('[role="dialog"][aria-label="Open a folder"]'),button=dialog&&Array.from(dialog.querySelectorAll('button[title]')).find(b=>b.title==='/demo/apps');if(!dialog||!button||!button.checkVisibility({checkOpacity:true,checkVisibilityCSS:true}))return false;let clip=button.parentElement;while(clip&&clip!==dialog&&!/^(auto|scroll|hidden|clip)$/.test(getComputedStyle(clip).overflowY))clip=clip.parentElement;const r=button.getBoundingClientRect(),c=(clip||dialog).getBoundingClientRect(),d=dialog.getBoundingClientRect();return r.width>0&&r.height>0&&r.right>Math.max(c.left,d.left)&&r.left<Math.min(c.right,d.right)&&r.bottom>Math.max(c.top,d.top)&&r.top<Math.min(c.bottom,d.bottom);};const check=()=>{if(!window.monitorFolderListing)return;if(!visible())window.folderListingInvisible=true;requestAnimationFrame(check);};requestAnimationFrame(check);return true;})()`);
+ await js(`(()=>{window.folderListingInvisible=false;window.monitorFolderListing=true;const visible=()=>{const dialog=document.querySelector('[role="dialog"][aria-label="Open a folder"]'),button=dialog&&Array.from(dialog.querySelectorAll('button[title]')).find(b=>b.title==='/demo/apps');if(!dialog||!button||!button.checkVisibility({checkOpacity:true,checkVisibilityCSS:true}))return false;const r=button.getBoundingClientRect();if(r.width<=0||r.height<=0)return false;for(let node=button.parentElement;node;node=node.parentElement){const style=getComputedStyle(node),clip=node.getBoundingClientRect();if(/^(auto|scroll|hidden|clip)$/.test(style.overflowX)&&(r.left<clip.left||r.right>clip.right))return false;if(/^(auto|scroll|hidden|clip)$/.test(style.overflowY)&&(r.top<clip.top||r.bottom>clip.bottom))return false;if(node===dialog)break;}return true;};const check=()=>{if(!window.monitorFolderListing)return;if(!visible())window.folderListingInvisible=true;requestAnimationFrame(check);};requestAnimationFrame(check);return true;})()`);
await js(`document.querySelector('[role="dialog"][aria-label="Open a folder"] input[aria-label="Folder path"]').focus()`);
await pressEnter(); await pressEnter(); await pressEnter();
await wait(`window.folderFetchCount===4`);