Files
pages/internal/server/testdata/domain-entry-dialog.js
Anya Tokugawa c1175d389f Implement Knowledge City platform, organizer and DAV integration
Capture accumulated application, UI, CLI, regression tests and design documentation changes, including task project mapping and default CalDAV list naming.

Keep deployment data, backups, local credentials and build artifacts out of Git. Move the Compose enrollment token to an ignored local environment file.
2026-09-27 14:44:43 +09:00

30 lines
2.0 KiB
JavaScript

addEventListener('load',()=>{
try {
const button=document.querySelector('[data-domain-entry-open]');button.click();
const dialog=document.getElementById(button.dataset.domainEntryOpen);
if(!dialog.open||dialog.closest('table,.config-panel'))throw new Error('dialog not isolated');
const bounds=dialog.getBoundingClientRect();
if(bounds.width<200||bounds.left<0||bounds.right>innerWidth+1||bounds.top<0||bounds.bottom>innerHeight+1)throw new Error('dialog viewport bounds');
if(dialog.scrollWidth>dialog.clientWidth+1)throw new Error('horizontal overflow');
for(const form of dialog.querySelectorAll('form')){
if(getComputedStyle(form).display!=='block')throw new Error('table form CSS leaked');
}
for(const p of dialog.querySelectorAll('p'))if(getComputedStyle(p).display!=='block')throw new Error('inline help text');
const controls=[...dialog.querySelectorAll('input:not([type=hidden]),select')];
for(let i=0;i<controls.length;i++){
const r=controls[i].getBoundingClientRect();
if(r.width<24||r.left<bounds.left||r.right>bounds.right+1)throw new Error('control overflow');
for(let j=i+1;j<controls.length;j++){
const b=controls[j].getBoundingClientRect();
if(Math.min(r.right,b.right)>Math.max(r.left,b.left)+1&&Math.min(r.bottom,b.bottom)>Math.max(r.top,b.top)+1)throw new Error('overlapping inputs');
}
}
dialog.scrollTop=dialog.scrollHeight;
const close=dialog.querySelector('[data-domain-entry-close]'),c=close.getBoundingClientRect();
if(c.top<bounds.top||c.bottom>bounds.bottom)throw new Error('close button not sticky');
close.click();if(dialog.open)throw new Error('close failed');
button.click();dialog.scrollTop=0;
document.body.dataset.vimReady='true';
}catch(error){const p=document.createElement('p');p.id='error';p.textContent=error.message;document.body.append(p);}
});