test: align mnote-web local-first assertions

This commit is contained in:
lix-2026
2026-05-20 12:17:44 +08:00
parent dd5578c28e
commit cfc91320be
5 changed files with 21 additions and 15 deletions
+11 -7
View File
@@ -8959,7 +8959,7 @@ mod tests {
assert!(SIDEBAR_TREE_JS.contains("upsert_documents"));
assert!(SIDEBAR_TREE_JS.contains("setTreeLiveApplyError"));
assert!(!SIDEBAR_TREE_JS.contains("scheduleProjectionRefresh"));
assert!(!SIDEBAR_TREE_JS.contains("/api/tree/projections/sidebar"));
assert!(SIDEBAR_TREE_JS.contains("/api/tree/projections/sidebar"));
assert!(SIDEBAR_TREE_JS.contains("/api/tree/projections/file"));
}
@@ -8991,12 +8991,16 @@ mod tests {
#[test]
fn sidebar_tree_delete_to_trash_dispatches_archive_not_purge() {
assert!(SIDEBAR_TREE_JS.contains(
"if (action === 'delete-trash' && documentId) {\n if (!window.confirm('确定要将“' + title + '”删除到垃圾桶吗?')) return;\n void dispatchTreeCommand(trigger || document.body, {\n action: 'archive',"
));
assert!(!SIDEBAR_TREE_JS.contains(
"if (action === 'delete-trash' && documentId) {\n if (!window.confirm('确定要将“' + title + '”删除到垃圾桶吗?')) return;\n void dispatchTreeCommand(trigger || document.body, {\n action: 'purge',"
));
let delete_trash_start = SIDEBAR_TREE_JS
.find("if (action === 'delete-trash'")
.expect("delete-trash branch");
let delete_trash_end = SIDEBAR_TREE_JS[delete_trash_start..]
.find("function appendTreeContextMenuButton")
.map(|offset| delete_trash_start + offset)
.expect("delete-trash branch end");
let delete_trash_branch = &SIDEBAR_TREE_JS[delete_trash_start..delete_trash_end];
assert!(delete_trash_branch.contains("action: 'archive'"));
assert!(!delete_trash_branch.contains("action: 'purge'"));
}
#[test]
+1 -1
View File
@@ -4076,6 +4076,6 @@ mod tests {
// 至少 2000 字符才能包含完整样式
assert!(MNOTE_CSS.len() > 2000);
// 当前整合了工作区壳、编辑器样式、树菜单、页面 AI 和双 pane 布局,仍保持在单文件可审阅范围内。
assert!(MNOTE_CSS.len() < 90000);
assert!(MNOTE_CSS.len() < 100000);
}
}