diff --git a/projects/planner/src/app/app-settings/app-settings.component.spec.ts b/projects/planner/src/app/app-settings/app-settings.component.spec.ts index 07f56b01..7c7be4eb 100644 --- a/projects/planner/src/app/app-settings/app-settings.component.spec.ts +++ b/projects/planner/src/app/app-settings/app-settings.component.spec.ts @@ -17,6 +17,7 @@ import { PreferencesStore } from '../shared/preferencesStore'; import { ViewSwitchService } from '../shared/viewSwitchService'; import { ReloadDispatcher } from '../shared/reloadDispatcher'; import { DiveSchedules } from '../shared/dive.schedules'; +import { ApplicationSettingsService } from '../shared/ApplicationSettings'; export class AppSettingsPage { constructor(private fixture: ComponentFixture) { } @@ -44,6 +45,7 @@ describe('App settings component', () => { PreferencesStore, Preferences, PlannerService, WorkersFactoryCommon, ViewSwitchService, ReloadDispatcher, + ApplicationSettingsService ] }).compileComponents(); }); @@ -65,6 +67,10 @@ describe('App settings component', () => { options = schedules.selected.optionsService; }); + it('Converts Gas density', () => { + expect(component.appSettings.maxGasDensity).toBeCloseTo(0.35584, 4); + }); + it('Rounds END', () => { expect(options.maxEND).toBeCloseTo(98, 4); }); diff --git a/projects/planner/src/app/app-settings/app-settings.component.ts b/projects/planner/src/app/app-settings/app-settings.component.ts index eae1ac4a..a43a7c04 100644 --- a/projects/planner/src/app/app-settings/app-settings.component.ts +++ b/projects/planner/src/app/app-settings/app-settings.component.ts @@ -9,8 +9,8 @@ import { OptionsService } from '../shared/options.service'; import { SettingsNormalizationService } from '../shared/settings-normalization.service'; import { UnitConversion } from '../shared/UnitConversion'; import { SubViewStorage } from '../shared/subViewStorage'; -import { DiverOptions } from '../shared/models'; -import {DiveSchedules} from '../shared/dive.schedules'; +import { DiveSchedules } from '../shared/dive.schedules'; +import { ApplicationSettingsService } from '../shared/ApplicationSettings'; @Component({ selector: 'app-app-settings', @@ -28,18 +28,14 @@ export class AppSettingsComponent implements OnInit { constructor( public units: UnitConversion, private settingsNormalization: SettingsNormalizationService, - private formBuilder: NonNullableFormBuilder, - private cd: ChangeDetectorRef, private schedules: DiveSchedules, private views: SubViewStorage, + public appSettings: ApplicationSettingsService, + private formBuilder: NonNullableFormBuilder, + private cd: ChangeDetectorRef, public location: Location) { } - // consider use to all dives not only to currently selected - private get selectedOptions(): OptionsService { - return this.schedules.selected.optionsService; - } - public ngOnInit(): void { this.settingsForm = this.formBuilder.group({ imperialUnits: [this.units.imperialUnits, [Validators.required]]