fix(h5): 修复 WebView 顶栏 logo 与内容重叠
embed 模式 header 改文档流、移除负 margin;持久化 sbh 并在路由中保留,避免胶囊区与档案条重叠。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { initMpEmbed, isMpEmbed } from './mpEmbed'
|
||||
import { applyMpEmbedDom, initMpEmbed, isMpEmbed } from './mpEmbed'
|
||||
|
||||
describe('mpEmbed', () => {
|
||||
beforeEach(() => {
|
||||
@@ -17,11 +17,15 @@ describe('mpEmbed', () => {
|
||||
expect(isMpEmbed()).toBe(true)
|
||||
})
|
||||
|
||||
it('applies status bar height from ?sbh=', () => {
|
||||
it('persists status bar height from ?sbh=', () => {
|
||||
window.history.replaceState({}, '', '/psy/?mp=1&sbh=47')
|
||||
initMpEmbed()
|
||||
expect(document.documentElement.style.getPropertyValue('--yxg-safe-top')).toBe('47px')
|
||||
expect(document.documentElement.style.getPropertyValue('--yxg-page-top')).toBe('calc(47px + 50px)')
|
||||
expect(sessionStorage.getItem('yxg_sbh')).toBe('47')
|
||||
window.history.replaceState({}, '', '/psy/?mp=1')
|
||||
applyMpEmbedDom()
|
||||
expect(document.documentElement.style.getPropertyValue('--yxg-safe-top')).toBe('47px')
|
||||
})
|
||||
|
||||
it('returns false without mp query', () => {
|
||||
|
||||
Reference in New Issue
Block a user