mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-08-29 05:57:32 +00:00
Fix: correct sharelink bundle + document link permissions display bugs (#13827)
This commit is contained in:
@@ -151,6 +151,23 @@ describe('DocumentLinkComponent', () => {
|
||||
expect(component.selectedDocuments).toEqual([])
|
||||
})
|
||||
|
||||
it('should preserve and neutrally label unavailable document IDs', async () => {
|
||||
jest.spyOn(documentService, 'getFew').mockReturnValue(
|
||||
of({
|
||||
count: 0,
|
||||
all: [],
|
||||
results: [],
|
||||
})
|
||||
)
|
||||
|
||||
component.writeValue([99])
|
||||
await fixture.whenStable()
|
||||
|
||||
expect(component.selectedDocuments).toEqual([{ id: 99 }])
|
||||
expect(fixture.nativeElement.textContent).toContain('Unavailable')
|
||||
expect(fixture.nativeElement.textContent).not.toContain('Not found')
|
||||
})
|
||||
|
||||
it('should support unselect', () => {
|
||||
const getSpy = jest.spyOn(documentService, 'getFew')
|
||||
getSpy.mockImplementation((ids) => {
|
||||
@@ -167,6 +184,15 @@ describe('DocumentLinkComponent', () => {
|
||||
expect(component.selectedDocuments).toEqual([documents[1]])
|
||||
})
|
||||
|
||||
it('should not unselect documents when disabled', () => {
|
||||
component.disabled = true
|
||||
component.selectedDocuments = [documents[0]]
|
||||
|
||||
component.unselect(documents[0])
|
||||
|
||||
expect(component.selectedDocuments).toEqual([documents[0]])
|
||||
})
|
||||
|
||||
it('should use correct compare, trackBy functions', () => {
|
||||
expect(component.compareDocuments(documents[0], { id: 1 })).toBeTruthy()
|
||||
expect(component.compareDocuments(documents[0], { id: 2 })).toBeFalsy()
|
||||
|
||||
Reference in New Issue
Block a user