feat(h5): 小程序原生顶栏 + 本地联调与一键部署
nh=1 隐藏 H5 顶栏并由 cover 承载 logo;H5 仅 4px 顶距避免重复留白。新增 dev:mp、deploy:h5 与联调文档。 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 { applyMpEmbedDom, initMpEmbed, isMpEmbed } from './mpEmbed'
|
||||
import { applyMpEmbedDom, initMpEmbed, isMpEmbed, isMpNativeHeader } from './mpEmbed'
|
||||
|
||||
describe('mpEmbed', () => {
|
||||
beforeEach(() => {
|
||||
@@ -28,6 +28,15 @@ describe('mpEmbed', () => {
|
||||
expect(document.documentElement.style.getPropertyValue('--yxg-safe-top')).toBe('47px')
|
||||
})
|
||||
|
||||
it('uses native mini-program header mode with ?nh=1', () => {
|
||||
window.history.replaceState({}, '', '/psy/?mp=1&nh=1')
|
||||
initMpEmbed()
|
||||
expect(isMpNativeHeader()).toBe(true)
|
||||
expect(document.documentElement.classList.contains('mp-native-header')).toBe(true)
|
||||
expect(document.documentElement.style.getPropertyValue('--yxg-safe-top')).toBe('0px')
|
||||
expect(document.documentElement.style.getPropertyValue('--yxg-page-top')).toBe('4px')
|
||||
})
|
||||
|
||||
it('returns false without mp query', () => {
|
||||
initMpEmbed()
|
||||
expect(isMpEmbed()).toBe(false)
|
||||
|
||||
Reference in New Issue
Block a user