master
parent
4395c4b225
commit
26491ec83e
@ -0,0 +1,54 @@
|
|||||||
|
jest.mock('@/api/budget/budgetCollectionYear.js', () => ({}))
|
||||||
|
jest.mock('@/api/budget/leadDepartment.js', () => ({}))
|
||||||
|
jest.mock('@/views/budget/collection/components/SplitPackageForm.vue', () => ({}))
|
||||||
|
jest.mock('@/views/budget/collection/components/ProjectDetailsView.vue', () => ({}))
|
||||||
|
jest.mock('@/views/budget/collection/components/LeadDepartmentSummaryForm.vue', () => ({}))
|
||||||
|
jest.mock('@/views/budget/collection/components/BudgetSubmissionForm.vue', () => ({}))
|
||||||
|
|
||||||
|
import LeadDepartmentPage from '@/views/budget/collection/leadDepartment.vue'
|
||||||
|
|
||||||
|
function createContext() {
|
||||||
|
const methods = LeadDepartmentPage.methods
|
||||||
|
const context = {
|
||||||
|
currentSummaryPackage: null,
|
||||||
|
summaryMode: null,
|
||||||
|
summarySubmitVisible: false
|
||||||
|
}
|
||||||
|
context.getLeadSubmission = methods.getLeadSubmission.bind(context)
|
||||||
|
context.hasStartedLeadSummary = methods.hasStartedLeadSummary.bind(context)
|
||||||
|
context.getSummaryMode = methods.getSummaryMode.bind(context)
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('LeadDepartmentPage summary action', () => {
|
||||||
|
const draftSummary = {
|
||||||
|
status: 'draft',
|
||||||
|
summary_started_at: '2026-08-14 10:00:00'
|
||||||
|
}
|
||||||
|
|
||||||
|
it('opens an active-year draft summary in edit mode when labelled 修改汇总', () => {
|
||||||
|
const context = createContext()
|
||||||
|
const row = {
|
||||||
|
budget_year: { status: 'ACTIVE' },
|
||||||
|
lead_submission: draftSummary
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(LeadDepartmentPage.methods.summaryActionLabel.call(context, row)).toBe('修改汇总')
|
||||||
|
LeadDepartmentPage.methods.openSummarySubmit.call(context, row)
|
||||||
|
|
||||||
|
expect(context.summaryMode).toBe('edit')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('uses 查看汇总 rather than 修改汇总 when a draft belongs to an inactive year', () => {
|
||||||
|
const context = createContext()
|
||||||
|
const row = {
|
||||||
|
budget_year: { status: 'INACTIVE' },
|
||||||
|
lead_submission: draftSummary
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(LeadDepartmentPage.methods.summaryActionLabel.call(context, row)).toBe('查看汇总')
|
||||||
|
LeadDepartmentPage.methods.openSummarySubmit.call(context, row)
|
||||||
|
|
||||||
|
expect(context.summaryMode).toBe('view')
|
||||||
|
})
|
||||||
|
})
|
||||||
Loading…
Reference in new issue