🐛 fix(vscode): 代码阅读属性表的输入参数、导入项可以折叠
This commit is contained in:
1 parent
846fba92e1
commit
e8a6a795f5
5 files changed
+55
-15
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import type { ViewState, ViewStateStorage } from './viewState'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { createViewStateStore } from './viewState'
|
||||
import { createViewStateStore, propertyRowId } from './viewState'
|
||||
|
||||
/** 模拟 VS Code 的 webview 状态:存进去的要能序列化,页面重新加载后原样取回 */
|
||||
function memoryStorage(): ViewStateStorage {
|
||||
@@ -34,4 +34,16 @@ describe('webview 状态', () => {
|
||||
store.update({ scroll: { line: 40, offset: -6, scrollTop: 1210 } })
|
||||
expect(createViewStateStore(storage).get()).toEqual({ editing: [], collapsed: ['3'], scroll: { line: 40, offset: -6, scrollTop: 1210 } })
|
||||
})
|
||||
|
||||
it('属性行的折叠 id 是块 id 加行序号,不会和块 id 撞上', () => {
|
||||
expect(propertyRowId('6.1.0', 3)).toBe('6.1.0/p3')
|
||||
expect(propertyRowId('6', 1)).not.toBe('6.1')
|
||||
expect(propertyRowId('6.1', 0)).not.toBe(propertyRowId('6', 10))
|
||||
})
|
||||
|
||||
it('属性行和块的折叠状态存在同一份 collapsed 里,页面重新加载后都还在', () => {
|
||||
const storage = memoryStorage()
|
||||
createViewStateStore(storage).update({ collapsed: ['6.1', propertyRowId('6.1.0', 3)] })
|
||||
expect(createViewStateStore(storage).get().collapsed).toEqual(['6.1', '6.1.0/p3'])
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user