refactor: consolidate finance workflow modules
This commit is contained in:
@@ -8,23 +8,65 @@ const shell = readFileSync(
|
||||
'utf8'
|
||||
)
|
||||
const router = readFileSync(fileURLToPath(new URL('../src/router/index.js', import.meta.url)), 'utf8')
|
||||
const sidebarRail = readFileSync(
|
||||
fileURLToPath(new URL('../src/components/layout/SidebarRail.vue', import.meta.url)),
|
||||
'utf8'
|
||||
)
|
||||
const aiSidebarRail = readFileSync(
|
||||
fileURLToPath(new URL('../src/components/layout/AiSidebarRail.vue', import.meta.url)),
|
||||
'utf8'
|
||||
)
|
||||
|
||||
test('app shell main route views are eagerly imported', () => {
|
||||
assert.doesNotMatch(shell, /defineAsyncRouteView/)
|
||||
assert.doesNotMatch(shell, /defineAsyncComponent/)
|
||||
assert.doesNotMatch(shell, /loadingComponent:/)
|
||||
assert.doesNotMatch(shell, /\u9875\u9762\u5207\u6362\u4e2d/)
|
||||
assert.doesNotMatch(shell, /floating:\s*true/)
|
||||
assert.doesNotMatch(shell, /blocking:\s*true/)
|
||||
assert.match(shell, /import AuditView from '\.\/AuditView\.vue'/)
|
||||
assert.match(shell, /import DigitalEmployeesView from '\.\/DigitalEmployeesView\.vue'/)
|
||||
assert.match(shell, /import EmployeeManagementView from '\.\/EmployeeManagementView\.vue'/)
|
||||
assert.match(shell, /import DocumentsCenterView from '\.\/DocumentsCenterView\.vue'/)
|
||||
assert.match(shell, /import BudgetCenterView from '\.\/BudgetCenterView\.vue'/)
|
||||
test('app shell lazily loads heavy business views with an in-workarea loading state', () => {
|
||||
assert.match(shell, /defineAsyncRouteView\('audit'\)/)
|
||||
assert.match(shell, /defineAsyncRouteView\('documents'\)/)
|
||||
assert.match(shell, /defineAsyncRouteView\('workbench'\)/)
|
||||
assert.match(shell, /defineAsyncModalView\('travelCreate'\)/)
|
||||
assert.match(shell, /function prefetchAppView\(viewId\)/)
|
||||
assert.match(shell, /@prefetch-view="prefetchAppView"/)
|
||||
assert.doesNotMatch(shell, /import AuditView from '\.\/AuditView\.vue'/)
|
||||
assert.doesNotMatch(shell, /import DigitalEmployeesView from '\.\/DigitalEmployeesView\.vue'/)
|
||||
assert.doesNotMatch(shell, /import EmployeeManagementView from '\.\/EmployeeManagementView\.vue'/)
|
||||
assert.doesNotMatch(shell, /import DocumentsCenterView from '\.\/DocumentsCenterView\.vue'/)
|
||||
assert.doesNotMatch(shell, /import BudgetCenterView from '\.\/BudgetCenterView\.vue'/)
|
||||
})
|
||||
|
||||
test('top-level app routes are eagerly imported', () => {
|
||||
assert.doesNotMatch(router, /\(\)\s*=>\s*import\(/)
|
||||
test('app view preloading is triggered from both standard and AI sidebars', () => {
|
||||
assert.match(sidebarRail, /'prefetch-view'/)
|
||||
assert.match(sidebarRail, /@mouseenter="emit\('prefetch-view', item\.id\)"/)
|
||||
assert.match(sidebarRail, /@focus="emit\('prefetch-view', item\.id\)"/)
|
||||
assert.match(aiSidebarRail, /'prefetch-view'/)
|
||||
assert.match(aiSidebarRail, /@mouseenter="emit\('prefetch-view', item\.id\)"/)
|
||||
assert.match(aiSidebarRail, /@focus="emit\('prefetch-view', item\.id\)"/)
|
||||
})
|
||||
|
||||
test('async app view loader keeps transitions nonblocking and visible', () => {
|
||||
const asyncViews = readFileSync(
|
||||
fileURLToPath(new URL('../src/views/scripts/appShellAsyncViews.js', import.meta.url)),
|
||||
'utf8'
|
||||
)
|
||||
const loadingState = readFileSync(
|
||||
fileURLToPath(new URL('../src/components/shared/AppViewLoadingState.vue', import.meta.url)),
|
||||
'utf8'
|
||||
)
|
||||
const modalLoadingState = readFileSync(
|
||||
fileURLToPath(new URL('../src/components/shared/AppModalLoadingState.vue', import.meta.url)),
|
||||
'utf8'
|
||||
)
|
||||
|
||||
assert.match(asyncViews, /defineAsyncComponent/)
|
||||
assert.match(asyncViews, /loadingComponent:\s*options\.loadingComponent \|\| AppViewLoadingState/)
|
||||
assert.match(asyncViews, /loadingComponent:\s*AppModalLoadingState/)
|
||||
assert.match(asyncViews, /suspensible:\s*false/)
|
||||
assert.match(asyncViews, /requestIdleCallback/)
|
||||
assert.match(loadingState, /正在加载页面内容/)
|
||||
assert.match(loadingState, /app-view-loading-skeleton/)
|
||||
assert.match(modalLoadingState, /Teleport to="body"/)
|
||||
assert.match(modalLoadingState, /正在打开智能工作台/)
|
||||
})
|
||||
|
||||
test('top-level shell routes stay eager so the layout does not blank during navigation', () => {
|
||||
assert.doesNotMatch(router, /component:\s*\(\)\s*=>\s*import\(\s*'\.\.\/views\/AppShellRouteView\.vue'/)
|
||||
assert.match(router, /import AppShellRouteView from '\.\.\/views\/AppShellRouteView\.vue'/)
|
||||
assert.match(router, /import LoginRouteView from '\.\.\/views\/LoginRouteView\.vue'/)
|
||||
assert.match(router, /import SetupRouteView from '\.\.\/views\/SetupRouteView\.vue'/)
|
||||
|
||||
Reference in New Issue
Block a user