docs(tests): explain renderer timing and migration probes

This commit is contained in:
2026-11-12 18:25:52 +08:00
parent 357c92d749
commit f0c7c83b24
3 changed files with 7 additions and 1 deletions
+2
View File
@@ -46,6 +46,7 @@ export async function editDuringCopy({call,evaluate,wait,count}){
return Number(status.match(/·\\s*(\\d+)\\s*项/)?.[1]??0);
},dispose(){element.removeEventListener('input',input);}};
})()`);
// CDP 直接驱动 Chromium 的组合与插入接口,不启动操作系统输入法候选窗;用它检查编辑器对 composition 的保留。
// 先启动中文输入法组合再提交文本,随后分次插入 A/B/C;每次都等对应样本进入后续帧。
await call('Input.imeSetComposition',{text:'复',selectionStart:1,selectionEnd:1});
await call('Input.insertText',{text:'复制期间输入'});
@@ -70,6 +71,7 @@ export async function editDuringCopy({call,evaluate,wait,count}){
const probe=window.__copyInputProbe,result={samples:probe.samples,value:probe.element.value,retained:probe.element.isConnected&&document.activeElement===probe.element};
probe.dispose();probe.element.blur();delete window.__copyInputProbe;return result;
})()`);
// frameDelayMs 是 input 回调至第二次 RAF 回调的间隔,不包含 CDP 发命令前的等待,也不是像素实际呈现延迟。
// 检查同一原生输入节点/焦点留存及完整文本后缀,复制过程不能重建编辑 DOM 或覆盖用户输入。
assert.equal(result.retained,true,'copy discarded native input DOM or focus');
assert.ok(result.value.endsWith(count>=10000?'复制期间输入 A B C M T':'复制期间输入 A B C'),'native composition/typing was overwritten');