Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,14 @@ describe('IntacctC1ImportSettingsComponent', () => {
expect((component.importSettingsForm.get('expenseFields') as FormArray).length).toBe(initialLength + 1);
});

it('closeModel should reset customFieldForm and close dialog', () => {
it('closeModel should close the dialog and reset the form and the source field', () => {
component.customFieldForm.patchValue({ attribute_type: 'TEST' });
component.customFieldControl = component['createFormGroup'](blankMapping);
component.showDialog = true;

component.closeModel();

expect(component.customFieldControl.get('source_field')?.value).toBeNull();
expect(component.customFieldForm.value).toEqual({ attribute_type: null, display_name: null, source_placeholder: null });
expect(component.showDialog).toBeFalse();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { TrackingService } from 'src/app/core/services/integration/tracking.serv
import { IntegrationsToastService } from 'src/app/core/services/common/integrations-toast.service';
import { StorageService } from 'src/app/core/services/common/storage.service';
import { SiWorkspaceService } from 'src/app/core/services/si/si-core/si-workspace.service';
import { configuration, costCodeFieldValue, costTypeFieldValue, customField, customFieldValue, fyleFields, groupedDestinationAttributes, importSettings, importSettingsWithProjectMapping, intacctImportCodeConfig, locationEntityMapping, sageIntacctFields, sageIntacctFieldsSortedByPriority, settingsWithDependentFields } from '../../intacct.fixture';
import { blankMapping, configuration, costCodeFieldValue, costTypeFieldValue, customField, customFieldValue, fyleFields, groupedDestinationAttributes, importSettings, importSettingsWithProjectMapping, intacctImportCodeConfig, locationEntityMapping, sageIntacctFields, sageIntacctFieldsSortedByPriority, settingsWithDependentFields } from '../../intacct.fixture';
import { IntacctCategoryDestination, IntacctOnboardingState, IntacctUpdateEvent, MappingSourceField, Page, ProgressPhase, SageIntacctField, ToastSeverity, TrackingApp } from 'src/app/core/models/enum/enum.model';
import { SharedModule } from 'src/app/shared/shared.module';
import { Org } from 'src/app/core/models/org/org.model';
Expand Down Expand Up @@ -485,14 +485,16 @@ describe('IntacctImportSettingsComponent', () => {
expect(component.expenseFieldsGetter.length).toBe(initialLength + 1);
});

it('closeModel should reset form and close dialog', () => {
it('closeModel should close the dialog and reset the form and the source field', () => {
component.customFieldForm = component['formBuilder'].group({
testField: ['value']
});
component.customFieldControl = component['createFormGroup'](blankMapping);
component.showDialog = true;

component.closeModel();

expect(component.customFieldControl.get('source_field')?.value).toBeNull();
expect(component.customFieldForm.get('testField')?.value).toBeNull();
expect(component.showDialog).toBeFalse();
});
Expand Down
Loading