• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IgniteUI / igniteui-angular / 13331632524

14 Feb 2025 02:51PM UTC coverage: 22.015% (-69.6%) from 91.622%
13331632524

Pull #15372

github

web-flow
Merge d52d57714 into bcb78ae0a
Pull Request #15372: chore(*): test ci passing

1990 of 15592 branches covered (12.76%)

431 of 964 new or added lines in 18 files covered. (44.71%)

19956 existing lines in 307 files now uncovered.

6452 of 29307 relevant lines covered (22.02%)

249.17 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

5.0
/projects/igniteui-angular/src/lib/calendar/calendar.services.ts
1
import { Injectable, ElementRef, NgZone } from "@angular/core";
2
import { EventManager } from "@angular/platform-browser";
3

4
@Injectable()
5
export class KeyboardNavigationService {
2✔
UNCOV
6
    private keyHandlers = new Map<string, (event: KeyboardEvent) => void>();
×
UNCOV
7
    private eventUnsubscribeFn: Function | null = null;
×
8

9
    constructor(
UNCOV
10
        private eventManager: EventManager,
×
UNCOV
11
        private ngZone: NgZone,
×
12
    ) {}
13

14
    public attachKeyboardHandlers(elementRef: ElementRef, context: any) {
UNCOV
15
        this.detachKeyboardHandlers(); // Clean up any existing listeners
×
16

UNCOV
17
        this.ngZone.runOutsideAngular(() => {
×
UNCOV
18
            this.eventUnsubscribeFn = this.eventManager.addEventListener(
×
19
                elementRef.nativeElement,
20
                'keydown',
21
                (event: KeyboardEvent) => {
UNCOV
22
                    const handler = this.keyHandlers.get(event.key);
×
23

UNCOV
24
                    if (handler) {
×
UNCOV
25
                        this.ngZone.run(handler.bind(context, event));
×
26
                    }
27
                }
28
            );
29
        });
30

UNCOV
31
        return this;
×
32
    }
33

34
    public detachKeyboardHandlers() {
UNCOV
35
        if (this.eventUnsubscribeFn) {
×
UNCOV
36
            this.eventUnsubscribeFn();
×
UNCOV
37
            this.eventUnsubscribeFn = null;
×
38
        }
39

UNCOV
40
        this.keyHandlers.clear();
×
41
    }
42

43
    public set(key : string, handler: (event: KeyboardEvent) => void) {
UNCOV
44
        this.keyHandlers.set(key, handler);
×
UNCOV
45
        return this;
×
46
    }
47

48
    public unset(key: string) {
49
        this.keyHandlers.delete(key);
×
50
        return this;
×
51
    }
52
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc