diff --git a/package-lock.json b/package-lock.json index 92323a9..695e175 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@sozialhelden/a11yjson", - "version": "9.0.0", + "version": "9.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/Accessibility.ts b/src/Accessibility.ts index 632f768..c34298d 100644 --- a/src/Accessibility.ts +++ b/src/Accessibility.ts @@ -18,6 +18,8 @@ import { LocalizedString, LocalizedStringSchema } from './LocalizedString'; import { AnimalPolicySchema, AnimalPolicy } from './AnimalPolicy'; import { SmokingPolicy, smokingPolicies } from './SmokingPolicy'; import { quantityDefinition, Volume, LengthSchema } from './Units'; +import { Door, DoorSchema } from './Door'; +import { EmergencyDevice, EmergencyDeviceSchema } from './EmergencyDevice'; /** * Describes the physical (and sometimes human rated) accessibility of a place. @@ -68,7 +70,7 @@ export interface Accessibility { /** * `true` if the venue has induction loops installed in its functional units where this is relevant. */ - hasInductionLoop?: boolean, + hasInductionLoop?: boolean; /** * Object describing the place's ground condition. If there are very different ground conditions, you can create multiple places and nest them. */ @@ -108,6 +110,32 @@ export interface Accessibility { * `null` indicates there is no media, `undefined` or missing property indicates unknown. */ media?: ArrayLike | null; + /** + * `true` if the facility provides mobility equipment e.g. foldable wheelchairs or crutches + */ + providesMobilityEquipment?: boolean; + /** + * Describes the pick up or drop off zone + */ + groundConditionsAtPickupOrDropoffZone?: Ground | null; + /** + * `true if the room is on an accessible path or on the accessible route` + * `false` if not, `undefined` if the condition is unknown or difficult to assess. + */ + hasWheelchairAccessiblePathFromOutside?: boolean; + /** + * Describes the place’s doors. + */ + doors?: Door; + /** + * `true if the place provides dedicated signage for way finding` + * `false` if not, `undefined` if the condition is unknown or difficult to assess. + */ + hasDedicatedAccessibilitySignage?: boolean; + /** + * Describes emergency-related devices inside or around the place. + */ + emergencyDevices?: ArrayLike | null; /** * TODO */ @@ -124,10 +152,6 @@ export interface Accessibility { * TODO */ powerOutlets?: [any]; // TODO define type - /** - * TODO - */ - beds?: [any]; // TODO define type /** * TODO */ @@ -210,6 +234,19 @@ export const AccessibilitySchema = new SimpleSchema({ 'media.$': { type: MediaSchema }, + + emergencyDevices: { + type: Array, + optional: true, + accessibility: { + question: t`Are there any emergency devices?`, + questionMore: t`Are there more emergency devices?`, + description: t`e.g. escape chairs, fire alarms, audible alarms` + } + }, + 'emergencyDevices.$': { + type: EmergencyDeviceSchema + }, payment: { type: PaymentSchema, optional: true, @@ -231,6 +268,27 @@ export const AccessibilitySchema = new SimpleSchema({ question: t`In which condition is the ground you have to traverse to get here?` } }, + groundConditionsAtPickupOrDropoffZone: { + type: GroundSchema, + optional: true, + accessibility: { + question: t`In which condition is the ground around the pick or drop off zone?` + } + }, + hasWheelchairAccessiblePathFromOutside: { + type: Boolean, + optional: true, + accessibility: { + question: t`Is the described place on a wheelchair accessible path?` + } + }, + hasDedicatedAccessibilitySignage: { + type: Boolean, + optional: true, + accessibility: { + question: t`Is there dedicated signage for way finding?` + } + }, ratingSpacious: { type: Number, optional: true, @@ -326,6 +384,21 @@ export const AccessibilitySchema = new SimpleSchema({ ] } }, + providesMobilityEquipment: { + type: Boolean, + optional: true, + accessibility: { + question: t`Does the place provide mobility equipment, e.g. foldable wheelchairs or crutches?` + } + }, + doors: { + type: DoorSchema, + optional: true, + label: t`Door`, + accessibility: { + questionBlockBegin: t`Would you like soem general information about the doors in the place?` + } + }, sitemap: { type: Object, // TODO define type optional: true @@ -350,11 +423,6 @@ export const AccessibilitySchema = new SimpleSchema({ optional: true }, 'powerOutlets.$': Object, // TODO define type - beds: { - type: Array, - optional: true - }, - 'beds.$': Object, // TODO define type wardrobe: { type: Object, // TODO define type optional: true diff --git a/src/Bed.ts b/src/Bed.ts new file mode 100644 index 0000000..485c3e6 --- /dev/null +++ b/src/Bed.ts @@ -0,0 +1,40 @@ +import { t } from 'ttag'; +import SimpleSchema from 'simpl-schema'; + +import { createSchemaInstance } from './SimpleSchemaExtensions'; +import { Length, LengthSchema } from './Units'; +import { LocalizedStringSchema } from './LocalizedString'; + +export interface Bed { + /** + * `true` if the bed is completely accessible while using a wheelchair, + * `false` if not, `undefined` if the condition is unknown or difficult to assess. + */ + isWheelchairAccessible?: boolean; + hasEasyAccessFromBothSides?: boolean; + hasAccessibleLightSwitch?: boolean; +} + +export const BedSchema = createSchemaInstance('Bed', { + isWheelchairAccessible: { + type: Boolean, + optional: true, + accessibility: { + question: t`Is the bed wheelchair accessible?` + } + }, + hasAccessibleLightSwitch: { + type: Boolean, + optional: true, + accessibility: { + question: t`Is the light switch accessible from the bed?` + } + }, + hasEasyAccessFromBothSides: { + type: Boolean, + optional: true, + accessibility: { + question: t`Does the bed have enough space to easily access it from both sides?` + } + } +}); diff --git a/src/EmergencyDevice.ts b/src/EmergencyDevice.ts new file mode 100644 index 0000000..330b98d --- /dev/null +++ b/src/EmergencyDevice.ts @@ -0,0 +1,58 @@ +import { t } from 'ttag'; +import SimpleSchema from 'simpl-schema'; +import './SimpleSchemaExtensions'; +import { Length, LengthSchema, quantityDefinition } from './Units'; +import { LocalizedStringSchema, LocalizedString } from './LocalizedString'; + +/** + * Describes a EmergencyDevice unit provided at this place, for example an audibleFireAlarm + */ +export interface EmergencyDevice { + /** + * Type of the EmergencyDevice unit + */ + type: 'escapeChair' | 'alarm' | 'visualFireAlarm' | 'audibleFireAlarm'; + + /** + * Does the emergency device emit an audible signal? + */ + isAudio?: boolean; + + /** + * Does the emergency device emit a visual signal? + */ + isVisual?: boolean; +} + +export const EmergencyDeviceSchema = new SimpleSchema({ + type: { + type: String, + label: t`Kind of emergency device`, + allowedValues: ['escapeChair', 'visualFireAlarm', 'audibleFireAlarm', 'alarm'], + accessibility: { + question: t`What kind of emergency device is described?`, + options: [ + { value: 'escapeChair', label: t`Escape Chair` }, + { value: 'visualFireAlarm', label: t`visualFireAlarm` }, + { value: 'audibleFireAlarm', label: t`audibleFireAlarm` }, + { value: 'alarm', label: t`alarm` } + ] + } + }, + isAudio: { + type: Boolean, + label: t`Audio`, + optional: true, + accessibility: { + question: t`Does the emergency device emit an audible signal?` + } + }, + isVisual: { + type: Boolean, + label: t`Visual`, + optional: true, + accessibility: { + question: t`Does the emergency device emit a visual signal?` + } + } +}); diff --git a/src/Entrance.ts b/src/Entrance.ts index b6d9561..e4a8e22 100644 --- a/src/Entrance.ts +++ b/src/Entrance.ts @@ -54,6 +54,11 @@ export interface Entrance { * reference to the equipment id of the intercom of this entrance (on accessibility.cloud) */ intercomEquipmentId?: string; + /** + * `true` if the entrance is on a wheelchair accessible path + * `false` if not, `undefined` if unknown. Of interest if, for example, the main entrance is not wheelchair accessible. + */ + isOnWheelchairAccessiblePath?: boolean; } export const EntranceSchema = new SimpleSchema({ @@ -117,6 +122,13 @@ export const EntranceSchema = new SimpleSchema({ questionBlockBegin: t`Would you like to add information about the door at the entrance?` } }, + isOnWheelchairAccessiblePath: { + type: Boolean, + optional: true, + accessibility: { + question: t`Is the entrance along a path which fully accessible via wheelchair.` + } + }, elevatorEquipmentId: { type: String, optional: true, diff --git a/src/Level.ts b/src/Level.ts new file mode 100644 index 0000000..d5c1010 --- /dev/null +++ b/src/Level.ts @@ -0,0 +1,37 @@ +import { t } from 'ttag'; +import SimpleSchema from 'simpl-schema'; + +import './SimpleSchemaExtensions'; + +import { LocalizedStringSchema, LocalizedString } from './LocalizedString'; + +export interface Level { + /** + * Name of the level + */ + name?: LocalizedString; + /** + * Index of the level + */ + index?: Number; +} + +export const LevelSchema = new SimpleSchema({ + name: { + type: LocalizedStringSchema, + label: t`Level Name`, + optional: true, + accessibility: { + question: t`Optional name of the level (matching level lettering/numbering used inside the structure). Is useful for elevator routing (e.g. “take the elevator to level ‘Rooftop terrace’ or ‘Platforms’ or ‘-1’”).` + } + }, + index: { + type: Number, + optional: true, + accessibility: { + question: t`Numeric index of the level that indicates relative position of this level in relation to other levels (levels with higher indices are assumed to be located above levels with lower indices). + +Ground level should have index 0, with levels above ground indicated by positive indices and levels below ground by negative indices.` + } + } +}); diff --git a/src/Media.ts b/src/Media.ts index a8080df..490f288 100644 --- a/src/Media.ts +++ b/src/Media.ts @@ -20,7 +20,7 @@ export interface Media { /** * Type of the media unit */ - type: 'document' | 'menu' | 'guide' | 'presentation' | 'exhibit' | 'movie' | 'play' | 'screen'; + type: 'document' | 'menu' | 'guide' | 'presentation' | 'exhibit' | 'movie' | 'play' | 'screen' | 'in-room-compendium'; /** * Name of the media unit (relevant if there are multiple units of the same kind) @@ -93,7 +93,8 @@ export const MediaSchema = new SimpleSchema({ 'exhibit', 'movie', 'play', - 'screen' + 'screen', + 'in-room-compendium' ], accessibility: { question: t`What kind of media is described?`, @@ -104,7 +105,8 @@ export const MediaSchema = new SimpleSchema({ { value: 'presentation', label: t`presentation` }, { value: 'exhibit', label: t`exhibit` }, { value: 'movie', label: t`movie` }, - { value: 'screen', label: t`screen` } + { value: 'screen', label: t`screen` }, + { value: 'in-room-compendium', label: t`in-room-compendium` } ] } }, diff --git a/src/PlaceProperties.ts b/src/PlaceProperties.ts index e501c11..aa08db4 100644 --- a/src/PlaceProperties.ts +++ b/src/PlaceProperties.ts @@ -7,6 +7,8 @@ import { Accessibility, AccessibilitySchema } from './Accessibility'; import { ExternalId, ExternalIdSchema } from './ExternalId'; import { Address, AddressSchema } from './Address'; import { LocalizedStringSchema, LocalizedString } from './LocalizedString'; +import { RoomSchema, Room } from './Room'; +import { Level, LevelSchema } from './Level'; export interface PlaceProperties { // properties @@ -70,6 +72,12 @@ export interface PlaceProperties { * URL of the original data source’s website describing this place. */ infoPageUrl?: LocalizedString; + /** + * Is there a dedicated website page displaying accessible information? + * + * @deprecated + */ + hasDedicatedAccessibilityInfoPage?: Boolean; /** * URL of the original data source’s website on a subpage that allows to edit the original data. @@ -80,6 +88,14 @@ export interface PlaceProperties { * URL of the place’s own website. */ placeWebsiteUrl?: LocalizedString; + /** + * Information about the place’s rooms. + */ + rooms?: Room; + /** + * Information about the accessibility of the interior levels + */ + levels?: Level; } export const PlacePropertiesSchema = new SimpleSchema({ @@ -106,6 +122,13 @@ export const PlacePropertiesSchema = new SimpleSchema({ componentHint: 'Address' } }, + levels: { + type: LevelSchema, + optional: true, + accessibility: { + question: t`Describe the accessibility of the place’s levels.` + } + }, description: { type: LocalizedStringSchema, optional: true, @@ -133,6 +156,14 @@ export const PlacePropertiesSchema = new SimpleSchema({ example: t`e.g. accessibility@example.com` } }, + rooms: { + type: RoomSchema, + optional: true, + accessibility: { + question: t`How would you describe the rooms inside this place?`, + description: t`Information about the rooms inside the place` + } + }, accessibility: { type: AccessibilitySchema, optional: true, @@ -141,6 +172,13 @@ export const PlacePropertiesSchema = new SimpleSchema({ description: t`Describes the overall accessibility of a place.` } }, + hasDedicatedAccessibilityInfoPage: { + type: Boolean, + optional: true, + accessibility: { + question: t`Is there a dedicated website page displaying accessible information?` + } + }, infoPageUrl: { type: LocalizedStringSchema, regEx: SimpleSchema.RegEx.Url, diff --git a/src/Room.ts b/src/Room.ts index 788d842..a13ee41 100644 --- a/src/Room.ts +++ b/src/Room.ts @@ -2,14 +2,56 @@ import { t } from 'ttag'; import SimpleSchema from 'simpl-schema'; import { createSchemaInstance } from './SimpleSchemaExtensions'; +import { Ground, GroundSchema } from './Ground'; +import { LocalizedString, LocalizedStringSchema } from './LocalizedString'; +import { MediaSchema, Media } from './Media'; +import { Accessibility, AccessibilitySchema } from './Accessibility'; +import { Bed, BedSchema } from './Bed'; +import { RoomAccessibility, RoomAccessibilitySchema } from './RoomAccessibility'; export interface Room { - // QUESTION is this calculated from the subfields or can this go away? /** * `true` if the room's relevant facilities are completely accessible while using a wheelchair, * `false` if not, `undefined` if the condition is unknown or difficult to assess. */ isAccessibleWithWheelchair?: boolean; + + /** + * `true if the room is on an accessible path or on the accessible route` + * `false` if not, `undefined` if the condition is unknown or difficult to assess. + */ + hasWheelchairAccessiblePathFromOutside?: boolean; + + /** + * Object describing the place's ground condition. If there are very different ground conditions, you can create multiple places and nest them. + */ + + ground?: Ground; + + /** + * the name of the room + */ + name?: LocalizedString; + + /** + * Information if at least one chair is accessible with wheelchair + */ + hasOneOrMoreAccessibleChairs?: boolean; + + /** + * Information about media. + * `null` indicates there is no media, `undefined` or missing property indicates that media presence is unknown. + */ + media?: ArrayLike | null; + + /** + * Information about the room's beds + */ + beds?: ArrayLike; + /** + * Describes the accessibility dedicated to a room. + */ + roomAccessibility?: RoomAccessibility; } export const RoomSchema = createSchemaInstance('Room', { @@ -17,7 +59,73 @@ export const RoomSchema = createSchemaInstance('Room', { type: Boolean, optional: true, accessibility: { - machineData: true + question: t`Is the room accessible with wheelchair?` + } + }, + // // Adding accessibility throws test errors without adding test cases ?? + // accessibility: { + // type: AccessibilitySchema, + // optional: true, + // accessibility: { + // question: t`Okay, now let\`s map the accessibility.`, + // description: t`Describes the overall accessibility of the room.` + // } + // }, + hasOneOrMoreAccessibleChairs: { + type: Boolean, + optional: true, + accessibility: { + question: t`Does the room have at least one accessible chair?` + } + }, + hasWheelchairAccessiblePathFromOutside: { + type: Boolean, + optional: true, + accessibility: { + question: t`Is the room on a wheelchair accessible path so you can reach it from outside?` + } + }, + ground: { + type: GroundSchema, + optional: true, + accessibility: { + question: t`In which condition is the ground of the room?` + } + }, + name: { + type: LocalizedStringSchema, + optional: true, + accessibility: { + question: t`What is the name of this room?` + } + }, + media: { + type: Array, + optional: true, + accessibility: { + question: t`Is there any media available?`, + questionMore: t`Is there more media available?`, + description: t`e.g. menus, exhibits, or presentations.` + } + }, + 'media.$': { + type: MediaSchema + }, + beds: { + type: BedSchema, + optional: true, + accessibility: { + question: t`Describe the room’s beds if available.` + } + }, + 'beds.$': { + type: BedSchema + }, + roomAccessibility: { + type: RoomAccessibilitySchema, + optional: true, + accessibility: { + question: t`Describe the room’s individual accessibility.` } } }); diff --git a/src/RoomAccessibility.ts b/src/RoomAccessibility.ts new file mode 100644 index 0000000..d5d0f7f --- /dev/null +++ b/src/RoomAccessibility.ts @@ -0,0 +1,199 @@ +import { t } from 'ttag'; +import SimpleSchema from 'simpl-schema'; + +import './SimpleSchemaExtensions'; + +import { PersonalProfile, PersonalProfileSchema } from './PersonalProfile'; +import { Entrance, EntranceSchema } from './Entrance'; +import { Restroom, RestroomSchema } from './Restroom'; + +import { WheelchairPlaces, WheelchairPlacesSchema } from './WheelchairPlaces'; +import { Media, MediaSchema } from './Media'; +import { Payment, PaymentSchema } from './Payment'; +import { AccessibleTablesPrefab, Tables, TablesSchema } from './Tables'; +import { Pathways, PathwaysSchema } from './Pathways'; +import { Parking, ParkingSchema } from './Parking'; +import { Ground, GroundSchema } from './Ground'; +import { LocalizedString, LocalizedStringSchema } from './LocalizedString'; +import { AnimalPolicySchema, AnimalPolicy } from './AnimalPolicy'; +import { SmokingPolicy, smokingPolicies } from './SmokingPolicy'; +import { quantityDefinition, Volume, LengthSchema } from './Units'; +import { Door, DoorSchema } from './Door'; + +/** + * Describes the physical (and sometimes human rated) accessibility of a place. + */ +export interface RoomAccessibility { + /// @deprecated + accessibleWith?: PersonalProfile; + /// @deprecated + partiallyAccessibleWith?: PersonalProfile; + /// @deprecated + offersActivitiesForPeopleWith?: PersonalProfile; + // areas?: Array; + + // QUESTION How is this measured, should be changed to ambient.lighting + /** + * Determines if the venue is well lit (subjectively, by the assessor). Will be replaced by a measurable lumen value in the future. + */ + isWellLit?: boolean; + /** + * Determines if the venue is quiet (subjectively, by the assessor). Will be replaced by a measurable ambient noise level in the future. + */ + isQuiet?: boolean; + // TODO: Causes test error. Fix this! + // ambientNoiseLevel?: Volume; // in dB(A) relative to a reference pressure of 0.00002 Pa + /** + * Object describing the owner's smoking policy. + */ + smokingPolicy?: SmokingPolicy; + /** + * `true` if the venue has tactile guide strips on the floor or at the walls, `false` if not. `undefined` or missing property indicates unknown. + */ + hasTactileGuideStrips?: boolean; + /** + * `true` if the venue has induction loops installed in its functional units where this is relevant. + */ + hasInductionLoop?: boolean; + /** + * Object describing the place's ground condition. If there are very different ground conditions, you can create multiple places and nest them. + */ + ground?: Ground | null; + + /** + * Information about tables. + * `null` indicates there are no tables, `undefined` or missing property indicates unknown. + */ + tables?: Tables | null; + /** + * Information about media. + * `null` indicates there is no media, `undefined` or missing property indicates unknown. + */ + media?: ArrayLike | null; + + /** + * `true if the room is on an accessible path or on the accessible route` + * `false` if not, `undefined` if the condition is unknown or difficult to assess. + */ + hasWheelchairAccessiblePathFromOutside?: boolean; + /** + * Describes the doors of the room + */ + doors?: Door; + /** + * `true if the place provides dedicated signage for way finding` + * `false` if not, `undefined` if the condition is unknown or difficult to assess. + */ + hasDedicatedAccessibilitySignage?: boolean; +} + +export const RoomAccessibilitySchema = new SimpleSchema({ + accessibleWith: { + type: PersonalProfileSchema, + optional: true, + accessibility: { + deprecated: true + } + }, + partiallyAccessibleWith: { + type: PersonalProfileSchema, + optional: true, + accessibility: { + deprecated: true + } + }, + media: { + type: Array, + optional: true, + accessibility: { + question: t`Is there any media available?`, + questionMore: t`Is there more media available?`, + description: t`e.g. menus, exhibits or presentations` + } + }, + 'media.$': { + type: MediaSchema + }, + ground: { + type: GroundSchema, + optional: true, + accessibility: { + question: t`In which condition is the ground you have to traverse to get here?` + } + }, + hasWheelchairAccessiblePathFromOutside: { + type: Boolean, + optional: true, + accessibility: { + question: t`Is the place on a wheeclchair accessible path?` + } + }, + hasDedicatedAccessibilitySignage: { + type: Boolean, + optional: true, + accessibility: { + question: t`Is there dedicated signage for way finding?` + } + }, + isWellLit: { + type: Boolean, + optional: true, + accessibility: { + question: t`Is the place well lit?` + } + }, + isQuiet: { + type: Boolean, + optional: true, + accessibility: { + question: t`Is the place quiet?` + } + }, + hasInductionLoop: { + type: Boolean, + optional: true, + accessibility: { + question: t`Does this place have induction loops?` + } + }, + // TODO: Causes test error. Fix this! + // ambientNoiseLevel: quantityDefinition(LengthSchema, true, { + // question: t`How loud is the ambient noise here typically (A-Weighted)?`, + // machineData: true + // }), + + smokingPolicy: { + type: String, + optional: true, + allowedValues: smokingPolicies.map(s => s.value), + accessibility: { + question: t`Is smoking allowed here?`, + options: smokingPolicies + } + }, + hasTactileGuideStrips: { + type: Boolean, + optional: true + }, + doors: { + type: DoorSchema, + optional: true, + label: t`Door`, + accessibility: { + questionBlockBegin: t`Would you like some general information about the doors in the place?` + } + }, + tables: { + type: TablesSchema, + optional: true, + accessibility: { + question: t`Are there any tables here?`, + options: [ + { + label: t`Accessible table`, + option: AccessibleTablesPrefab + } + ] + } + } +}); diff --git a/src/Staff.ts b/src/Staff.ts index 2310f87..0e5a216 100644 --- a/src/Staff.ts +++ b/src/Staff.ts @@ -16,6 +16,17 @@ export interface Staff { * open (for example a window or CCTV system), `false` if not, `undefined` if unknown. */ canSeeVisitorsFromInside?: boolean; + /** + * `true` if staff is available upon request + */ + hasAccessibilityAssistantForEnquiries?: boolean; + /** + * Which educational credentials have been awarded to the staff? + * This can be a diploma, certification, qualification, or badge. + * + * [Prefer using URLs supporting Linked Data.](https://schema.org/EducationalOccupationalCredential) + */ + educationalCredentialsAwarded?: ArrayLike; /** * Languages that the staff speaks, including sign language variants. */ @@ -49,6 +60,15 @@ export const StaffSchema = new SimpleSchema({ }, optional: true }, + hasAccessibilityAssistantForEnquiries: { + // TODO clarify with be.accessible what access enquiries are + type: Boolean, + label: t`assistant for access enquiries`, + accessibility: { + question: t`Can the staff assist with access enquiries?` + }, + optional: true + }, hasFreeAssistantForVisitors: { type: Boolean, label: t`Visitor Assistant`, @@ -69,5 +89,18 @@ export const StaffSchema = new SimpleSchema({ type: String, label: t`Language`, allowedValues: ietfLanguageTagsAndSignLanguageCodes + }, + educationalCredentialsAwarded: { + type: Array, + label: t`URLs of educational credentials awarded`, + optional: true, + accessibility: { + question: t`Which educational credentials have been awarded to the staff? This can be a diploma, certification, qualification, or badge.` + } + }, + 'educationalCredentialsAwarded.$': { + type: String, + regEx: SimpleSchema.RegEx.Url, + label: t`URL of educational credentials awarded` } }); diff --git a/src/index.ts b/src/index.ts index ced628f..d301d50 100644 --- a/src/index.ts +++ b/src/index.ts @@ -43,3 +43,8 @@ export * from './rules/RatingRules'; export * from './rules/WheelmapA11yRuleset'; export * from './transformers/transformKoboToA11y'; + +export * from './EmergencyDevice'; +export * from './Bed'; +export * from './RoomAccessibility'; +export * from './Level'; diff --git a/test/Accessibilty.test.ts b/test/Accessibilty.test.ts index 4418539..37a0d94 100644 --- a/test/Accessibilty.test.ts +++ b/test/Accessibilty.test.ts @@ -10,6 +10,10 @@ import { tablesMinimumFixture } from './Tables.test'; import { pathwaysMinimumFixture } from './Pathways.test'; import { parkingMinimumFixture } from './Parking.test'; import { groundMinimumFixture } from './Ground.test'; +import { groundIsLevelFixture } from './Ground.test'; +import { doorWithOptionalsFixture } from './Door.test'; +import { emergencyDeviceGenericAlarmFixture } from './EmergencyDevice.test'; +import { staffWithOptionalsFixture } from './Staff.test'; export const accessibilityMinimumFixture: Accessibility = {}; @@ -18,11 +22,24 @@ const accessibilityWithNullsFixture: Accessibility = { restrooms: null, staff: null, media: null, + emergencyDevices: null, payment: null, tables: null, pathways: null, parking: null, - ground: null + ground: null, + groundConditionsAtPickupOrDropoffZone: null, + hasDedicatedAccessibilitySignage: null +}; + +const accessibilityChangesForNewZealandFixture: Accessibility = { + groundConditionsAtPickupOrDropoffZone: groundIsLevelFixture, + hasDedicatedAccessibilitySignage: false, + hasWheelchairAccessiblePathFromOutside: true, + emergencyDevices: [emergencyDeviceGenericAlarmFixture], + providesMobilityEquipment: true, + doors: doorWithOptionalsFixture, + staff: staffWithOptionalsFixture }; const accessibilityWithOptionalsFixture: Accessibility = { @@ -51,7 +68,6 @@ const accessibilityWithOptionalsFixture: Accessibility = { // switches: [{}, {}], // vendingMachines: [{}, {}], // powerOutlets: [{}, {}], - // beds: [{}, {}], wardrobe: {}, changingRoom: {}, stage: {}, @@ -65,7 +81,8 @@ const accessibilityWithOptionalsFixture: Accessibility = { const allValidFixtures = Object.freeze([ accessibilityMinimumFixture, accessibilityWithNullsFixture, - accessibilityWithOptionalsFixture + accessibilityWithOptionalsFixture, + accessibilityChangesForNewZealandFixture ]); const invalidAccessibilityFixture = { diff --git a/test/Bed.test.ts b/test/Bed.test.ts new file mode 100644 index 0000000..47ae6cd --- /dev/null +++ b/test/Bed.test.ts @@ -0,0 +1,41 @@ +import { Bed, BedSchema } from '../src/Bed'; +import { FormatVersion } from '../src/Version'; + +export const bedMinimumFixture: Bed = {}; + +export const bedWithOptionalsFixture: Bed = { + isWheelchairAccessible: true, + hasEasyAccessFromBothSides: true, + hasAccessibleLightSwitch: true +}; + +const allValidFixtures = Object.freeze([bedMinimumFixture, bedWithOptionalsFixture]); + +const invalidBedFixture = { + bar: [] +}; + +const allInvalidFixtures = Object.freeze([invalidBedFixture]); + +describe('BedSchema Schema', () => { + it('schema is tagged', () => { + expect(BedSchema.__schemaType).toBe('Bed'); + expect(BedSchema.__schemaVersion).toBe(FormatVersion); + }); + it('tests field as invalid', () => { + allInvalidFixtures.forEach(value => { + const context = BedSchema.newContext(); + context.validate(value); + expect(context.validationErrors()).not.toHaveLength(0); + expect(context.isValid()).toBeFalsy(); + }); + }); + it('tests field as valid', () => { + allValidFixtures.forEach(value => { + const context = BedSchema.newContext(); + context.validate(value); + expect(context.validationErrors()).toHaveLength(0); + expect(context.isValid()).toBeTruthy(); + }); + }); +}); diff --git a/test/Door.test.ts b/test/Door.test.ts index 3157894..d839870 100644 --- a/test/Door.test.ts +++ b/test/Door.test.ts @@ -2,7 +2,7 @@ import { Door, DoorSchema } from '../src/Door'; export const doorMinimumFixture: Door = {}; -const doorWithOptionalsFixture: Door = { +export const doorWithOptionalsFixture: Door = { turningSpaceInFront: '<90cm', doorOpensToOutside: true, isAutomaticOrAlwaysOpen: true, diff --git a/test/EmergencyDevice.test.ts b/test/EmergencyDevice.test.ts new file mode 100644 index 0000000..89a3e10 --- /dev/null +++ b/test/EmergencyDevice.test.ts @@ -0,0 +1,53 @@ +import { EmergencyDevice, EmergencyDeviceSchema } from '../src/EmergencyDevice'; + +export const emergencyDeviceEscapeChairFixture: EmergencyDevice = { + type: 'escapeChair' +}; + +export const emergencyDeviceFireAlarmFixture: EmergencyDevice = { + type: 'visualFireAlarm' +}; + +export const emergencyDeviceGenericAlarmFixture: EmergencyDevice = { + type: 'alarm', + isAudio: true +}; + +const allValidFixtures = Object.freeze([ + emergencyDeviceEscapeChairFixture, + emergencyDeviceGenericAlarmFixture, + emergencyDeviceFireAlarmFixture +]); + +const invalidEmergencyDeviceFixture = { + bar: [] +}; + +const invalidTypeEmergencyDeviceFixture = { + type: 'sausage' +}; + +const allInvalidFixtures = Object.freeze([ + {}, + invalidEmergencyDeviceFixture, + invalidTypeEmergencyDeviceFixture +]); + +describe('EmergencyDeviceSchema Schema', () => { + it('tests field as invalid', () => { + allInvalidFixtures.forEach(value => { + const context = EmergencyDeviceSchema.newContext(); + context.validate(value); + expect(context.validationErrors()).not.toHaveLength(0); + expect(context.isValid()).toBeFalsy(); + }); + }); + it('tests field as valid', () => { + allValidFixtures.forEach(value => { + const context = EmergencyDeviceSchema.newContext(); + context.validate(value); + expect(context.validationErrors()).toHaveLength(0); + expect(context.isValid()).toBeTruthy(); + }); + }); +}); diff --git a/test/Entrance.test.ts b/test/Entrance.test.ts index 2e05aee..9afc13f 100644 --- a/test/Entrance.test.ts +++ b/test/Entrance.test.ts @@ -14,7 +14,8 @@ const entranceWithOptionalsFixture: Entrance = { stairs: stairsMinimumFixture, door: doorMinimumFixture, elevatorEquipmentId: 'idHere', - intercomEquipmentId: 'idHere' + intercomEquipmentId: 'idHere', + isOnWheelchairAccessiblePath: true }; const allValidFixtures = Object.freeze([entranceMinimumFixture, entranceWithOptionalsFixture]); diff --git a/test/Ground.test.ts b/test/Ground.test.ts index 2d76c9e..ba4163f 100644 --- a/test/Ground.test.ts +++ b/test/Ground.test.ts @@ -2,6 +2,9 @@ import { Ground, GroundSchema } from '../src/Ground'; export const groundMinimumFixture: Ground = {}; +export const groundIsLevelFixture: Ground = { + isLevel: true +}; const sidewalkWithOptionalsFixture: Ground = { sidewalkConditions: 0.4, isLevel: true, @@ -11,7 +14,11 @@ const sidewalkWithOptionalsFixture: Ground = { turningSpace: '<150cm' }; -const allValidFixtures = Object.freeze([groundMinimumFixture, sidewalkWithOptionalsFixture]); +const allValidFixtures = Object.freeze([ + groundMinimumFixture, + sidewalkWithOptionalsFixture, + groundIsLevelFixture +]); const invalidGroundFixture = { bar: [] diff --git a/test/Level.test.ts b/test/Level.test.ts new file mode 100644 index 0000000..0616aef --- /dev/null +++ b/test/Level.test.ts @@ -0,0 +1,35 @@ +import { Level, LevelSchema } from '../src/Level'; + +export const levelMinimumFixture: Level = {}; + +export const levelWithOptionalsFixture: Level = { + index: 2, + name: 'Second Level' +}; + +const allValidFixtures = Object.freeze([levelMinimumFixture, levelWithOptionalsFixture]); + +const invalidDoorFixture = { + bar: [] +}; + +const allInvalidFixtures = Object.freeze([invalidDoorFixture]); + +describe('LevelSchema Schema', () => { + it('tests field as invalid', () => { + allInvalidFixtures.forEach(value => { + const context = LevelSchema.newContext(); + context.validate(value); + expect(context.validationErrors()).not.toHaveLength(0); + expect(context.isValid()).toBeFalsy(); + }); + }); + it('tests field as valid', () => { + allValidFixtures.forEach(value => { + const context = LevelSchema.newContext(); + context.validate(value); + expect(context.validationErrors()).toHaveLength(0); + expect(context.isValid()).toBeTruthy(); + }); + }); +}); diff --git a/test/Media.test.ts b/test/Media.test.ts index 8730325..2996b95 100644 --- a/test/Media.test.ts +++ b/test/Media.test.ts @@ -4,7 +4,7 @@ export const mediaMinimumFixture: Media = { type: 'document' }; -const mediaWithOptionalsFixture: Media = { +export const mediaWithOptionalsFixture: Media = { type: 'document', name: 'menu', isBraille: true, @@ -19,7 +19,18 @@ const mediaWithOptionalsFixture: Media = { turningSpaceInFront: '>140cm' }; -const allValidFixtures = Object.freeze([mediaMinimumFixture, mediaWithOptionalsFixture]); +const mediaInRoomCompendiumFixture: Media = { + type: 'in-room-compendium', + name: 'Room 42 Compendium', + isBraille: true, + isAudio: true +}; + +const allValidFixtures = Object.freeze([ + mediaMinimumFixture, + mediaWithOptionalsFixture, + mediaInRoomCompendiumFixture +]); const invalidMediaFixture = { bar: [] diff --git a/test/PlaceProperties.test.ts b/test/PlaceProperties.test.ts index cb95893..3c9f9c1 100644 --- a/test/PlaceProperties.test.ts +++ b/test/PlaceProperties.test.ts @@ -3,6 +3,7 @@ import { PlaceProperties, PlacePropertiesSchema } from '../src/PlaceProperties'; import { validExternalIdWithExtendedDataFixture } from './ExternalId.test'; import { accessibilityMinimumFixture } from './Accessibilty.test'; import { structuredAddressMinimalFixture } from './Address.test'; +import { levelWithOptionalsFixture } from './Level.test'; export const placePropertiesMinimumFixture: PlaceProperties = { name: 'T-Mobile Sandy', @@ -32,7 +33,9 @@ const placePropertiesWithOptionalsFixture: PlaceProperties = { creatorId: 'T8j8nnnqMpbxpLxZu', sourceId: 'T8j8nnnqMpbxpLxZu', sourceImportId: 'T8j8nnnqMpbxpLxZu', - accessibility: accessibilityMinimumFixture + accessibility: accessibilityMinimumFixture, + hasDedicatedAccessibilityInfoPage: true, + levels: levelWithOptionalsFixture }; const allValidFixtures = Object.freeze([ diff --git a/test/Room.test.ts b/test/Room.test.ts index 9803115..0d69d34 100644 --- a/test/Room.test.ts +++ b/test/Room.test.ts @@ -1,13 +1,30 @@ import { Room, RoomSchema } from '../src/Room'; import { FormatVersion } from '../src/Version'; - +import { groundIsLevelFixture } from './Ground.test'; +import { mediaWithOptionalsFixture } from './Media.test'; +import { bedWithOptionalsFixture } from './Bed.test'; +import { roomAccessibilityWithOptionalsFixture } from './RoomAccessibilty.test'; export const roomMinimumFixture: Room = {}; const roomWithOptionalsFixture: Room = { - isAccessibleWithWheelchair: true + isAccessibleWithWheelchair: true, + hasWheelchairAccessiblePathFromOutside: true, + ground: groundIsLevelFixture, + hasOneOrMoreAccessibleChairs: false, + name: 'Waiting room', + media: [mediaWithOptionalsFixture], + roomAccessibility: roomAccessibilityWithOptionalsFixture +}; + +const roomWithBedFixture: Room = { + beds: [bedWithOptionalsFixture, bedWithOptionalsFixture] }; -const allValidFixtures = Object.freeze([roomMinimumFixture, roomWithOptionalsFixture]); +const allValidFixtures = Object.freeze([ + roomMinimumFixture, + roomWithOptionalsFixture, + roomWithBedFixture +]); const invalidRoomFixture = { bar: [] diff --git a/test/RoomAccessibilty.test.ts b/test/RoomAccessibilty.test.ts new file mode 100644 index 0000000..6afbdf8 --- /dev/null +++ b/test/RoomAccessibilty.test.ts @@ -0,0 +1,61 @@ +import { RoomAccessibility, RoomAccessibilitySchema } from '../src/RoomAccessibility'; +import { personalProfileMinimumFixture } from './PersonalProfile.test'; +import { mediaMinimumFixture } from './Media.test'; +import { tablesMinimumFixture } from './Tables.test'; +import { groundMinimumFixture } from './Ground.test'; +import { doorWithOptionalsFixture } from './Door.test'; + +export const roomAccessibilityMinimumFixture: RoomAccessibility = {}; + +const roomAccessibilityWithNullsFixture: RoomAccessibility = { + media: null, + tables: null, + ground: null, + hasDedicatedAccessibilitySignage: null +}; + +export const roomAccessibilityWithOptionalsFixture: RoomAccessibility = { + accessibleWith: personalProfileMinimumFixture, + partiallyAccessibleWith: personalProfileMinimumFixture, + media: [mediaMinimumFixture], + tables: tablesMinimumFixture, + isWellLit: true, + isQuiet: true, + hasInductionLoop: false, + smokingPolicy: 'prohibited', + hasTactileGuideStrips: true, + ground: groundMinimumFixture, + hasDedicatedAccessibilitySignage: true, + doors: doorWithOptionalsFixture +}; + +const allValidFixtures = Object.freeze([ + roomAccessibilityMinimumFixture, + roomAccessibilityWithNullsFixture, + roomAccessibilityWithOptionalsFixture +]); + +const invalidRoomAccessibilityFixture = { + bar: [] +}; + +const allInvalidFixtures = Object.freeze([invalidRoomAccessibilityFixture]); + +describe('RoomAccessibilitySchema Schema', () => { + it('tests field as invalid', () => { + allInvalidFixtures.forEach(value => { + const context = RoomAccessibilitySchema.newContext(); + context.validate(value); + expect(context.validationErrors()).not.toHaveLength(0); + expect(context.isValid()).toBeFalsy(); + }); + }); + it('tests field as valid', () => { + allValidFixtures.forEach(value => { + const context = RoomAccessibilitySchema.newContext(); + context.validate(value); + expect(context.validationErrors()).toHaveLength(0); + expect(context.isValid()).toBeTruthy(); + }); + }); +}); diff --git a/test/Staff.test.ts b/test/Staff.test.ts index 4c24307..fe27952 100644 --- a/test/Staff.test.ts +++ b/test/Staff.test.ts @@ -2,9 +2,11 @@ import { Staff, StaffSchema } from '../src/Staff'; export const staffMinimumFixture: Staff = {}; -const staffWithOptionalsFixture: Staff = { +export const staffWithOptionalsFixture: Staff = { canSeeVisitorsFromInside: true, - hasFreeAssistantForVisitors: true + hasFreeAssistantForVisitors: true, + hasAccessibilityAssistantForEnquiries: true, + educationalCredentialsAwarded: ['https://www.belab.co.nz/be-welcome'] }; const allValidFixtures = Object.freeze([staffMinimumFixture, staffWithOptionalsFixture]);