[GIT] Evergreen ILS branch rel_3_15 updated. 478fbdeaaef7ca702591942c21146d0c897b9b2b

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Evergreen ILS". The branch, rel_3_15 has been updated via 478fbdeaaef7ca702591942c21146d0c897b9b2b (commit) via 77c557fa50461dbcbf3daf94cf97d151319816a4 (commit) from f447945075813ce333b89dc86e0fa8f2bc0f9522 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 478fbdeaaef7ca702591942c21146d0c897b9b2b Author: Jane Sandberg <js7389@princeton.edu> Date: Mon Jun 2 11:57:07 2025 -0700 LP2111731: Fix test that failed on Firefox We need a setTimeout in order to set the focus correctly on Firefox. Release-note: Allow angular unit tests to run without OpenSRF installed. Co-authored-by: Ruth Frasur Davis <rfrasur@gmail.com> Co-authored-by: Stephanie Leary <stephanie.leary@equinoxoli.org> Co-authored-by: Steven Mayo <smayo@georgialibraries.org> Co-authored-by: Michele Morgan <mmorgan@noblenet.org> Co-authored-by: Dan Guarracino <dguarracino@owwl.org> Co-authored-by: Shula Link <slink@gchrl.org> Signed-off-by: Jane Sandberg <js7389@princeton.edu> Signed-off-by: Stephanie Leary <stephanie.leary@equinoxoli.org> Signed-off-by: Michele Morgan <mmorgan@noblenet.org> diff --git a/Open-ILS/src/eg2/src/app/share/util/credential-input.component.spec.ts b/Open-ILS/src/eg2/src/app/share/util/credential-input.component.spec.ts index 3d80fa60ca..087dad653c 100644 --- a/Open-ILS/src/eg2/src/app/share/util/credential-input.component.spec.ts +++ b/Open-ILS/src/eg2/src/app/share/util/credential-input.component.spec.ts @@ -1,4 +1,4 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing'; import { CredentialInputComponent } from './credential-input.component'; @@ -41,13 +41,14 @@ describe('CredentialInputComponent', () => { expect(fixture.nativeElement.querySelector('button').getAttribute('aria-label')).toEqual('Hide Password'); expect(fixture.nativeElement.querySelector('span').innerText).toEqual('visibility'); }); - it('toggling the visibility sets focus back to the input', () => { + it('toggling the visibility sets focus back to the input', fakeAsync(() => { fixture.nativeElement.querySelector('button').click(); fixture.detectChanges(); const input = fixture.nativeElement.querySelector('input'); - const focusElement = fixture.nativeElement.querySelector(':focus'); - expect(focusElement).toBe(input); - }); + tick(1); + const focusElement = document.activeElement; + expect(focusElement).toEqual(input); + })); it('can toggle the visibility off again', () => { fixture.nativeElement.querySelector('button').click(); fixture.nativeElement.querySelector('button').click(); diff --git a/Open-ILS/src/eg2/src/app/share/util/credential-input.component.ts b/Open-ILS/src/eg2/src/app/share/util/credential-input.component.ts index eca9e726b6..6a09831c16 100644 --- a/Open-ILS/src/eg2/src/app/share/util/credential-input.component.ts +++ b/Open-ILS/src/eg2/src/app/share/util/credential-input.component.ts @@ -29,7 +29,7 @@ export class CredentialInputComponent implements ControlValueAccessor { } else { this.ariaDescription = $localize`Your password is not visible.`; } - this.passwordInput.nativeElement.focus(); + setTimeout(() => this.passwordInput.nativeElement.focus()); } writeValue(value: any): void { this.passwordInput.nativeElement.value = value; commit 77c557fa50461dbcbf3daf94cf97d151319816a4 Author: Jane Sandberg <sandbergja@gmail.com> Date: Mon May 26 07:36:16 2025 -0700 LP2111731: Allow angular unit tests to run without OpenSRF installed Prior to this commit, the Angular unit test infrastructure assumed that there was a file /openils/lib/javascript/opensrf.js on the same system that provided the name of a timezone as OpenSRF.tz. This meant that in order to run angular unit tests, you needed to first install OpenSRF (or at least copy that specific file onto your system at the correct path). This commit uses Angular's dependency injection features to decouple the tests from that specific file. We still consult OpenSRF for the timezone in production, but for the tests we hardcode a specific timezone. Also, since it was already mucking around with the FormatService's dependencies, this commit also removes an unused dependency on the AuthService. Signed-off-by: Jane Sandberg <sandbergja@gmail.com> Signed-off-by: Stephanie Leary <stephanie.leary@equinoxoli.org> Signed-off-by: Michele Morgan <mmorgan@noblenet.org> diff --git a/Open-ILS/src/eg2/karma.conf.js b/Open-ILS/src/eg2/karma.conf.js index b6a17546ba..491a28443e 100644 --- a/Open-ILS/src/eg2/karma.conf.js +++ b/Open-ILS/src/eg2/karma.conf.js @@ -47,7 +47,6 @@ module.exports = function (config) { files: [ '/openils/lib/javascript/md5.js', '/openils/lib/javascript/JSON_v1.js', - '/openils/lib/javascript/opensrf.js', '/openils/lib/javascript/opensrf_ws.js', // mock data for testing only 'src/test_data/IDL2js.js', diff --git a/Open-ILS/src/eg2/src/app/core/format.service.ts b/Open-ILS/src/eg2/src/app/core/format.service.ts index 9b5fb07c83..7560905103 100644 --- a/Open-ILS/src/eg2/src/app/core/format.service.ts +++ b/Open-ILS/src/eg2/src/app/core/format.service.ts @@ -1,9 +1,8 @@ /* eslint-disable no-case-declarations, no-magic-numbers */ -import {Injectable, Pipe, PipeTransform} from '@angular/core'; +import {inject, Injectable, InjectionToken, Pipe, PipeTransform} from '@angular/core'; import {DatePipe, DecimalPipe, getLocaleDateFormat, getLocaleTimeFormat, getLocaleDateTimeFormat, FormatWidth} from '@angular/common'; import {IdlService, IdlObject} from '@eg/core/idl.service'; import {OrgService} from '@eg/core/org.service'; -import {AuthService} from '@eg/core/auth.service'; import {PcrudService} from '@eg/core/pcrud.service'; import {LocaleService} from '@eg/core/locale.service'; import * as moment from 'moment-timezone'; @@ -13,6 +12,7 @@ import {DateUtil} from '@eg/share/util/date'; * Format IDL vield values for display. */ +export const WS_ORG_TIMEZONE = new InjectionToken<string>('timezone from OpenSRF', {factory: () => OpenSRF.tz }); declare var OpenSRF; // eslint-disable-line no-var export interface FormatParams { @@ -31,7 +31,7 @@ export class FormatService { dateFormat = 'shortDate'; dateTimeFormat = 'short'; - wsOrgTimezone: string = OpenSRF.tz; + wsOrgTimezone: string = inject(WS_ORG_TIMEZONE); tzCache: {[orgId: number]: string} = {}; constructor( @@ -39,7 +39,6 @@ export class FormatService { private decimalPipe: DecimalPipe, private idl: IdlService, private org: OrgService, - private auth: AuthService, private locale: LocaleService ) { diff --git a/Open-ILS/src/eg2/src/app/core/format.spec.ts b/Open-ILS/src/eg2/src/app/core/format.spec.ts index d75c3bb8ce..585fb4990a 100644 --- a/Open-ILS/src/eg2/src/app/core/format.spec.ts +++ b/Open-ILS/src/eg2/src/app/core/format.spec.ts @@ -8,12 +8,13 @@ import {PcrudService} from './pcrud.service'; import {StoreService} from './store.service'; import {OrgService} from './org.service'; import {LocaleService} from './locale.service'; -import {FormatService} from './format.service'; +import {FormatService, WS_ORG_TIMEZONE} from './format.service'; import {HatchService} from './hatch.service'; import {SpyLocation} from '@angular/common/testing'; import localeArJO from '@angular/common/locales/ar-JO'; import localeCs from '@angular/common/locales/cs'; import localeFrCA from '@angular/common/locales/fr-CA'; +import { TestBed } from '@angular/core/testing'; describe('FormatService', () => { @@ -46,14 +47,17 @@ describe('FormatService', () => { dbStoreService = new DbStoreService(); orgService = new OrgService(dbStoreService, netService, authService, pcrudService); localeService = new LocaleService(location, null, pcrudService); - service = new FormatService( - datePipe, - decimalPipe, - idlService, - orgService, - authService, - localeService - ); + TestBed.configureTestingModule({ + providers: [ + {provide: DatePipe, useValue: datePipe}, + {provide: DecimalPipe, useValue: decimalPipe}, + {provide: IdlService, useValue: idlService}, + {provide: OrgService, useValue: orgService}, + {provide: LocaleService, useValue: localeService}, + {provide: WS_ORG_TIMEZONE, useValue: 'America/Chicago'}, + ] + }); + service = TestBed.inject(FormatService); }); const initTestData = () => { @@ -75,7 +79,7 @@ describe('FormatService', () => { it('should format a date', () => { initTestData(); const str = service.transform({ - value: new Date(2018, 6, 5), + value: Date.parse('2018-07-05T12:30:01.000-05:00'), datatype: 'timestamp', }); expect(str).toBe('7/5/18'); @@ -84,7 +88,7 @@ describe('FormatService', () => { it('should format a date plus time', () => { initTestData(); const str = service.transform({ - value: new Date(2018, 6, 5, 12, 30, 1), + value: Date.parse('2018-07-05T12:30:01.000-05:00'), datatype: 'timestamp', datePlusTime: true }); ----------------------------------------------------------------------- Summary of changes: Open-ILS/src/eg2/karma.conf.js | 1 - Open-ILS/src/eg2/src/app/core/format.service.ts | 7 +++--- Open-ILS/src/eg2/src/app/core/format.spec.ts | 26 +++++++++++++--------- .../share/util/credential-input.component.spec.ts | 11 ++++----- .../app/share/util/credential-input.component.ts | 2 +- 5 files changed, 25 insertions(+), 22 deletions(-) hooks/post-receive -- Evergreen ILS
participants (1)
-
Git User