feat: migrate static pages to native tabbar
This commit is contained in:
26
tests/static-ux-navigation.test.js
Normal file
26
tests/static-ux-navigation.test.js
Normal file
@@ -0,0 +1,26 @@
|
||||
const { isTabRoute, openStaticRoute } = require('../utils/static-ux/route-map')
|
||||
|
||||
describe('static ux navigation', () => {
|
||||
test('recognizes tab routes by page path', () => {
|
||||
expect(isTabRoute('/pages/home/index')).toBe(true)
|
||||
expect(isTabRoute('/pages/home/index?from=portal')).toBe(true)
|
||||
expect(isTabRoute('/packages/tcm/pages/assets/index?kind=history')).toBe(false)
|
||||
})
|
||||
|
||||
test('uses switchTab for tab routes and navigateTo for non-tab routes', () => {
|
||||
const wxApi = {
|
||||
switchTab: jest.fn(),
|
||||
navigateTo: jest.fn()
|
||||
}
|
||||
|
||||
expect(openStaticRoute('/pages/library/index', wxApi)).toBe(true)
|
||||
expect(openStaticRoute('/packages/tcm/pages/assets/index?kind=history', wxApi)).toBe(true)
|
||||
|
||||
expect(wxApi.switchTab).toHaveBeenCalledWith({
|
||||
url: '/pages/library/index'
|
||||
})
|
||||
expect(wxApi.navigateTo).toHaveBeenCalledWith({
|
||||
url: '/packages/tcm/pages/assets/index?kind=history'
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user