From: Jane Sandberg Date: Wed, 17 May 2023 23:39:21 +0000 (-0700) Subject: LP1754364-wip X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0a6b23f418341c9bc06d118bf3b68e897251e0bf;p=working%2FEvergreen.git LP1754364-wip Signed-off-by: Jane Sandberg --- diff --git a/Open-ILS/src/eg2/src/app/share/util/timezone.spec.ts b/Open-ILS/src/eg2/src/app/share/util/timezone.spec.ts new file mode 100644 index 0000000000..419b6368c6 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/share/util/timezone.spec.ts @@ -0,0 +1,11 @@ +import { Timezone } from "./timezone"; + +fdescribe('timezone utility', () => { + it('includes valid timezones', () => { + expect(new Timezone().values()).toContain('America/Chicago'); + expect(new Timezone().values()).toContain('America/New_York'); + }); + it('does not include invalid timezones', () => { + expect(new Timezone().values()).not.toContain('MARGARITA TIME!!!'); + }); +}); diff --git a/Open-ILS/src/eg2/src/app/share/util/timezone.ts b/Open-ILS/src/eg2/src/app/share/util/timezone.ts new file mode 100644 index 0000000000..5c0bb900ae --- /dev/null +++ b/Open-ILS/src/eg2/src/app/share/util/timezone.ts @@ -0,0 +1,7 @@ +import * as moment from "moment"; + +export class Timezone { + values() { + return moment.tz.names(); + } +} diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/org-unit-settings/edit-org-unit-setting-dialog.component.spec.ts b/Open-ILS/src/eg2/src/app/staff/admin/local/org-unit-settings/edit-org-unit-setting-dialog.component.spec.ts new file mode 100644 index 0000000000..c14990092a --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/org-unit-settings/edit-org-unit-setting-dialog.component.spec.ts @@ -0,0 +1,23 @@ +import { NgbModal } from "@ng-bootstrap/ng-bootstrap"; +import { EditOuSettingDialogComponent } from "./edit-org-unit-setting-dialog.component"; + +const mockNgbModal = jasmine.createSpyObj(['open']); +let component: EditOuSettingDialogComponent; + +fdescribe('EditOuSettingDialogComponent', () => { + beforeEach(() => { + component = new EditOuSettingDialogComponent(mockNgbModal); + }) + describe('inputType()', () => { + it('gets its value from the entry dataType', () => { + component.entry = {dataType: 'bool'} + expect(component.inputType()).toEqual('bool'); + }); + }); + describe('inputType()', () => { + it('returns timezone if the setting name is lib.timezone', () => { + component.entry = {dataType: 'string', name: 'lib.timezone'} + expect(component.inputType()).toEqual('timezone'); + }); + }); +}) diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/org-unit-settings/edit-org-unit-setting-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/local/org-unit-settings/edit-org-unit-setting-dialog.component.ts index 13ef1799a8..0dd43bb1d3 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/org-unit-settings/edit-org-unit-setting-dialog.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/org-unit-settings/edit-org-unit-setting-dialog.component.ts @@ -28,6 +28,9 @@ export class EditOuSettingDialogComponent extends DialogComponent { } inputType() { + if (this.entry.name === 'lib.timezone') { + return 'timezone'; + } return this.entry.dataType; }