From 377f1802b936c9197a7d90d9728adea86f77f1d2 Mon Sep 17 00:00:00 2001 From: Mykyta Maliarchuk Date: Thu, 13 Jun 2024 15:41:33 +0200 Subject: [PATCH] [ACS-8001] refactored deprecated keyCode --- .../content-metadata/content-metadata.component.spec.ts | 4 ++-- .../components/content-metadata/content-metadata.component.ts | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.spec.ts b/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.spec.ts index 2e118d03ba1..b32371e7b72 100644 --- a/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.spec.ts +++ b/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.spec.ts @@ -1243,7 +1243,7 @@ describe('ContentMetadataComponent', () => { describe('events', () => { it('should not propagate the event on left arrows press', () => { fixture.detectChanges(); - const event = { keyCode: 37, stopPropagation: () => {} }; + const event = { key: 'ArrowLeft', stopPropagation: () => {} }; spyOn(event, 'stopPropagation').and.stub(); const element = fixture.debugElement.query(By.css('adf-card-view')); element.triggerEventHandler('keydown', event); @@ -1252,7 +1252,7 @@ describe('ContentMetadataComponent', () => { it('should not propagate the event on right arrows press', () => { fixture.detectChanges(); - const event = { keyCode: 39, stopPropagation: () => {} }; + const event = { key: 'ArrowRight', stopPropagation: () => {} }; spyOn(event, 'stopPropagation').and.stub(); const element = fixture.debugElement.query(By.css('adf-card-view')); element.triggerEventHandler('keydown', event); diff --git a/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.ts b/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.ts index 60a098d8751..20aab7e0b94 100644 --- a/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.ts +++ b/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.ts @@ -402,8 +402,7 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy { } keyDown(event: KeyboardEvent) { - if (event.keyCode === 37 || event.keyCode === 39) { - // ArrowLeft && ArrowRight + if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') { event.stopPropagation(); } }