20260915221013

This commit is contained in:
oneao committed 2026-09-15 22:10:13 +08:00
1 parent 1f56cc3efb
commit dce29f250e
54 files changed
+3732 -574

No files matched your search

@@ -1,9 +1,10 @@
/**
* 往来单位分类树的页面级纯函数(仍内联在 views/base/othercompany/index.vue)。
*
* 建树、位置派生、排序号重排、整树重建等通用逻辑已收敛到 @/utils/tree,
* 其测试在 tests/unit/utils.spec.js;本文件只覆盖留在页面里的两个业务判定,
* 它们内联在页面中,因此通过挂载页面组件访问 <script setup> 的内部绑定。
* 建树、位置派生、排序号重排、整树重建、拖拽移动等通用逻辑已收敛到 @/utils/tree
* (其测试在 tests/unit/utils.spec.js),选中「全部分类」的虚拟根约定收敛到 FmsTree。
* 本文件只覆盖留在页面里的业务判定,它们内联在页面中,
* 因此通过挂载页面组件访问 <script setup> 的内部绑定。
*/
import { describe, expect, it, beforeEach, vi } from 'vitest'
import { flushPromises } from '@vue/test-utils'
@@ -67,8 +68,15 @@ describe('othercompany 分类树工具:排序号与子分类判定', () => {
})
})
describe('othercompany 分类树工具:虚拟根键', () => {
it('与 FmsTree 的 rootKey 约定保持一致', () => {
expect(vm.ALL_CATEGORY_KEY).toBe('__fms_tree_root__')
describe('othercompany 分类树工具:选中「全部分类」的约定', () => {
it('未选中任何分类时用空串表达「全部」,不再持有 rootKey', () => {
// FmsTree 内部消化虚拟根:页面侧传空选中键即代表选中根,
// 因此页面不应再暴露 ALL_CATEGORY_KEY 之类的魔法字符串。
expect(vm.selectedCategoryKey).toBe('')
expect(vm.ALL_CATEGORY_KEY).toBeUndefined()
})
it('未选中分类时不过滤右侧列表(不加固定条件)', () => {
expect(vm.categoryFilterCondition).toBe('')
})
})