Skip to content

Commit

Permalink
[ACS-8001] refactored deprecated keyCode
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-web-ua committed Jul 30, 2024
1 parent 0e45193 commit 377f180
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down

0 comments on commit 377f180

Please sign in to comment.