• 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

78.72
/projects/igniteui-angular/src/lib/grids/watch-changes.ts
1
import { SimpleChanges, SimpleChange } from '@angular/core';
2

3
/**
4
 * @hidden
5
 */
6
export function WatchChanges(): PropertyDecorator {
7
    return (target: any, key: string, propDesc?: PropertyDescriptor) => {
36✔
8
        const privateKey = '_' + key.toString();
36✔
9
        propDesc = propDesc || {
36!
10
            configurable: true,
11
            enumerable: true,
12
        };
13
        propDesc.get = propDesc.get || (function (this: any) {
36!
14
            return this[privateKey];
×
15
        });
16
        const originalSetter = propDesc.set || (function (this: any, val: any) {
36!
17
            this[privateKey] = val;
×
18
        });
19

20
        propDesc.set = function (this: any, val: any) {
36✔
21
            const init = this._init;
88✔
22
            const oldValue = this[key];
88✔
23
            if (val !== oldValue || (typeof val === 'object' && val === oldValue)) {
88✔
24
                originalSetter.call(this, val);
86✔
25
                if (this.ngOnChanges && !init) {
86!
26
                    // in case wacthed prop changes trigger ngOnChanges manually
UNCOV
27
                    const changes: SimpleChanges = {
×
28
                        [key]: new SimpleChange(oldValue, val, false)
29
                    };
UNCOV
30
                    this.ngOnChanges(changes);
×
31
                }
32
            }
33
        };
34
        return propDesc;
36✔
35
    };
36
}
37

38
export function WatchColumnChanges(): PropertyDecorator {
39
    return (target: any, key: string, propDesc?: PropertyDescriptor) => {
74✔
40
        const privateKey = '_' + key.toString();
74✔
41
        propDesc = propDesc || {
74✔
42
            configurable: true,
43
            enumerable: true,
44
        };
45
        propDesc.get = propDesc.get || (function (this: any) {
74✔
46
            return this[privateKey];
72,521✔
47
        });
48
        const originalSetter = propDesc.set || (function (this: any, val: any) {
74✔
49
            this[privateKey] = val;
4,292✔
50
        });
51

52
        propDesc.set = function (this: any, val: any) {
74✔
53
            const oldValue = this[key];
4,867✔
54
            originalSetter.call(this, val);
4,867✔
55
            if (val !== oldValue || (typeof val === 'object' && val === oldValue)) {
4,867!
56
                if (this.columnChange) {
4,840✔
57
                    this.columnChange.emit();
3,286✔
58
                }
59
            }
60
        };
61
        return propDesc;
74✔
62
    };
63
}
64

65
export function notifyChanges(repaint = false) {
46✔
66
    return (_: any, key: string, propDesc?: PropertyDescriptor) => {
58✔
67

68
        const privateKey = `__${key}`;
58✔
69

70
        propDesc = propDesc || {
58!
71
            enumerable: true,
72
            configurable: true
73
        };
74

75

76
        const originalSetter = propDesc ? propDesc.set : null;
58!
77
        propDesc.get = propDesc.get || (function (this) {
58!
78
            return this[privateKey];
×
79
        });
80

81
        propDesc.set = function (this, newValue) {
58✔
82
            if (originalSetter) {
3,564!
83
                originalSetter.call(this, newValue);
3,564✔
84
                if (this.grid) {
3,564✔
85
                    this.grid.notifyChanges(repaint && this.type !== 'pivot');
3,564✔
86
                }
87
            } else {
88
                if (newValue === this[key]) {
×
89
                    return;
×
90
                }
91
                this[privateKey] = newValue;
×
92
                if (this.grid) {
×
93
                    this.grid.notifyChanges(repaint && this.type !== 'pivot');
×
94
                }
95
            }
96
        };
97
        return propDesc as any;
58✔
98
    };
99
}
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