test(webui): 焦点判据钉到回复框自己的 Composer(变异测试抓到的弱判据)
上一版写的是全文件搜裸 `autoFocus`,而 MailView 里预算输入框、编辑器还有几处
autoFocus ⇒ 把回复框改回 `autoFocus={narrow}` 时判据**照样绿**。
按判据规范 §1 改成取那个标签自己的 `/>` 体再断言。
四组变异全部红在对的那条上:
useState(false)→useState(!narrow) → 红 1(头部不再分叉)
if(!open)→if(narrow && !open) → 红 2(悬浮球 + narrow-only 分支)
去掉一个根节点的 relative → 红 1(悬浮球锚点)
autoFocus→autoFocus={narrow} → 红 1(焦点)
This commit is contained in:
@ -221,8 +221,19 @@ check(
|
||||
check(
|
||||
'回复框展开后有收回归口(宽窄都有,不再只在窄屏渲染),点开时焦点落到输入框',
|
||||
mv.includes('aria-label="收起回复框"') &&
|
||||
// 焦点:原来是 autoFocus={narrow},宽屏点开悬浮球就不会聚焦
|
||||
/autoFocus(?![={])/.test(mv)
|
||||
/*
|
||||
* 焦点要钉在**回复框自己的 Composer** 上。
|
||||
*
|
||||
* 第一版写的是 `/autoFocus(?![={])/` —— 全文件搜一个裸 `autoFocus`,
|
||||
* 而 MailView 里预算输入框、编辑器还有几处 `autoFocus`,于是把回复框改回
|
||||
* `autoFocus={narrow}` 时它**照样绿**(变异测试抓到的)。
|
||||
* 按 §1:取那个标签自己的 `{...}`/`/>` 体再断言,不靠全文件搜关键字。
|
||||
*/
|
||||
(() => {
|
||||
const blocks = [...mv.matchAll(/<Composer\b[\s\S]*?\/>/g)].map(m => m[0]);
|
||||
const reply = blocks.find(b => b.includes('density="roomy"'));
|
||||
return !!reply && /\bautoFocus\b/.test(reply) && !/autoFocus=\{/.test(reply);
|
||||
})()
|
||||
);
|
||||
check(
|
||||
'折叠控件里没有一处只在窄屏生效(narrow && … 的折叠分支已清空)',
|
||||
|
||||
Reference in New Issue
Block a user