Compare commits

...
Author SHA1 Message Date
shamoon f3021c36a5 Update test to reflect new collection size 2026-11-17 02:58:38 -08:00
shamoon 54b450d69f Update test expectation for document deletion 2026-11-17 02:48:19 -08:00
shamoon 371d6041fa Remove selected size assertions from bulk editor tests 2026-11-17 02:43:28 -08:00
shamoon 0f063a0155 Update app-frame.component.ts
Only reduce selection to filter if not all documents are selected.
2026-11-17 02:17:51 -08:00
shamoon 73834aa49f Remove selectNone() calls after modal close 2026-11-17 02:16:37 -08:00
3 changed files with 5 additions and 9 deletions

No files matched your search

@@ -186,7 +186,9 @@ export class AppFrameComponent
) )
.subscribe((result) => { .subscribe((result) => {
this.documentList.reload(null, false) this.documentList.reload(null, false)
this.documentList.reduceSelectionToFilter() if (!this.documentList.allSelected) {
this.documentList.reduceSelectionToFilter()
}
// maybe someday we can optimize to only refresh affected documents // maybe someday we can optimize to only refresh affected documents
this.openDocumentsService.getOpenDocuments().forEach((doc) => { this.openDocumentsService.getOpenDocuments().forEach((doc) => {
this.openDocumentsService.refreshDocument(doc.id) this.openDocumentsService.refreshDocument(doc.id)
@@ -718,7 +718,6 @@ describe('BulkEditorComponent', () => {
'Workflow will run on the selected documents in the background.' 'Workflow will run on the selected documents in the background.'
) )
expect(toast.mock.calls.at(-1)[0].actionName).toBeUndefined() expect(toast.mock.calls.at(-1)[0].actionName).toBeUndefined()
expect(documentListViewService.selected.size).toBe(0)
httpTestingController.match( httpTestingController.match(
`${environment.apiBaseUrl}documents/?page=1&page_size=50&ordering=-created&truncate_content=true&include_selection_data=true` `${environment.apiBaseUrl}documents/?page=1&page_size=50&ordering=-created&truncate_content=true&include_selection_data=true`
) // list reload ) // list reload
@@ -1283,6 +1282,7 @@ describe('BulkEditorComponent', () => {
) // listAllFilteredIds ) // listAllFilteredIds
component.showConfirmationDialogs = false component.showConfirmationDialogs = false
documentListViewService.collectionSize = 2
fixture.detectChanges() fixture.detectChanges()
jest jest
.spyOn(documentListViewService, 'allSelected', 'get') .spyOn(documentListViewService, 'allSelected', 'get')
@@ -1293,7 +1293,7 @@ describe('BulkEditorComponent', () => {
) )
req.flush({ result: 'OK', task_id: 'delete-2' }) req.flush({ result: 'OK', task_id: 'delete-2' })
// ids aren't known when all matching documents are selected, so no undo // ids aren't known when all matching documents are selected, so no undo
expect(trackSpy).toHaveBeenLastCalledWith('delete-2', 0, null) expect(trackSpy).toHaveBeenLastCalledWith("delete-2", 2, null)
httpTestingController.match( httpTestingController.match(
`${environment.apiBaseUrl}documents/?page=1&page_size=50&ordering=-created&truncate_content=true&include_selection_data=true` `${environment.apiBaseUrl}documents/?page=1&page_size=50&ordering=-created&truncate_content=true&include_selection_data=true`
) // list reload ) // list reload
@@ -1492,7 +1492,6 @@ describe('BulkEditorComponent', () => {
httpTestingController.match( httpTestingController.match(
`${environment.apiBaseUrl}documents/?page=1&page_size=100000&fields=id` `${environment.apiBaseUrl}documents/?page=1&page_size=100000&fields=id`
) // listAllFilteredIds ) // listAllFilteredIds
expect(documentListViewService.selected.size).toEqual(0)
// Test with archiveFallback enabled // Test with archiveFallback enabled
modal.componentInstance.deleteOriginals.set(false) modal.componentInstance.deleteOriginals.set(false)
@@ -1514,7 +1513,6 @@ describe('BulkEditorComponent', () => {
httpTestingController.match( httpTestingController.match(
`${environment.apiBaseUrl}documents/?page=1&page_size=100000&fields=id` `${environment.apiBaseUrl}documents/?page=1&page_size=100000&fields=id`
) // listAllFilteredIds ) // listAllFilteredIds
expect(documentListViewService.selected.size).toEqual(0)
}) })
it('should support merging documents as versions', () => { it('should support merging documents as versions', () => {
@@ -1562,7 +1560,6 @@ describe('BulkEditorComponent', () => {
httpTestingController.match( httpTestingController.match(
`${environment.apiBaseUrl}documents/?page=1&page_size=100000&fields=id` `${environment.apiBaseUrl}documents/?page=1&page_size=100000&fields=id`
) )
expect(documentListViewService.selected.size).toEqual(0)
jest.advanceTimersByTime(400) jest.advanceTimersByTime(400)
expect(toastSpy).toHaveBeenCalledWith( expect(toastSpy).toHaveBeenCalledWith(
expect.objectContaining({ expect.objectContaining({
@@ -1717,7 +1714,6 @@ describe('BulkEditorComponent', () => {
expect(notification.actionName).toBeUndefined() expect(notification.actionName).toBeUndefined()
} }
expect(reload).not.toHaveBeenCalled() expect(reload).not.toHaveBeenCalled()
expect(documentListViewService.selected.size).toBe(0)
expect(documentListViewService.allSelected).toBe(false) expect(documentListViewService.allSelected).toBe(false)
TestBed.inject(TaskNotificationService).complete({ TestBed.inject(TaskNotificationService).complete({
task_id: 'queued-operation', task_id: 'queued-operation',
@@ -329,7 +329,6 @@ export class BulkEditorComponent
.subscribe({ .subscribe({
next: () => { next: () => {
modal.close() modal.close()
this.list.selectNone()
this.toastService.showInfo( this.toastService.showInfo(
$localize`Workflow will run on the selected documents in the background.` $localize`Workflow will run on the selected documents in the background.`
) )
@@ -366,7 +365,6 @@ export class BulkEditorComponent
) { ) {
const bulk = this.getSelectionSize() > 1 const bulk = this.getSelectionSize() > 1
modal?.close() modal?.close()
this.list.selectNone()
if (onQueued) { if (onQueued) {
onQueued(taskId) onQueued(taskId)
} else { } else {