fix(glass): port material accents to v3 (#660)

This commit is contained in:
InfinityPacer
2026-08-10 15:01:08 +08:00
committed by GitHub
parent 6a4af66683
commit 1a303b4323
22 changed files with 742 additions and 86 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ const props = defineProps<{
translationStrength: number
/** 路由变化标识,用于在页面内容稳定后重新发现高价值表面。 */
routeKey: string
/** 当前主题主色,用于同步色调材质的光学高光。 */
/** 由用户主色派生的大面积玻璃材料色,用于同步色调材质的光学高光。 */
tintColor: string
/** 外层壁纸交叉淡化的时长,shader 使用同一时钟混合双纹理。 */
transitionDuration: number
@@ -126,7 +126,7 @@ afterEach(() => {
})
describe('GlassOpticalLayer', () => {
it('uses exactly two visible presentation contexts with one interaction source', () => {
it('uses exactly two visible presentation contexts with one interaction source', async () => {
rendererCalls.length = 0
rendererResults.length = 0
setRendererState.mockClear()
@@ -159,6 +159,7 @@ describe('GlassOpticalLayer', () => {
expect(rendererCalls.every(options => options.wallpaperSourceCache === wallpaperSourceCache)).toBe(true)
expect(rendererCalls.every(options => options.syncDocumentState === false)).toBe(true)
expect(rendererCalls.every(options => (options.dynamicsActive as { value: boolean }).value)).toBe(true)
expect(rendererCalls.map(options => (options.tintColor as () => string)())).toEqual(['#8D51F9', '#8D51F9'])
expect(rendererCalls[0].pageMotion).toBeUndefined()
expect(rendererCalls[1].pageMotion).toEqual(
expect.objectContaining({
@@ -167,6 +168,9 @@ describe('GlassOpticalLayer', () => {
}),
)
await wrapper.setProps({ tintColor: '#00A6B8' })
expect(rendererCalls.map(options => (options.tintColor as () => string)())).toEqual(['#00A6B8', '#00A6B8'])
wrapper.unmount()
expect(setRendererState).toHaveBeenLastCalledWith(expect.any(Object), 'fallback')
})