From d407031418ba7bf797281e766229fe312ff1716d Mon Sep 17 00:00:00 2001 From: doug0102 Date: Fri, 22 Mar 2024 09:51:04 -0400 Subject: [PATCH 1/9] location form wip --- src/app/core/models/location.model.ts | 20 ++++++- src/app/core/services/event.service.ts | 10 ++-- src/app/core/services/people.service.ts | 10 ++-- .../features/calendar/calendar.component.ts | 16 ++++- src/app/features/events/models/event.ts | 14 ++--- .../event-form/event-form.component.html | 6 +- .../event-form/event-form.component.ts | 19 ++++-- .../location-form.component.html | 57 ++++++++++++++++++ .../location-form.component.scss | 49 +++++++++++++++ .../location-form.component.spec.ts | 46 ++++++++++++++ .../location-form/location-form.component.ts | 60 +++++++++++++++++++ src/app/shared/shared.module.ts | 3 + 12 files changed, 279 insertions(+), 31 deletions(-) create mode 100644 src/app/shared/components/location-form/location-form.component.html create mode 100644 src/app/shared/components/location-form/location-form.component.scss create mode 100644 src/app/shared/components/location-form/location-form.component.spec.ts create mode 100644 src/app/shared/components/location-form/location-form.component.ts diff --git a/src/app/core/models/location.model.ts b/src/app/core/models/location.model.ts index 15ea1bd6..e187e072 100644 --- a/src/app/core/models/location.model.ts +++ b/src/app/core/models/location.model.ts @@ -1,17 +1,31 @@ -export class Location { +import { ILocationForm } from "src/app/shared/components/location-form/location-form.component"; + +export class Location implements ILocationForm { address: string; + postalCode: string; city: string; province: string; country: string; - constructor(address: string, city: string, province: string, country: string = 'Canada') { + constructor(address: string, postalCode: string, city: string, province: string, country: string = 'Canada') { this.address = address; + this.postalCode = postalCode; this.city = city; this.province = province; this.country = country; } toString(): string { - return `${this.address}, ${this.city}, ${this.province}`; + return `${this.address} ${this.postalCode}, ${this.city}, ${this.province}`; + } + + toLocationForm(): ILocationForm { + return { + address: this.address, + postalCode: this.postalCode, + city: this.city, + province: this.province, + country: this.country + } } } diff --git a/src/app/core/services/event.service.ts b/src/app/core/services/event.service.ts index 550cfebb..ee601a5f 100644 --- a/src/app/core/services/event.service.ts +++ b/src/app/core/services/event.service.ts @@ -145,11 +145,11 @@ export class EventService implements IListService { private randomLocation(): Location { const addresses: Location[] = [ - new Location('2910 Woodroffe Ave', 'Ottawa', 'Ontario'), - new Location('4230 Innes Rd', 'Ottawa', 'Ontario'), - new Location('2440 Bank St', 'Ottawa', 'Ontario'), - new Location('464 Rideau St', 'Ottawa', 'Ontario'), - new Location('464 Bank St', 'Ottawa', 'Ontario'), + new Location('2910 Woodroffe Ave', 'K2C2C7', 'Ottawa', 'Ontario'), + new Location('4230 Innes Rd', 'K2C2C7', 'Ottawa', 'Ontario'), + new Location('2440 Bank St', 'K2C2C7', 'Ottawa', 'Ontario'), + new Location('464 Rideau St', 'K2C2C7', 'Ottawa', 'Ontario'), + new Location('464 Bank St', 'K2C2C7', 'Ottawa', 'Ontario'), ]; return addresses[Math.floor(Math.random() * addresses.length)]; } diff --git a/src/app/core/services/people.service.ts b/src/app/core/services/people.service.ts index f1e66746..68dc1051 100644 --- a/src/app/core/services/people.service.ts +++ b/src/app/core/services/people.service.ts @@ -110,11 +110,11 @@ export class PeopleService implements IListService { private randomAddress(): Location { const addresses: Location[] = [ - new Location('2910 Woodroffe Ave', 'Ottawa', 'Ontario'), - new Location('4230 Innes Rd', 'Ottawa', 'Ontario'), - new Location('2440 Bank St', 'Ottawa', 'Ontario'), - new Location('464 Rideau St', 'Ottawa', 'Ontario'), - new Location('464 Bank St', 'Ottawa', 'Ontario'), + new Location('2910 Woodroffe Ave', 'K2C2C7', 'Ottawa', 'Ontario'), + new Location('4230 Innes Rd', 'K2C2C7', 'Ottawa', 'Ontario'), + new Location('2440 Bank St', 'K2C2C7', 'Ottawa', 'Ontario'), + new Location('464 Rideau St', 'K2C2C7', 'Ottawa', 'Ontario'), + new Location('464 Bank St', 'K2C2C7', 'Ottawa', 'Ontario'), ]; return addresses[Math.floor(Math.random() * addresses.length)]; } diff --git a/src/app/features/calendar/calendar.component.ts b/src/app/features/calendar/calendar.component.ts index 74553241..d82d2f36 100644 --- a/src/app/features/calendar/calendar.component.ts +++ b/src/app/features/calendar/calendar.component.ts @@ -71,7 +71,13 @@ export class CalendarComponent implements OnInit, OnChanges, OnDestroy { eventName: '', eventLanguage: 'Bilingual', eventDescription: '', - eventLocation: '', + eventLocation: { + address: '', + postalCode: '', + city: '', + province: 'Ontario', + country: 'Canada' + }, eventOnlinePlatform: '', eventDuration: 'Single', eventStartDate: '', @@ -333,7 +339,13 @@ export class CalendarComponent implements OnInit, OnChanges, OnDestroy { eventName: '', eventLanguage: 'Bilingual', eventDescription: '', - eventLocation: '', + eventLocation: { + address: '', + postalCode: '', + city: '', + province: 'Ontario', + country: 'Canada' + }, eventOnlinePlatform: '', eventDuration: 'Single', eventStartDate: '', diff --git a/src/app/features/events/models/event.ts b/src/app/features/events/models/event.ts index ff1728c5..a0305a63 100644 --- a/src/app/features/events/models/event.ts +++ b/src/app/features/events/models/event.ts @@ -9,7 +9,7 @@ export class Event { title: string = ''; eventType: string = 'Hybrid'; description: string = ''; - location: Location = new Location('', '', ''); + location: Location = new Location('', '', '', ''); language: string = 'English'; tags: [string] = ['']; startDate: Date = new Date(); @@ -36,7 +36,7 @@ export class Event { eventName: this.title, eventLanguage: this.language, eventDescription: this.description, - eventLocation: this.location.toString(), + eventLocation: this.location.toLocationForm(), eventOnlinePlatform: this.onlinePlatform, eventDuration: sameDay ? 'Single' : 'Multi', eventStartDate: format(this.startDate, 'y-MM-dd'), @@ -54,10 +54,7 @@ export class Event { event.title = eventForm.eventName; event.eventType = eventForm.eventType; event.description = eventForm.eventDescription; - - const addCityProv = eventForm.eventLocation.split(','); - event.location = new Location(addCityProv[0].trim(), addCityProv[1].trim(), addCityProv[2].trim()); - + event.location = new Location(eventForm.eventLocation.address, eventForm.eventLocation.postalCode, eventForm.eventLocation.city, eventForm.eventLocation.province, eventForm.eventLocation.country); event.language = eventForm.eventLanguage; event.tags = this.tags; event.startDate = new Date([eventForm.eventStartDate, eventForm.eventStartTime].join(' ')); @@ -84,10 +81,7 @@ export class Event { event.title = eventForm.eventName; event.eventType = eventForm.eventType; event.description = eventForm.eventDescription; - - // TODO: Setup location form for use in the event form instead of a string. - event.location = new Location(eventForm.eventLocation, eventForm.eventLocation, eventForm.eventLocation); - + event.location = new Location(eventForm.eventLocation.address, eventForm.eventLocation.postalCode, eventForm.eventLocation.city, eventForm.eventLocation.province, eventForm.eventLocation.country); event.language = eventForm.eventLanguage; event.tags = ['']; event.startDate = new Date([eventForm.eventStartDate, eventForm.eventStartTime].join(' ')); diff --git a/src/app/shared/components/event-form/event-form.component.html b/src/app/shared/components/event-form/event-form.component.html index 6328b756..a81c4560 100644 --- a/src/app/shared/components/event-form/event-form.component.html +++ b/src/app/shared/components/event-form/event-form.component.html @@ -78,7 +78,9 @@ > - + + + + + + + + + + + + + + + + + diff --git a/src/app/shared/components/location-form/location-form.component.scss b/src/app/shared/components/location-form/location-form.component.scss new file mode 100644 index 00000000..9ce45514 --- /dev/null +++ b/src/app/shared/components/location-form/location-form.component.scss @@ -0,0 +1,49 @@ +@import '../../../../assets/scss/partials/colors'; + +:host { + .cover-photo-upload { + display: flex; + align-items: center; + justify-content: center; + height: 200px; + border: 2px solid $neutral-300; + border-radius: 10px; + margin-bottom: 16px; + margin-top: 5px; + } + + .cover-photo-upload.error { + border-color: $error-red; + } + + .required-star { + color: $error-red; + } + + input + app-input { + ::ng-deep { + .gcc-input-wrapper { + padding-top: 5px; + } + } + } + + mat-error { + position: absolute; + padding-left: 16px; + margin-top: -16px; + -webkit-font-smoothing: antialiased; + font-family: var(--mdc-typography-caption-font-family, var(--mdc-typography-font-family, Inter)); + font-size: var(--mdc-typography-caption-font-size, 12px); + line-height: var(--mdc-typography-caption-line-height, 20px); + font-weight: var(--mdc-typography-caption-font-weight, 400); + letter-spacing: var(--mdc-typography-caption-letter-spacing, 0.0333333333em); + -webkit-text-decoration: var(--mdc-typography-caption-text-decoration, inherit); + text-decoration: var(--mdc-typography-caption-text-decoration, inherit); + text-transform: var(--mdc-typography-caption-text-transform, none); + } + + app-editor { + padding-bottom: 16px; + } +} diff --git a/src/app/shared/components/location-form/location-form.component.spec.ts b/src/app/shared/components/location-form/location-form.component.spec.ts new file mode 100644 index 00000000..9fd4b4c1 --- /dev/null +++ b/src/app/shared/components/location-form/location-form.component.spec.ts @@ -0,0 +1,46 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { LocationFormComponent } from './location-form.component'; +import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core'; +import { HttpClient, HttpClientModule } from '@angular/common/http'; +import { TypescriptLoader } from 'src/app/core/helpers/typescript-loader'; +import { RouterTestingModule } from '@angular/router/testing'; +import { TruncateFileNamePipe } from '../../pipes/truncate-file-name/truncate-file-name.pipe'; +import { FormControlPipe } from '../../pipes/form-control/form-control.pipe'; +describe('LocationFormComponent', () => { + let component: LocationFormComponent; + let translateService: TranslateService; + let fixture: ComponentFixture; + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [LocationFormComponent, TruncateFileNamePipe, FormControlPipe], + imports: [ + TranslateModule.forRoot({ + loader: { + provide: TranslateLoader, + useFactory: (http: HttpClient) => new TypescriptLoader(http, 'translations'), + deps: [HttpClient], + }, + }), + HttpClientModule, + RouterTestingModule, + ], + providers: [TranslateService, HttpClient], + }); + fixture = TestBed.createComponent(LocationFormComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + beforeEach(() => { + translateService = TestBed.inject(TranslateService); + fixture = TestBed.createComponent(LocationFormComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/shared/components/location-form/location-form.component.ts b/src/app/shared/components/location-form/location-form.component.ts new file mode 100644 index 00000000..f82060f2 --- /dev/null +++ b/src/app/shared/components/location-form/location-form.component.ts @@ -0,0 +1,60 @@ +import { Component, Input, OnDestroy, OnInit } from '@angular/core'; +import { AbstractControl, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import { TranslateService } from '@ngx-translate/core'; +import { Translations } from 'src/app/core/services/translations.service'; + +@Component({ + selector: 'app-location-form', + templateUrl: './location-form.component.html', + styleUrls: ['./location-form.component.scss'], +}) +export class LocationFormComponent implements OnInit, OnDestroy { + @Input() form: FormGroup = new FormGroup({}); + @Input() model: ILocationForm = { + address: '', + postalCode: '', + city: 'Ottawa', + province: 'Ontario', + country: 'Canada', + }; + + constructor(public translations: Translations) {} + + ngOnInit(): void { + for (const [key, value] of Object.entries(this.model)) { + if (!this.form.controls[key]) { + if (key == 'postalCode') { + this.form.addControl(key, new FormControl(value, [Validators.required, Validators.minLength(6), Validators.maxLength(7), this.postalCodeValidator()])); + } + else { + this.form.addControl(key, new FormControl(value, [Validators.required, Validators.minLength(3), Validators.maxLength(30)])); + } + } else { + this.form.controls[key].setValue(value); + } + } + } + + ngOnDestroy(): void { + this.form.reset(); + } + + private postalCodeValidator(): ValidatorFn { + return (control: AbstractControl): { [key: string]: unknown } | null => { + const postalCodePattern = /^[A-Za-z]\d[A-Za-z][ -]?\d[A-Za-z]\d$/; + if (control.value && !postalCodePattern.test(control.value)) { + return { 'invalidPostalCode': true }; + } + return null; + }; + } +} + +export interface ILocationForm { + address: string; + postalCode: string; + city: string; + province: string; + country: string; +} diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index f1f0594c..2feaddc7 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -43,6 +43,7 @@ import { PostFormComponent } from './components/post-form/post-form.component'; import { BlogFormComponent } from './components/blog-form/blog-form.component'; import { EventFormComponent } from './components/event-form/event-form.component'; import { PollFormComponent } from './components/poll-form/poll-form.component'; +import { LocationFormComponent } from './components/location-form/location-form.component'; import { TruncateFileNamePipe } from './pipes/truncate-file-name/truncate-file-name.pipe'; import { FormControlPipe } from './pipes/form-control/form-control.pipe'; @@ -72,6 +73,7 @@ import { DurationFormatPipe } from './pipes/duration-format/duration-format.pipe BlogFormComponent, EventFormComponent, PollFormComponent, + LocationFormComponent, TruncateFileNamePipe, FormControlPipe, FormGroupPipe, @@ -129,6 +131,7 @@ import { DurationFormatPipe } from './pipes/duration-format/duration-format.pipe BlogFormComponent, EventFormComponent, PollFormComponent, + LocationFormComponent, ListComponent, LocalizedDatePipe, DurationFormatPipe, From a9cba52f5623f9d4911c1703709e395a433359fd Mon Sep 17 00:00:00 2001 From: doug0102 Date: Fri, 22 Mar 2024 10:03:47 -0400 Subject: [PATCH 2/9] location form translations --- .../components/input/input.component.html | 8 +++++++- .../location-form.component.html | 20 +++++++++---------- src/assets/i18n/translations.en.ts | 10 +++++++++- src/assets/i18n/translations.fr.ts | 10 +++++++++- 4 files changed, 35 insertions(+), 13 deletions(-) diff --git a/src/app/shared/components/input/input.component.html b/src/app/shared/components/input/input.component.html index a0eb9dc4..8d53bff0 100644 --- a/src/app/shared/components/input/input.component.html +++ b/src/app/shared/components/input/input.component.html @@ -66,6 +66,12 @@ {{ control.errors!['maxlength'].requiredLength }}. - {{ label }} {{ translations.input.error.required | translate }} + + {{ translations.input.error.postalCode | translate }} + + + + {{ label }} {{ translations.input.error.required | translate }} + diff --git a/src/app/shared/components/location-form/location-form.component.html b/src/app/shared/components/location-form/location-form.component.html index be266706..fd065567 100644 --- a/src/app/shared/components/location-form/location-form.component.html +++ b/src/app/shared/components/location-form/location-form.component.html @@ -4,8 +4,8 @@ [name]="'address'" formControlName="address" [control]="form.controls['address'] | formControl" - [label]="'Address' | translate" - [placeholder]="'Enter the address' | translate" + [label]="translations.forms.location.address | translate" + [placeholder]="translations.forms.placeholder | translate" [autofocus]="true" [required]="true" > @@ -16,8 +16,8 @@ [name]="'postalCode'" formControlName="postalCode" [control]="form.controls['postalCode'] | formControl" - [label]="'Postal Code' | translate" - [placeholder]="'Enter the postal code' | translate" + [label]="translations.forms.location.postalCode| translate" + [placeholder]="translations.forms.placeholder | translate" [required]="true" > @@ -27,8 +27,8 @@ [name]="'city'" formControlName="city" [control]="form.controls['city'] | formControl" - [label]="'City' | translate" - [placeholder]="'Enter the city' | translate" + [label]="translations.forms.location.city | translate" + [placeholder]="translations.forms.placeholder | translate" [required]="true" > @@ -38,8 +38,8 @@ [name]="'province'" formControlName="province" [control]="form.controls['province'] | formControl" - [label]="'Province' | translate" - [placeholder]="'Enter the province' | translate" + [label]="translations.forms.location.province | translate" + [placeholder]="translations.forms.placeholder | translate" [required]="true" > @@ -49,8 +49,8 @@ [name]="'country'" formControlName="country" [control]="form.controls['country'] | formControl" - [label]="'Country' | translate" - [placeholder]="'Enter the country' | translate" + [label]="translations.forms.location.country | translate" + [placeholder]="translations.forms.placeholder | translate" [required]="true" > diff --git a/src/assets/i18n/translations.en.ts b/src/assets/i18n/translations.en.ts index 243919d4..1cb38aee 100644 --- a/src/assets/i18n/translations.en.ts +++ b/src/assets/i18n/translations.en.ts @@ -206,7 +206,8 @@ export default { "required": "is required.", "email": "Please enter a valid email.", "minLength": "Minimum character length is ", - "maxLength": "Maximum character length is " + "maxLength": "Maximum character length is ", + "postalCode": "Please enter a valid postal code." } }, "banner": { @@ -356,6 +357,13 @@ export default { "option": "Option", "option_add": "Add an option", "option_remove": "Remove option" + }, + "location": { + "address": "Address", + "postalCode": "Postal Code", + "city": "City", + "province": "Province", + "country": "Country" } }, "file_select": { diff --git a/src/assets/i18n/translations.fr.ts b/src/assets/i18n/translations.fr.ts index bfdbf441..a3dd8198 100644 --- a/src/assets/i18n/translations.fr.ts +++ b/src/assets/i18n/translations.fr.ts @@ -207,7 +207,8 @@ const fr: typeof import('./translations.en').default = { "required": "est requis.", "email": "Veuillez saisir une adresse e-mail valide.", "minLength": "La longueur minimale des caractères est ", - "maxLength": "La longueur maximale des caractères est " + "maxLength": "La longueur maximale des caractères est ", + "postalCode": "Veuillez entrer un code postal valide." } }, "banner": { @@ -357,6 +358,13 @@ const fr: typeof import('./translations.en').default = { "option": "Option", "option_add": "Ajouter une option", "option_remove": "Supprimer l'option" + }, + "location": { + "address": "Adresse", + "postalCode": "Code Postal", + "city": "Ville", + "province": "Province", + "country": "Pays" } }, "file_select": { From da66819678c42e7928b531a1c8a3c69c4a9addbb Mon Sep 17 00:00:00 2001 From: doug0102 Date: Fri, 22 Mar 2024 15:24:50 -0400 Subject: [PATCH 3/9] location form province drop down --- src/app/core/models/location.model.ts | 100 ++++++++++++++++-- src/app/core/services/event.service.ts | 12 +-- src/app/core/services/people.service.ts | 12 +-- .../features/calendar/calendar.component.ts | 5 +- src/app/features/events/models/event.ts | 6 +- .../event-form/event-form.component.html | 14 +-- .../event-form/event-form.component.ts | 6 +- .../location-form.component.html | 28 +++-- .../location-form.component.scss | 49 ++++++--- .../location-form/location-form.component.ts | 27 ++++- src/app/shared/shared.module.ts | 2 + 11 files changed, 190 insertions(+), 71 deletions(-) diff --git a/src/app/core/models/location.model.ts b/src/app/core/models/location.model.ts index e187e072..d9fb943e 100644 --- a/src/app/core/models/location.model.ts +++ b/src/app/core/models/location.model.ts @@ -4,10 +4,10 @@ export class Location implements ILocationForm { address: string; postalCode: string; city: string; - province: string; + province: IProvince; country: string; - constructor(address: string, postalCode: string, city: string, province: string, country: string = 'Canada') { + constructor(address: string, postalCode: string, city: string, province: IProvince, country: string = 'Canada') { this.address = address; this.postalCode = postalCode; this.city = city; @@ -18,14 +18,94 @@ export class Location implements ILocationForm { toString(): string { return `${this.address} ${this.postalCode}, ${this.city}, ${this.province}`; } +} + +export interface IProvince { + titleEn: string, + titleFr: string, + abbreviation: string +} - toLocationForm(): ILocationForm { - return { - address: this.address, - postalCode: this.postalCode, - city: this.city, - province: this.province, - country: this.country - } +export const Provinces: IProvince[] = [ + { + titleEn: 'Alberta', + titleFr: 'Alberta', + abbreviation: 'AB' + }, + { + titleEn: 'British Columbia', + titleFr: 'Colombie-Britannique', + abbreviation: 'BC' + }, + { + titleEn: 'Manitoba', + titleFr: 'Manitoba', + abbreviation: 'MB' + }, + { + titleEn: 'New Brunswick', + titleFr: 'Nouveau-Brunswick', + abbreviation: 'NB' + }, + { + titleEn: 'Newfoundland and Labrador', + titleFr: 'Terre-Neuve-et-Labrador', + abbreviation: 'NL' + }, + { + titleEn: 'Northwest Territories', + titleFr: 'Territoires du Nord-Ouest', + abbreviation: 'NT' + }, + { + titleEn: 'Nova Scotia', + titleFr: 'Nouvelle-Écosse', + abbreviation: 'NS' + }, + { + titleEn: 'Nunavut', + titleFr: 'Nunavut', + abbreviation: 'NU' + }, + { + titleEn: 'Ontario', + titleFr: 'Ontario', + abbreviation: 'ON' + }, + { + titleEn: 'Prince Edward Island', + titleFr: 'Île-du-Prince-Édouard', + abbreviation: 'PE' + }, + { + titleEn: 'Quebec', + titleFr: 'Québec', + abbreviation: 'QC' + }, + { + titleEn: 'Saskatchewan', + titleFr: 'Saskatchewan', + abbreviation: 'SK' + }, + { + titleEn: 'Yukon Territory', + titleFr: 'Territoire du Yukon', + abbreviation: 'YT' } +]; + +export class Province { + static AB: IProvince = Provinces[0]; + static BC: IProvince = Provinces[1]; + static MB: IProvince = Provinces[2]; + static NB: IProvince = Provinces[3]; + static NL: IProvince = Provinces[4]; + static NT: IProvince = Provinces[5]; + static NS: IProvince = Provinces[6]; + static NU: IProvince = Provinces[7]; + static ON: IProvince = Provinces[8]; + static PE: IProvince = Provinces[9]; + static QC: IProvince = Provinces[10]; + static SK: IProvince = Provinces[11]; + static YT: IProvince = Provinces[12]; } diff --git a/src/app/core/services/event.service.ts b/src/app/core/services/event.service.ts index ee601a5f..95ea6d83 100644 --- a/src/app/core/services/event.service.ts +++ b/src/app/core/services/event.service.ts @@ -1,7 +1,7 @@ import { Injectable, inject } from '@angular/core'; import { Observable } from 'rxjs'; import { Event } from 'src/app/features/events/models/event'; -import { Location } from '../models/location.model'; +import { Location, Province } from '../models/location.model'; import { PeopleService } from './people.service'; import { LoremIpsum } from 'lorem-ipsum'; @@ -145,11 +145,11 @@ export class EventService implements IListService { private randomLocation(): Location { const addresses: Location[] = [ - new Location('2910 Woodroffe Ave', 'K2C2C7', 'Ottawa', 'Ontario'), - new Location('4230 Innes Rd', 'K2C2C7', 'Ottawa', 'Ontario'), - new Location('2440 Bank St', 'K2C2C7', 'Ottawa', 'Ontario'), - new Location('464 Rideau St', 'K2C2C7', 'Ottawa', 'Ontario'), - new Location('464 Bank St', 'K2C2C7', 'Ottawa', 'Ontario'), + new Location('2910 Woodroffe Ave', 'K2C2C7', 'Ottawa', Province.ON), + new Location('4230 Innes Rd', 'K2C2C7', 'Ottawa', Province.ON), + new Location('2440 Bank St', 'K2C2C7', 'Ottawa', Province.ON), + new Location('464 Rideau St', 'K2C2C7', 'Ottawa', Province.ON), + new Location('464 Bank St', 'K2C2C7', 'Ottawa', Province.ON), ]; return addresses[Math.floor(Math.random() * addresses.length)]; } diff --git a/src/app/core/services/people.service.ts b/src/app/core/services/people.service.ts index 68dc1051..043dab16 100644 --- a/src/app/core/services/people.service.ts +++ b/src/app/core/services/people.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Person } from '../models/person.model'; import { Observable } from 'rxjs'; -import { Location } from '../models/location.model'; +import { Location, Province } from '../models/location.model'; import { IListService } from '../interfaces/list-service.interface'; import { ProfileCardComponent } from 'src/app/features/profile/components/profile-card/profile-card.component'; @@ -110,11 +110,11 @@ export class PeopleService implements IListService { private randomAddress(): Location { const addresses: Location[] = [ - new Location('2910 Woodroffe Ave', 'K2C2C7', 'Ottawa', 'Ontario'), - new Location('4230 Innes Rd', 'K2C2C7', 'Ottawa', 'Ontario'), - new Location('2440 Bank St', 'K2C2C7', 'Ottawa', 'Ontario'), - new Location('464 Rideau St', 'K2C2C7', 'Ottawa', 'Ontario'), - new Location('464 Bank St', 'K2C2C7', 'Ottawa', 'Ontario'), + new Location('2910 Woodroffe Ave', 'K2C2C7', 'Ottawa', Province.ON), + new Location('4230 Innes Rd', 'K2C2C7', 'Ottawa', Province.ON), + new Location('2440 Bank St', 'K2C2C7', 'Ottawa', Province.ON), + new Location('464 Rideau St', 'K2C2C7', 'Ottawa', Province.ON), + new Location('464 Bank St', 'K2C2C7', 'Ottawa', Province.ON), ]; return addresses[Math.floor(Math.random() * addresses.length)]; } diff --git a/src/app/features/calendar/calendar.component.ts b/src/app/features/calendar/calendar.component.ts index d82d2f36..9efcb860 100644 --- a/src/app/features/calendar/calendar.component.ts +++ b/src/app/features/calendar/calendar.component.ts @@ -35,6 +35,7 @@ import { Subscription } from 'rxjs'; import { DebounceService } from 'src/app/core/services/debounce.service'; import { Event } from 'src/app/features/events/models/event'; import { FormGroup } from '@angular/forms'; +import { Province } from 'src/app/core/models/location.model'; @Component({ selector: 'app-calendar', @@ -75,7 +76,7 @@ export class CalendarComponent implements OnInit, OnChanges, OnDestroy { address: '', postalCode: '', city: '', - province: 'Ontario', + province: Province.ON, country: 'Canada' }, eventOnlinePlatform: '', @@ -343,7 +344,7 @@ export class CalendarComponent implements OnInit, OnChanges, OnDestroy { address: '', postalCode: '', city: '', - province: 'Ontario', + province: Province.ON, country: 'Canada' }, eventOnlinePlatform: '', diff --git a/src/app/features/events/models/event.ts b/src/app/features/events/models/event.ts index a0305a63..b23bbcaa 100644 --- a/src/app/features/events/models/event.ts +++ b/src/app/features/events/models/event.ts @@ -1,5 +1,5 @@ import { Person } from 'src/app/core/models/person.model'; -import { Location } from 'src/app/core/models/location.model'; +import { Location, Province } from 'src/app/core/models/location.model'; import { Group } from '../../groups/models/group'; import { IEventForm } from 'src/app/shared/components/event-form/event-form.component'; import { format, isSameDay } from 'date-fns'; @@ -9,7 +9,7 @@ export class Event { title: string = ''; eventType: string = 'Hybrid'; description: string = ''; - location: Location = new Location('', '', '', ''); + location: Location = new Location('', '', '', Province.ON); language: string = 'English'; tags: [string] = ['']; startDate: Date = new Date(); @@ -36,7 +36,7 @@ export class Event { eventName: this.title, eventLanguage: this.language, eventDescription: this.description, - eventLocation: this.location.toLocationForm(), + eventLocation: this.location, eventOnlinePlatform: this.onlinePlatform, eventDuration: sameDay ? 'Single' : 'Multi', eventStartDate: format(this.startDate, 'y-MM-dd'), diff --git a/src/app/shared/components/event-form/event-form.component.html b/src/app/shared/components/event-form/event-form.component.html index a81c4560..93326454 100644 --- a/src/app/shared/components/event-form/event-form.component.html +++ b/src/app/shared/components/event-form/event-form.component.html @@ -78,19 +78,7 @@ > - - - + - - +
+ + {{ translations.forms.location.province | translate }} + * + + + + @for (prov of provinces; track $index) { + + {{ translateService.currentLang === 'en' ? prov.titleEn : prov.titleFr }} + + } + + +
(); @Input() model: ILocationForm = { address: '', postalCode: '', city: 'Ottawa', - province: 'Ontario', + province: Province.ON, country: 'Canada', }; - constructor(public translations: Translations) {} + provinces = Provinces; + + constructor(public translations: Translations, + public translateService: TranslateService) { + + } ngOnInit(): void { for (const [key, value] of Object.entries(this.model)) { @@ -27,13 +34,23 @@ export class LocationFormComponent implements OnInit, OnDestroy { if (key == 'postalCode') { this.form.addControl(key, new FormControl(value, [Validators.required, Validators.minLength(6), Validators.maxLength(7), this.postalCodeValidator()])); } + else if (key == 'province') { + const province = value as IProvince; + this.form.addControl(key, new FormControl(province.abbreviation, [Validators.required])); + } else { this.form.addControl(key, new FormControl(value, [Validators.required, Validators.minLength(3), Validators.maxLength(30)])); } } else { this.form.controls[key].setValue(value); } + + this.form.controls[key].valueChanges.subscribe(() => { + this.formChange.emit(this.form); + }); } + + this.formChange.emit(this.form); } ngOnDestroy(): void { @@ -55,6 +72,6 @@ export interface ILocationForm { address: string; postalCode: string; city: string; - province: string; + province: IProvince; country: string; -} +} \ No newline at end of file diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 2feaddc7..8ee6c7f2 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -52,6 +52,7 @@ import { FileSelectComponent } from './components/file-select/file-select.compon import { ListComponent } from './components/list/list.component'; import { LocalizedDatePipe } from './pipes/localized-date/localized-date.pipe'; import { DurationFormatPipe } from './pipes/duration-format/duration-format.pipe'; +import { MatSelectModule } from '@angular/material/select'; @NgModule({ declarations: [ @@ -108,6 +109,7 @@ import { DurationFormatPipe } from './pipes/duration-format/duration-format.pipe MatDatepickerModule, MatAutocompleteModule, MatCardModule, + MatSelectModule, NgxSkeletonLoaderModule, InfiniteScrollModule, ], From 4b6a79896758d330bfedb8647f5bd176d9daecb5 Mon Sep 17 00:00:00 2001 From: doug0102 Date: Fri, 22 Mar 2024 15:29:48 -0400 Subject: [PATCH 4/9] update event page to display new province object correctly --- src/app/features/events/components/event/event.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/features/events/components/event/event.component.html b/src/app/features/events/components/event/event.component.html index 86691b5c..9347c6b2 100644 --- a/src/app/features/events/components/event/event.component.html +++ b/src/app/features/events/components/event/event.component.html @@ -85,7 +85,7 @@

{{ model.location.address }}

-

{{ model.location.city }}, {{ model.location.province }}

+

{{ model.location.city }}, {{ model.location.province.abbreviation }}

From f81782ddd29a46c579191a2d7bb7799ccc22b89c Mon Sep 17 00:00:00 2001 From: doug0102 Date: Fri, 22 Mar 2024 15:41:36 -0400 Subject: [PATCH 5/9] freeze the province and provinces objects --- src/app/core/models/location.model.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app/core/models/location.model.ts b/src/app/core/models/location.model.ts index d9fb943e..564094fd 100644 --- a/src/app/core/models/location.model.ts +++ b/src/app/core/models/location.model.ts @@ -93,6 +93,7 @@ export const Provinces: IProvince[] = [ abbreviation: 'YT' } ]; +Object.freeze(Provinces); export class Province { static AB: IProvince = Provinces[0]; @@ -109,3 +110,4 @@ export class Province { static SK: IProvince = Provinces[11]; static YT: IProvince = Provinces[12]; } +Object.freeze(Province); From f0ad053969d1bb536de4c59f77ff2c68397d263c Mon Sep 17 00:00:00 2001 From: doug0102 Date: Wed, 27 Mar 2024 16:27:13 -0400 Subject: [PATCH 6/9] display province abbreviation for event locations --- src/app/core/models/location.model.ts | 2 +- .../calendar-events/calendar-events.component.html | 2 +- src/app/shared/components/event-form/event-form.component.ts | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/core/models/location.model.ts b/src/app/core/models/location.model.ts index 564094fd..d7f5de19 100644 --- a/src/app/core/models/location.model.ts +++ b/src/app/core/models/location.model.ts @@ -16,7 +16,7 @@ export class Location implements ILocationForm { } toString(): string { - return `${this.address} ${this.postalCode}, ${this.city}, ${this.province}`; + return `${this.address} ${this.postalCode}, ${this.city}, ${this.province.abbreviation}`; } } diff --git a/src/app/features/calendar/components/calendar-events/calendar-events.component.html b/src/app/features/calendar/components/calendar-events/calendar-events.component.html index ea749852..dae7fb4c 100644 --- a/src/app/features/calendar/components/calendar-events/calendar-events.component.html +++ b/src/app/features/calendar/components/calendar-events/calendar-events.component.html @@ -60,7 +60,7 @@
{{ event.eventType }}
-
{{ event.location.address }}, {{ event.location.city }}, {{ event.location.province }}
+
{{ event.location.address }}, {{ event.location.city }}, {{ event.location.province.abbreviation }}
diff --git a/src/app/shared/components/event-form/event-form.component.ts b/src/app/shared/components/event-form/event-form.component.ts index 213df511..a652bf06 100644 --- a/src/app/shared/components/event-form/event-form.component.ts +++ b/src/app/shared/components/event-form/event-form.component.ts @@ -6,6 +6,7 @@ import { Translations } from 'src/app/core/services/translations.service'; import { Validators as EditorValidators } from 'ngx-editor'; import { ILocationForm } from '../location-form/location-form.component'; import { Province } from 'src/app/core/models/location.model'; +import { format } from 'date-fns'; @Component({ selector: 'app-event-form', @@ -29,9 +30,9 @@ export class EventFormComponent implements OnInit, OnDestroy, AfterContentInit { }, eventOnlinePlatform: '', eventDuration: EventDuration.Single, - eventStartDate: '', + eventStartDate: format(new Date(), 'y-MM-dd'), eventStartTime: '12:00', - eventEndDate: '', + eventEndDate: format(new Date(), 'y-MM-dd'), eventEndTime: '13:00', }; From cb66e9488e6d80ad71ea4d7e2b81465baba63aa8 Mon Sep 17 00:00:00 2001 From: GCCollab Date: Tue, 2 Apr 2024 17:42:29 +0000 Subject: [PATCH 7/9] Code formatting ignore-deploy --- src/app/core/models/location.model.ts | 36 +++++++++---------- .../features/calendar/calendar.component.ts | 4 +-- src/app/features/events/models/event.ts | 16 +++++++-- .../event-form/event-form.component.ts | 12 +++---- .../components/input/input.component.html | 6 ++-- .../location-form.component.html | 7 ++-- .../location-form.component.scss | 5 ++- .../location-form/location-form.component.ts | 20 +++++------ 8 files changed, 54 insertions(+), 52 deletions(-) diff --git a/src/app/core/models/location.model.ts b/src/app/core/models/location.model.ts index d7f5de19..4799e5ab 100644 --- a/src/app/core/models/location.model.ts +++ b/src/app/core/models/location.model.ts @@ -1,4 +1,4 @@ -import { ILocationForm } from "src/app/shared/components/location-form/location-form.component"; +import { ILocationForm } from 'src/app/shared/components/location-form/location-form.component'; export class Location implements ILocationForm { address: string; @@ -21,77 +21,77 @@ export class Location implements ILocationForm { } export interface IProvince { - titleEn: string, - titleFr: string, - abbreviation: string + titleEn: string; + titleFr: string; + abbreviation: string; } export const Provinces: IProvince[] = [ { titleEn: 'Alberta', titleFr: 'Alberta', - abbreviation: 'AB' + abbreviation: 'AB', }, { titleEn: 'British Columbia', titleFr: 'Colombie-Britannique', - abbreviation: 'BC' + abbreviation: 'BC', }, { titleEn: 'Manitoba', titleFr: 'Manitoba', - abbreviation: 'MB' + abbreviation: 'MB', }, { titleEn: 'New Brunswick', titleFr: 'Nouveau-Brunswick', - abbreviation: 'NB' + abbreviation: 'NB', }, { titleEn: 'Newfoundland and Labrador', titleFr: 'Terre-Neuve-et-Labrador', - abbreviation: 'NL' + abbreviation: 'NL', }, { titleEn: 'Northwest Territories', titleFr: 'Territoires du Nord-Ouest', - abbreviation: 'NT' + abbreviation: 'NT', }, { titleEn: 'Nova Scotia', titleFr: 'Nouvelle-Écosse', - abbreviation: 'NS' + abbreviation: 'NS', }, { titleEn: 'Nunavut', titleFr: 'Nunavut', - abbreviation: 'NU' + abbreviation: 'NU', }, { titleEn: 'Ontario', titleFr: 'Ontario', - abbreviation: 'ON' + abbreviation: 'ON', }, { titleEn: 'Prince Edward Island', titleFr: 'Île-du-Prince-Édouard', - abbreviation: 'PE' + abbreviation: 'PE', }, { titleEn: 'Quebec', titleFr: 'Québec', - abbreviation: 'QC' + abbreviation: 'QC', }, { titleEn: 'Saskatchewan', titleFr: 'Saskatchewan', - abbreviation: 'SK' + abbreviation: 'SK', }, { titleEn: 'Yukon Territory', titleFr: 'Territoire du Yukon', - abbreviation: 'YT' - } + abbreviation: 'YT', + }, ]; Object.freeze(Provinces); diff --git a/src/app/features/calendar/calendar.component.ts b/src/app/features/calendar/calendar.component.ts index 9efcb860..21c55920 100644 --- a/src/app/features/calendar/calendar.component.ts +++ b/src/app/features/calendar/calendar.component.ts @@ -77,7 +77,7 @@ export class CalendarComponent implements OnInit, OnChanges, OnDestroy { postalCode: '', city: '', province: Province.ON, - country: 'Canada' + country: 'Canada', }, eventOnlinePlatform: '', eventDuration: 'Single', @@ -345,7 +345,7 @@ export class CalendarComponent implements OnInit, OnChanges, OnDestroy { postalCode: '', city: '', province: Province.ON, - country: 'Canada' + country: 'Canada', }, eventOnlinePlatform: '', eventDuration: 'Single', diff --git a/src/app/features/events/models/event.ts b/src/app/features/events/models/event.ts index b23bbcaa..97051d8f 100644 --- a/src/app/features/events/models/event.ts +++ b/src/app/features/events/models/event.ts @@ -54,7 +54,13 @@ export class Event { event.title = eventForm.eventName; event.eventType = eventForm.eventType; event.description = eventForm.eventDescription; - event.location = new Location(eventForm.eventLocation.address, eventForm.eventLocation.postalCode, eventForm.eventLocation.city, eventForm.eventLocation.province, eventForm.eventLocation.country); + event.location = new Location( + eventForm.eventLocation.address, + eventForm.eventLocation.postalCode, + eventForm.eventLocation.city, + eventForm.eventLocation.province, + eventForm.eventLocation.country + ); event.language = eventForm.eventLanguage; event.tags = this.tags; event.startDate = new Date([eventForm.eventStartDate, eventForm.eventStartTime].join(' ')); @@ -81,7 +87,13 @@ export class Event { event.title = eventForm.eventName; event.eventType = eventForm.eventType; event.description = eventForm.eventDescription; - event.location = new Location(eventForm.eventLocation.address, eventForm.eventLocation.postalCode, eventForm.eventLocation.city, eventForm.eventLocation.province, eventForm.eventLocation.country); + event.location = new Location( + eventForm.eventLocation.address, + eventForm.eventLocation.postalCode, + eventForm.eventLocation.city, + eventForm.eventLocation.province, + eventForm.eventLocation.country + ); event.language = eventForm.eventLanguage; event.tags = ['']; event.startDate = new Date([eventForm.eventStartDate, eventForm.eventStartTime].join(' ')); diff --git a/src/app/shared/components/event-form/event-form.component.ts b/src/app/shared/components/event-form/event-form.component.ts index a652bf06..276d3064 100644 --- a/src/app/shared/components/event-form/event-form.component.ts +++ b/src/app/shared/components/event-form/event-form.component.ts @@ -26,7 +26,7 @@ export class EventFormComponent implements OnInit, OnDestroy, AfterContentInit { postalCode: '', city: '', province: Province.ON, - country: 'Canada' + country: 'Canada', }, eventOnlinePlatform: '', eventDuration: EventDuration.Single, @@ -49,15 +49,13 @@ export class EventFormComponent implements OnInit, OnDestroy, AfterContentInit { ngOnInit(): void { for (const [key, value] of Object.entries(this.model)) { if (!this.form.controls[key]) { - if (key == 'eventDescription'){ + if (key == 'eventDescription') { this.form.addControl(key, new FormControl(value, [EditorValidators.required(), EditorValidators.maxLength(this.maxCharacters)])); - } - else if (key == 'eventLocation') { + } else if (key == 'eventLocation') { continue; - } - else { + } else { this.form.addControl(key, new FormControl(value, [Validators.required, this.minValidator, this.maxValidator])); - } + } } else { this.form.controls[key].setValue(value); } diff --git a/src/app/shared/components/input/input.component.html b/src/app/shared/components/input/input.component.html index 8d53bff0..c88e6e77 100644 --- a/src/app/shared/components/input/input.component.html +++ b/src/app/shared/components/input/input.component.html @@ -66,12 +66,10 @@ {{ control.errors!['maxlength'].requiredLength }}. - + {{ translations.input.error.postalCode | translate }} - - {{ label }} {{ translations.input.error.required | translate }} - + {{ label }} {{ translations.input.error.required | translate }}
diff --git a/src/app/shared/components/location-form/location-form.component.html b/src/app/shared/components/location-form/location-form.component.html index fcf2b19e..5d806c59 100644 --- a/src/app/shared/components/location-form/location-form.component.html +++ b/src/app/shared/components/location-form/location-form.component.html @@ -16,7 +16,7 @@ [name]="'postalCode'" formControlName="postalCode" [control]="form.controls['postalCode'] | formControl" - [label]="translations.forms.location.postalCode| translate" + [label]="translations.forms.location.postalCode | translate" [placeholder]="translations.forms.placeholder | translate" [required]="true" > @@ -39,10 +39,7 @@ * - + @for (prov of provinces; track $index) { {{ translateService.currentLang === 'en' ? prov.titleEn : prov.titleFr }} diff --git a/src/app/shared/components/location-form/location-form.component.scss b/src/app/shared/components/location-form/location-form.component.scss index d4481c39..f45e1f18 100644 --- a/src/app/shared/components/location-form/location-form.component.scss +++ b/src/app/shared/components/location-form/location-form.component.scss @@ -32,7 +32,7 @@ padding-bottom: 16px; } - // TODO: Move to global style when we reuse + // TODO: Move to global style when we reuse ::ng-deep { .gcc-form-select { mat-label { @@ -50,7 +50,7 @@ align-content: center; flex-wrap: wrap; } - + .mat-mdc-form-field-infix { padding-right: 10px; } @@ -64,5 +64,4 @@ } } } - } diff --git a/src/app/shared/components/location-form/location-form.component.ts b/src/app/shared/components/location-form/location-form.component.ts index b0e65ee7..8ac3ab8b 100644 --- a/src/app/shared/components/location-form/location-form.component.ts +++ b/src/app/shared/components/location-form/location-form.component.ts @@ -23,24 +23,22 @@ export class LocationFormComponent implements OnInit, OnDestroy { provinces = Provinces; - constructor(public translations: Translations, - public translateService: TranslateService) { - - } + constructor( + public translations: Translations, + public translateService: TranslateService + ) {} ngOnInit(): void { for (const [key, value] of Object.entries(this.model)) { if (!this.form.controls[key]) { if (key == 'postalCode') { this.form.addControl(key, new FormControl(value, [Validators.required, Validators.minLength(6), Validators.maxLength(7), this.postalCodeValidator()])); - } - else if (key == 'province') { + } else if (key == 'province') { const province = value as IProvince; this.form.addControl(key, new FormControl(province.abbreviation, [Validators.required])); - } - else { + } else { this.form.addControl(key, new FormControl(value, [Validators.required, Validators.minLength(3), Validators.maxLength(30)])); - } + } } else { this.form.controls[key].setValue(value); } @@ -61,7 +59,7 @@ export class LocationFormComponent implements OnInit, OnDestroy { return (control: AbstractControl): { [key: string]: unknown } | null => { const postalCodePattern = /^[A-Za-z]\d[A-Za-z][ -]?\d[A-Za-z]\d$/; if (control.value && !postalCodePattern.test(control.value)) { - return { 'invalidPostalCode': true }; + return { invalidPostalCode: true }; } return null; }; @@ -74,4 +72,4 @@ export interface ILocationForm { city: string; province: IProvince; country: string; -} \ No newline at end of file +} From 06007a62cb4615d0c8978c5445dc14e4925f3abe Mon Sep 17 00:00:00 2001 From: doug0102 Date: Tue, 2 Apr 2024 13:50:57 -0400 Subject: [PATCH 8/9] fix test --- .../components/event-card/event-card.component.spec.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/features/events/components/event-card/event-card.component.spec.ts b/src/app/features/events/components/event-card/event-card.component.spec.ts index fea93f0c..6ae7809f 100644 --- a/src/app/features/events/components/event-card/event-card.component.spec.ts +++ b/src/app/features/events/components/event-card/event-card.component.spec.ts @@ -8,6 +8,7 @@ import { Location } from 'src/app/core/models/location.model'; import { Person } from 'src/app/core/models/person.model'; import { Group } from 'src/app/features/groups/models/group'; import { Event } from '../../models/event'; +import { Province } from 'src/app/core/models/location.model'; describe('EventCardComponent', () => { let component: EventCardComponent; @@ -41,12 +42,12 @@ describe('EventCardComponent', () => { title: 'Test Event', eventType: 'Hybrid', description: 'Test Event Description', - location: new Location('123 Main St.', 'Ottawa', 'Ontario'), + location: new Location('123 Main St.', 'k2c2c7', 'Ottawa', Province.ON), language: 'English', tags: [''], startDate: new Date(), endDate: new Date(), - author: new Person('0', 'Shea', 'Dougherty-Gill', 'Web Developer', new Location('123 Main St.', 'Ottawa', 'Ontario')), + author: new Person('0', 'Shea', 'Dougherty-Gill', 'Web Developer', new Location('123 Main St.', 'k2c2c7', 'Ottawa', Province.ON)), authoredDate: new Date(), canceled: false, image: '../assets/image/group-banner.png', From a3c0a18be75609697d88d1a138fc6af53065687d Mon Sep 17 00:00:00 2001 From: Adii <73539670+AdiMakkar@users.noreply.github.com> Date: Wed, 3 Apr 2024 10:50:59 -0400 Subject: [PATCH 9/9] event description redirect + axe accessibility on the event flow (#275) * event description redirect + axe accessibility on the event flow * reverting to original interceptorGuard activation --- .../local/backgrounds/environment/service.feature | 3 ++- haibun-e2e-tests/local/backgrounds/pages/site.feature | 3 ++- .../local/features/events/more-events.feature | 10 ++++++++++ src/app/features/home/home.component.html | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 haibun-e2e-tests/local/features/events/more-events.feature diff --git a/haibun-e2e-tests/local/backgrounds/environment/service.feature b/haibun-e2e-tests/local/backgrounds/environment/service.feature index bdf1c2fd..8ee6edee 100644 --- a/haibun-e2e-tests/local/backgrounds/environment/service.feature +++ b/haibun-e2e-tests/local/backgrounds/environment/service.feature @@ -4,4 +4,5 @@ Set about to http://localhost:4200/about Set gctools to https://github.com/gctools-outilsgc Set privacy to http://localhost:4200/privacy Set statistics to http://localhost:4200/stats -Set terms to http://localhost:4200/terms \ No newline at end of file +Set terms to http://localhost:4200/terms +Set events to http://localhost:4200/events \ No newline at end of file diff --git a/haibun-e2e-tests/local/backgrounds/pages/site.feature b/haibun-e2e-tests/local/backgrounds/pages/site.feature index ee4577f6..8131f71c 100644 --- a/haibun-e2e-tests/local/backgrounds/pages/site.feature +++ b/haibun-e2e-tests/local/backgrounds/pages/site.feature @@ -16,4 +16,5 @@ Set Statistics to //*[@id="gcc-footer-statistics-btn"] Set Privacy to //*[@id="gcc-footer-privacy-btn"] Set Terms to //*[@id="gcc-footer-terms-btn"] Set FAQs to //*[@id="gcc-footer-faqs-btn"] -Set Help to //*[@id="gcc-footer-support-btn"] \ No newline at end of file +Set Help to //*[@id="gcc-footer-support-btn"] +Set Events to //*[@id="gcc-events-more-events"] \ No newline at end of file diff --git a/haibun-e2e-tests/local/features/events/more-events.feature b/haibun-e2e-tests/local/features/events/more-events.feature new file mode 100644 index 00000000..fc8b0cac --- /dev/null +++ b/haibun-e2e-tests/local/features/events/more-events.feature @@ -0,0 +1,10 @@ + +Feature: Event description feature + + Backgrounds: environment/service, pages/site + + go to the home webpage + click the button Events + be on the events webpage + + page is accessible accepting serious 0 and moderate 0 diff --git a/src/app/features/home/home.component.html b/src/app/features/home/home.component.html index e0e4ec2e..4f2a9039 100644 --- a/src/app/features/home/home.component.html +++ b/src/app/features/home/home.component.html @@ -29,7 +29,7 @@
-