From 1654cb3f1ec37486c0e43be76a37313b18ccb688 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue, 13 Oct 2026 13:32:12 -0700 Subject: [PATCH] Update frontend tests --- .../filter-editor.component.spec.ts | 56 +++++++++++++++---- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.spec.ts b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.spec.ts index 9bf88ae69..d7fc23959 100644 --- a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.spec.ts +++ b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.spec.ts @@ -484,6 +484,22 @@ describe('FilterEditorComponent', () => { expect(component.textFilter).toBeNull() }) + it('should ingest title filter rules alongside a fulltext query with date created', () => { + component.filterRules = [ + { + rule_type: FILTER_SIMPLE_TITLE, + value: 'foo', + }, + { + rule_type: FILTER_FULLTEXT_QUERY, + value: 'created:[-1 week to now]', + }, + ] + expect(component.dateCreatedRelativeDate).toEqual(1) // RELATIVE_DATE_QUERYSTRINGS['-1 week to now'] + expect(component.textFilter).toEqual('foo') + expect(component.textFilterTarget).toEqual('title') // TEXT_FILTER_TARGET_TITLE + }) + it('should ingest text filter rules for fulltext query that include date added', () => { expect(component.dateAddedRelativeDate).toBeNull() component.filterRules = [ @@ -1845,7 +1861,7 @@ describe('FilterEditorComponent', () => { ]) }) - it('should carry over text filtering on date created with relative date', () => { + it('should keep text filtering separate from date created relative date', () => { component.textFilter = 'foo' const dateCreatedDropdown = fixture.debugElement.queryAll( By.directive(DatesDropdownComponent) @@ -1855,14 +1871,18 @@ describe('FilterEditorComponent', () => { fixture.detectChanges() tick(400) expect(component.filterRules).toEqual([ + { + rule_type: FILTER_SIMPLE_TEXT, + value: 'foo', + }, { rule_type: FILTER_FULLTEXT_QUERY, - value: 'foo,created:[-1 week to now]', + value: 'created:[-1 week to now]', }, ]) }) - it('should carry over text filtering once with created and added relative dates', () => { + it('should keep text filtering separate from created and added relative dates', () => { component.textFilter = 'foo' const datesDropdown = fixture.debugElement.query( By.directive(DatesDropdownComponent) @@ -1873,14 +1893,18 @@ describe('FilterEditorComponent', () => { fixture.detectChanges() tick(400) expect(component.filterRules).toEqual([ + { + rule_type: FILTER_SIMPLE_TEXT, + value: 'foo', + }, { rule_type: FILTER_FULLTEXT_QUERY, - value: 'foo,created:[-1 week to now],added:[-1 month to now]', + value: 'created:[-1 week to now],added:[-1 month to now]', }, ]) }) - it('should convert legacy title filters into full text query when adding a created relative date', () => { + it('should keep legacy title filters as a title search when adding a created relative date', () => { component.filterRules = [ { rule_type: FILTER_TITLE, @@ -1895,14 +1919,18 @@ describe('FilterEditorComponent', () => { fixture.detectChanges() tick(400) expect(component.filterRules).toEqual([ + { + rule_type: FILTER_SIMPLE_TITLE, + value: 'foo', + }, { rule_type: FILTER_FULLTEXT_QUERY, - value: 'foo,created:[-1 week to now]', + value: 'created:[-1 week to now]', }, ]) }) - it('should convert simple title filters into full text query when adding a created relative date', () => { + it('should keep simple title filters as a title search when adding a created relative date', () => { component.filterRules = [ { rule_type: FILTER_SIMPLE_TITLE, @@ -1917,9 +1945,13 @@ describe('FilterEditorComponent', () => { fixture.detectChanges() tick(400) expect(component.filterRules).toEqual([ + { + rule_type: FILTER_SIMPLE_TITLE, + value: 'foo', + }, { rule_type: FILTER_FULLTEXT_QUERY, - value: 'foo,created:[-1 week to now]', + value: 'created:[-1 week to now]', }, ]) }) @@ -2005,7 +2037,7 @@ describe('FilterEditorComponent', () => { ]) }) - it('should carry over text filtering on date added with relative date', () => { + it('should keep text filtering separate from date added relative date', () => { component.textFilter = 'foo' const datesDropdown = fixture.debugElement.query( By.directive(DatesDropdownComponent) @@ -2015,9 +2047,13 @@ describe('FilterEditorComponent', () => { fixture.detectChanges() tick(400) expect(component.filterRules).toEqual([ + { + rule_type: FILTER_SIMPLE_TEXT, + value: 'foo', + }, { rule_type: FILTER_FULLTEXT_QUERY, - value: 'foo,added:[-1 week to now]', + value: 'added:[-1 week to now]', }, ]) })