同步移动端源码并修复小程序嵌入标题
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-28 18:37:40 +08:00
parent 06ad609e1f
commit 540bb8627f
62 changed files with 4196 additions and 1410 deletions

View File

@@ -29,7 +29,13 @@ const ThreeMapStub = defineComponent({
default: null
}
},
emits: ['floor-change', 'target-focus', 'auto-switch', 'render-mode-fallback'],
emits: [
'floor-change',
'target-focus',
'auto-switch',
'render-mode-fallback',
'semantic-exterior-exit'
],
setup(_, { expose }) {
expose({
switchFloor: vi.fn(),
@@ -48,6 +54,12 @@ const ThreeMapStub = defineComponent({
template: '<div data-testid="three-map"></div>'
})
const TencentJsMapStub = defineComponent({
name: 'TencentJsMap',
emits: ['semantic-enter-building'],
template: '<div data-testid="tencent-js-map"></div>'
})
const modelSource = {
loadPackage: async () => ({ overviewModelUrl: '', floors: [] }),
loadFloorPois: async () => []
@@ -166,6 +178,54 @@ describe('GuideMapShell 点位过滤契约', () => {
expect(wrapper.emitted('targetFocus')).toEqual([[focusResult]])
})
it('仅在语义缩放启用时转发室内外层级切换事件', async () => {
const indoorWrapper = mount(GuideMapShell, {
props: {
mapType: 'indoor',
indoorModelSource: modelSource,
floors: [{ id: 'L1', label: '1F' }],
activeFloor: 'L1',
semanticZoomEnabled: true
},
global: { stubs: { ThreeMap: ThreeMapStub } }
})
indoorWrapper.getComponent(ThreeMapStub).vm.$emit('semantic-exterior-exit')
await indoorWrapper.vm.$nextTick()
expect(indoorWrapper.emitted('semanticExitOutdoor')).toEqual([[]])
const outdoorWrapper = mount(GuideMapShell, {
props: {
mapType: 'outdoor',
indoorModelSource: modelSource,
floors: [{ id: 'L1', label: '1F' }],
activeFloor: 'L1',
semanticZoomEnabled: true
},
global: { stubs: { TencentJsMap: TencentJsMapStub, TencentMap: true } }
})
const viewport = { latitude: 22.692763, longitude: 114.363572, zoom: 18.5 }
outdoorWrapper.getComponent(TencentJsMapStub).vm.$emit('semantic-enter-building', viewport)
await outdoorWrapper.vm.$nextTick()
expect(outdoorWrapper.emitted('semanticEnterBuilding')).toEqual([[viewport]])
})
it('语义缩放关闭时不转发地图层级切换事件', async () => {
const wrapper = mount(GuideMapShell, {
props: {
mapType: 'indoor',
indoorModelSource: modelSource,
floors: [{ id: 'L1', label: '1F' }],
activeFloor: 'L1',
semanticZoomEnabled: false
},
global: { stubs: { ThreeMap: ThreeMapStub } }
})
wrapper.getComponent(ThreeMapStub).vm.$emit('semantic-exterior-exit')
await wrapper.vm.$nextTick()
expect(wrapper.emitted('semanticExitOutdoor')).toBeUndefined()
})
it('忽略旧渲染版本的 WebP 回退事件', async () => {
const wrapper = mount(GuideMapShell, {
props: {