mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-11 09:07:18 +01:00
Fix: track and restore changed document fields from session storage (#10468)
This commit is contained in:
parent
5e7ee924ff
commit
4637f5c5e5
5 changed files with 54 additions and 5 deletions
|
|
@ -1030,6 +1030,22 @@ describe('DocumentDetailComponent', () => {
|
|||
})
|
||||
})
|
||||
|
||||
it('should restore changed fields and mark as dirty', () => {
|
||||
jest
|
||||
.spyOn(activatedRoute, 'paramMap', 'get')
|
||||
.mockReturnValue(of(convertToParamMap({ id: 3, section: 'details' })))
|
||||
jest.spyOn(documentService, 'get').mockReturnValueOnce(of(doc))
|
||||
const docWithChanges = Object.assign({}, doc)
|
||||
docWithChanges.__changedFields = ['title', 'tags', 'owner']
|
||||
jest
|
||||
.spyOn(openDocumentsService, 'getOpenDocument')
|
||||
.mockReturnValue(docWithChanges)
|
||||
fixture.detectChanges() // calls ngOnInit
|
||||
expect(component.documentForm.get('title').dirty).toBeTruthy()
|
||||
expect(component.documentForm.get('tags').dirty).toBeTruthy()
|
||||
expect(component.documentForm.get('permissions_form').dirty).toBeTruthy()
|
||||
})
|
||||
|
||||
it('should show custom field errors', () => {
|
||||
initNormally()
|
||||
component.error = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue