@@ -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()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user