Fix removed test

This commit is contained in:
shamoon 2024-09-23 11:25:04 -07:00
parent ca31c029e8
commit a40cf3ed73
2 changed files with 36 additions and 52 deletions

View File

@ -5,8 +5,7 @@ import {
Output, Output,
ViewChild, ViewChild,
} from '@angular/core' } from '@angular/core'
import { NgbDropdown, NgbDropdownToggle } from '@ng-bootstrap/ng-bootstrap' import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'
import { Options } from '@popperjs/core'
import { Subject, first, takeUntil } from 'rxjs' import { Subject, first, takeUntil } from 'rxjs'
import { CustomField, CustomFieldDataType } from 'src/app/data/custom-field' import { CustomField, CustomFieldDataType } from 'src/app/data/custom-field'
import { import {

View File

@ -17,7 +17,7 @@ import {
NgbDropdownItem, NgbDropdownItem,
NgbTypeaheadModule, NgbTypeaheadModule,
} from '@ng-bootstrap/ng-bootstrap' } from '@ng-bootstrap/ng-bootstrap'
import { NgSelectComponent } from '@ng-select/ng-select' import { NgSelectComponent, NgSelectModule } from '@ng-select/ng-select'
import { of, throwError } from 'rxjs' import { of, throwError } from 'rxjs'
import { import {
FILTER_TITLE, FILTER_TITLE,
@ -198,6 +198,7 @@ describe('FilterEditorComponent', () => {
NgbDatepickerModule, NgbDatepickerModule,
NgxBootstrapIconsModule.pick(allIcons), NgxBootstrapIconsModule.pick(allIcons),
NgbTypeaheadModule, NgbTypeaheadModule,
NgSelectModule,
], ],
providers: [ providers: [
FilterPipe, FilterPipe,
@ -846,7 +847,7 @@ describe('FilterEditorComponent', () => {
] ]
})) }))
it('should ingest filter rules for has all custom fields', fakeAsync(() => { it('should ingest filter rules for custom fields all', fakeAsync(() => {
expect(component.customFieldQueriesModel.isEmpty()).toBeTruthy() expect(component.customFieldQueriesModel.isEmpty()).toBeTruthy()
component.filterRules = [ component.filterRules = [
{ {
@ -1433,54 +1434,38 @@ describe('FilterEditorComponent', () => {
})) }))
it('should convert user input to correct filter rules on custom field selections', fakeAsync(() => { it('should convert user input to correct filter rules on custom field selections', fakeAsync(() => {
// const customFieldsFilterableDropdown = fixture.debugElement.queryAll( const customFieldsQueryDropdown = fixture.debugElement.queryAll(
// By.directive(FilterableDropdownComponent) By.directive(CustomFieldsQueryDropdownComponent)
// )[4] // CF dropdown )[0]
// customFieldsFilterableDropdown.triggerEventHandler('opened') const customFieldToggleButton = customFieldsQueryDropdown.query(
// const customFieldButtons = customFieldsFilterableDropdown.queryAll( By.css('button')
// By.directive(ToggleableDropdownButtonComponent) )
// ) customFieldToggleButton.triggerEventHandler('click')
// customFieldButtons[1].triggerEventHandler('toggle') fixture.detectChanges()
// customFieldButtons[2].triggerEventHandler('toggle') const customFieldButtons = customFieldsQueryDropdown.queryAll(
// fixture.detectChanges() By.css('button')
// expect(component.filterRules).toEqual([ )
// { customFieldButtons[1].triggerEventHandler('click')
// rule_type: FILTER_HAS_CUSTOM_FIELDS_ALL, fixture.detectChanges()
// value: custom_fields[0].id.toString(), const query = component.customFieldQueriesModel
// }, .queries[0] as CustomFieldQueryAtom
// { query.field = custom_fields[0].id
// rule_type: FILTER_HAS_CUSTOM_FIELDS_ALL, const fieldSelect: NgSelectComponent = customFieldsQueryDropdown.queryAll(
// value: custom_fields[1].id.toString(), By.directive(NgSelectComponent)
// }, )[0].componentInstance
// ]) fieldSelect.open()
// const toggleOperatorButtons = customFieldsFilterableDropdown.queryAll( const options = customFieldsQueryDropdown.queryAll(By.css('.ng-option'))
// By.css('input[type=radio]') options[0].nativeElement.click()
// ) expect(component.customFieldQueriesModel.queries[0].value.length).toEqual(1)
// toggleOperatorButtons[1].nativeElement.checked = true expect(component.filterRules).toEqual([
// toggleOperatorButtons[1].triggerEventHandler('change') {
// fixture.detectChanges() rule_type: FILTER_CUSTOM_FIELDS_LOOKUP,
// expect(component.filterRules).toEqual([ value: JSON.stringify([
// { CustomFieldQueryLogicalOperator.Or,
// rule_type: FILTER_HAS_CUSTOM_FIELDS_ANY, [[custom_fields[0].id, 'exists', 'true']],
// value: custom_fields[0].id.toString(), ]),
// }, },
// { ])
// rule_type: FILTER_HAS_CUSTOM_FIELDS_ANY,
// value: custom_fields[1].id.toString(),
// },
// ])
// customFieldButtons[2].triggerEventHandler('exclude')
// fixture.detectChanges()
// expect(component.filterRules).toEqual([
// {
// rule_type: FILTER_HAS_CUSTOM_FIELDS_ALL,
// value: custom_fields[0].id.toString(),
// },
// {
// rule_type: FILTER_DOES_NOT_HAVE_CUSTOM_FIELDS,
// value: custom_fields[1].id.toString(),
// },
// ])
})) }))
it('should convert user input to correct filter rules on date created after', fakeAsync(() => { it('should convert user input to correct filter rules on date created after', fakeAsync(() => {