You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
jest . mock ( '@/api/budget/departmentSubmission.js' , ( ) => ( { } ) )
import BudgetSubmissionForm from '@/views/budget/collection/components/BudgetSubmissionForm.vue'
describe ( 'BudgetSubmissionForm attachment removal' , ( ) => {
const removedFile = { uid : 1 , fileId : 101 }
const remainingFile = { uid : 2 , fileId : 102 }
it ( 'uses Element UI’ s post-removal list for economic-item attachments' , ( ) => {
const row = { fileList : [ removedFile , remainingFile ] }
const remainingFiles = [ remainingFile ]
BudgetSubmissionForm . methods . handleUploadRemove ( removedFile , remainingFiles , row )
expect ( row . fileList ) . toEqual ( [ remainingFile ] )
expect ( row . fileList ) . not . toBe ( remainingFiles )
} )
it ( 'uses Element UI’ s post-removal list for general attachments' , ( ) => {
const context = {
formData : {
generalFiles : [ removedFile , remainingFile ]
}
}
const remainingFiles = [ remainingFile ]
BudgetSubmissionForm . methods . handleGeneralUploadRemove . call ( context , removedFile , remainingFiles )
expect ( context . formData . generalFiles ) . toEqual ( [ remainingFile ] )
expect ( context . formData . generalFiles ) . not . toBe ( remainingFiles )
} )
} )