改造 H5 第三方地图导航
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-13 16:56:18 +08:00
parent 9c003c16dc
commit 140f13633e
5 changed files with 308 additions and 220 deletions

View File

@@ -33,7 +33,8 @@ beforeEach(() => {
}
})
vi.stubGlobal('uni', {
showToast: vi.fn()
showToast: vi.fn(),
showActionSheet: vi.fn()
})
})
@@ -48,8 +49,11 @@ afterEach(() => {
})
describe('来馆面板 H5 实际渲染', () => {
it('主按钮显示第三方导航,点击后展示三家地图选择', async () => {
it('主按钮显示第三方导航,点击后弹出百度和高德选择', async () => {
const wrapper = mountArrivalPanel()
const showActionSheet = (uni as unknown as {
showActionSheet: ReturnType<typeof vi.fn>
}).showActionSheet
const navigateTo = (
window as Window & {
wx?: { miniProgram?: { navigateTo?: ReturnType<typeof vi.fn> } }
@@ -60,11 +64,10 @@ describe('来馆面板 H5 实际渲染', () => {
expect(wrapper.text()).not.toContain('打开地图导航')
await wrapper.get('.arrival-primary').trigger('tap')
expect(wrapper.find('.provider-sheet').exists()).toBe(true)
expect(wrapper.findAll('.provider-row')).toHaveLength(3)
expect(wrapper.text()).toContain('高德地图')
expect(wrapper.text()).toContain('百度地图')
expect(wrapper.text()).toContain('腾讯地图')
expect(showActionSheet).toHaveBeenCalledWith(expect.objectContaining({
itemList: ['百度地图', '高德地图']
}))
expect(wrapper.find('.provider-sheet').exists()).toBe(false)
expect(navigateTo).not.toHaveBeenCalled()
})