Skip to content

Commit

Permalink
cleanup for PR
Browse files Browse the repository at this point in the history
  • Loading branch information
rmroot committed Nov 20, 2024
1 parent eb2c755 commit f7bac3c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,17 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';

import { SetupWizardHelpPanelComponent } from './setup-wizard-help-panel.component';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { LocalStorageService } from 'ngx-webstorage';
import { stubServiceProviders } from 'src/app/spec-helpers/spec-test-service-stub';

describe('SetupWizardHelpPanelComponent', () => {
let component: SetupWizardHelpPanelComponent;
let fixture: ComponentFixture<SetupWizardHelpPanelComponent>;
let localStorageService: Partial<LocalStorageService> = {
retrieve: () => { return undefined },
store: () => { return undefined },
};

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [FontAwesomeModule],
declarations: [SetupWizardHelpPanelComponent],
providers: [
{ provide: LocalStorageService, useValue: localStorageService }
]
providers: stubServiceProviders
})
.compileComponents();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Component, EventEmitter, Output } from '@angular/core';
import { NavigationEnd, Router } from '@angular/router';
import { faCircleQuestion, IconDefinition } from '@fortawesome/free-solid-svg-icons';
import { HelpContext } from './HelpContext';
import { LocalStorageDataService } from 'src/app/shared/shared-services/local-storage-data.service';
import { Subscription } from 'rxjs';
import { SetupWizardService } from '../setup-wizard.service';

Expand All @@ -23,7 +22,7 @@ export class SetupWizardHelpPanelComponent {
helpPanelOpenSub: Subscription;
helpPanelOpen: boolean;

constructor(private router: Router, private localStorageDataService: LocalStorageDataService,
constructor(private router: Router,
private setupWizardService: SetupWizardService
) {

Expand All @@ -42,7 +41,6 @@ export class SetupWizardHelpPanelComponent {
window.dispatchEvent(new Event("resize"));
}, 100)
});
// this.collapseHelpPanel = this.localStorageDataService.setupHelpPanelCollapsed;
this.setHelpContext(this.router.url);
}

Expand All @@ -53,12 +51,6 @@ export class SetupWizardHelpPanelComponent {

toggleCollapseHelpPanel() {
this.emitToggleCollapse.emit(!this.helpPanelOpen);
// this.collapseHelpPanel = !this.collapseHelpPanel;
// this.localStorageDataService.setSetupPanelCollapsed(this.collapseHelpPanel);
//needed to resize charts
// setTimeout(() => {
// window.dispatchEvent(new Event("resize"));
// }, 100)
}

setHelpContext(url: string) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/setup-wizard/setup-wizard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { SharedDataService } from '../shared/shared-services/shared-data.service
import { Subscription } from 'rxjs';
import { ContactContext, IdbContact } from '../models/contact';
import { SetupWizardService } from './setup-wizard.service';
import { faGripLinesVertical, faGripVertical, IconDefinition } from '@fortawesome/free-solid-svg-icons';
import { faGripLinesVertical, IconDefinition } from '@fortawesome/free-solid-svg-icons';

@Component({
selector: 'app-setup-wizard',
Expand Down
8 changes: 7 additions & 1 deletion src/app/spec-helpers/spec-test-service-stub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { KeyPerformanceIndicatorOption } from "../shared/constants/keyPerformanc
import { SharedDataService } from "../shared/shared-services/shared-data.service";
import { CompanyContactsFormService } from "../shared/shared-company-forms/company-contacts-form/company-contacts-form.service";
import { FormControl, FormGroup } from "@angular/forms";
import { LocalStorageService } from "ngx-webstorage";

let stubCompany: IdbCompany = getNewIdbCompany('123');
stubCompany.guid = '123';
Expand Down Expand Up @@ -160,6 +161,11 @@ let companyContactsFormService: Partial<CompanyContactsFormService> = {
}
}

let localStorageService: Partial<LocalStorageService> = {
retrieve: () => { return undefined },
store: () => { return undefined },
};

export const stubServiceProviders: Array<{ provide: any, useValue: any }> = [
{ provide: CompanyIdbService, useValue: companyIdbService },
{ provide: FacilityIdbService, useValue: facilityIdbService },
Expand All @@ -174,7 +180,7 @@ export const stubServiceProviders: Array<{ provide: any, useValue: any }> = [
{ provide: EnergyEquipmentIdbService, useValue: energyEquipmentIdbService },
{ provide: ProcessEquipmentIdbService, useValue: processEquipmentIdbService },
{ provide: KeyPerformanceMetricImpactsIdbService, useValue: keyPerformanceMetricImpactIdbService },
{ provide: LocalStorageDataService, useValue: {} },
{ provide: LocalStorageDataService, useValue: localStorageService },
{ provide: SharedDataService, useValue: sharedDataService },
{ provide: CompanyContactsFormService, useValue: companyContactsFormService },
{
Expand Down

0 comments on commit f7bac3c

Please sign in to comment.