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.
41 lines
1.6 KiB
41 lines
1.6 KiB
import FlowCreate from '@/views/flow/create.vue'
|
|
import FlowDetail from '@/views/flow/detailCommon.vue'
|
|
import FlowLogReorderDialog from '@/views/flow/components/FlowLogReorderDialog.vue'
|
|
|
|
describe('flow record reorder UI', () => {
|
|
it('keeps sorting out of the record edit form and exposes the independent reorder flow', () => {
|
|
const state = FlowCreate.data()
|
|
|
|
expect(state.editFlowLogForm.sort).toBeUndefined()
|
|
expect(state.isShowReorderFlowLog).toBe(false)
|
|
expect(typeof FlowCreate.methods.openReorderFlowLogDialog).toBe('function')
|
|
expect(typeof FlowCreate.methods.submitReorderFlowLog).toBe('function')
|
|
expect(typeof FlowCreate.methods.validateCurrentFlowLogOrder).toBe('function')
|
|
})
|
|
|
|
it('exposes the same restricted reorder dialog on the flow detail page', () => {
|
|
const state = FlowDetail.data()
|
|
|
|
expect(state.isShowReorderFlowLog).toBe(false)
|
|
expect(FlowDetail.components.FlowLogReorderDialog).toBe(FlowLogReorderDialog)
|
|
expect(typeof FlowLogReorderDialog.methods.validatePersistedOrder).toBe('function')
|
|
})
|
|
|
|
it('allows warning-only reorder submissions without a required reason', async () => {
|
|
const confirm = jest.fn(() => Promise.reject(new Error('stop after confirm')))
|
|
const context = {
|
|
validateOrder: jest.fn(() => Promise.resolve()),
|
|
errorCount: 0,
|
|
warningCount: 1,
|
|
reason: '',
|
|
changedCount: 1,
|
|
$confirm: confirm,
|
|
}
|
|
|
|
await FlowLogReorderDialog.methods.save.call(context)
|
|
|
|
expect(context.validateOrder).toHaveBeenCalled()
|
|
expect(confirm).toHaveBeenCalled()
|
|
})
|
|
})
|