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

IgniteUI / igniteui-angular / 13331632524

14 Feb 2025 02:51PM CUT 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

0.0
/projects/igniteui-angular/src/lib/services/overlay/scroll/block-scroll-strategy.ts
1
import { ScrollStrategy } from './scroll-strategy';
2

3
/**
4
 * Prevents scrolling while the overlay content is shown.
5
 */
6
export class BlockScrollStrategy extends ScrollStrategy {
UNCOV
7
    private _initialized = false;
×
8
    private _document: Document;
9
    private _initialScrollTop: number;
10
    private _initialScrollLeft: number;
11
    private _sourceElement: Element;
12

13
    constructor() {
UNCOV
14
        super();
×
15
    }
16

17
    /**
18
     * Initializes the strategy. Should be called once
19
     *
20
     */
21
    public initialize(document: Document) {
UNCOV
22
        if (this._initialized) {
×
23
            return;
×
24
        }
25

UNCOV
26
        this._document = document;
×
UNCOV
27
        this._initialized = true;
×
28
    }
29

30
    /**
31
     * Attaches the strategy
32
     * ```typescript
33
     * settings.scrollStrategy.attach();
34
     * ```
35
     */
36
    public attach(): void {
UNCOV
37
        this._document.addEventListener('scroll', this.onScroll, true);
×
38
    }
39

40
    /**
41
     * Detaches the strategy
42
     * ```typescript
43
     * settings.scrollStrategy.detach();
44
     * ```
45
     */
46
    public detach(): void {
UNCOV
47
        this._document.removeEventListener('scroll', this.onScroll, true);
×
UNCOV
48
        this._sourceElement = null;
×
UNCOV
49
        this._initialScrollTop = 0;
×
UNCOV
50
        this._initialScrollLeft = 0;
×
UNCOV
51
        this._initialized = false;
×
52
    }
53

UNCOV
54
    private onScroll = (ev: Event) => {
×
UNCOV
55
        ev.preventDefault();
×
UNCOV
56
        if (!this._sourceElement || this._sourceElement !== ev.target) {
×
UNCOV
57
            this._sourceElement = ev.target as Element;
×
UNCOV
58
            this._initialScrollTop = this._sourceElement.scrollTop;
×
UNCOV
59
            this._initialScrollLeft = this._sourceElement.scrollLeft;
×
60
        }
61

UNCOV
62
        this._sourceElement.scrollTop = this._initialScrollTop;
×
UNCOV
63
        this._sourceElement.scrollLeft = this._initialScrollLeft;
×
64
    };
65
}
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