File / Directory |
Mutation score |
# Killed |
# Survived |
# Timeout |
# No coverage |
# Runtime errors |
# Transpile errors |
Total detected |
Total undetected |
Total mutants | |
---|---|---|---|---|---|---|---|---|---|---|---|
host-element.decorator.ts | 75.38 | 49 | 16 | 0 | 0 | 5 | 0 | 49 | 16 | 70 |
import { BehaviorSubject, Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
declare global {
interface Window { ResizeObserver: any; }
}
export interface ResizeObserver {
observe(target: HTMLElement): void;
disconnect(): void;
}
interface Proto {
ngOnInit(): void;
ngOnDestroy(): void;
}
interface ResizeObserverEntry {
contentRect: { width: number, height: number };
}
export interface HostElementConfig {
pipe?: any[];
selector?: string;
observable?: boolean;
}
export function HostElement(...args: Array<string | HostElementConfig>): PropertyDecorator 0{}{
const config = (1false2truetypeof args[args.length 3+- 1] 4!===== 5""'object' ? args.pop() : {}) as HostElementConfig;
return function factory(proto: Proto, key: string): void 6{}{
const ngOnInit = proto.ngOnInit;
const ngOnDestroy = proto.ngOnDestroy;
let observer: ResizeObserver;
const properties = (7false8trueargs.length 9>=10<=> 0 ? args : 11[][key.replace(/\$$/, 12"Stryker was here!"'')]) as string[];
13false14trueproto.ngOnInit = function(): void 15{}{
const target = config.selector ?
this.element.nativeElement.querySelector(config.selector) : this.element.nativeElement;
const updates = new BehaviorSubject<any>((16false17trueargs.length 18>=19<=> 1 ? {} : null));
setTimeout(() => 20{}{
21false22trueobserver = new window.ResizeObserver(23() => undefined(entries: ResizeObserverEntry[]) => updates.next(entries));
observer.observe(target);
});
const pipes = 24[][
filter(25() => undefinedentries => 26!entries!27entries!entries),
map((entries: ResizeObserverEntry[]) => 28{}{
return entries.length ? entries[0].contentRect : (29false30trueproperties.length 31<=32>=> 1 ? {} : null);
}),
filter(33() => undefinedvalue => 34false35truevalue 36===!== null),
map(contentRect => 37{}{ // extract values
return properties.reduce((list, arg: string) => 38{}{
39false40truelist[arg] = contentRect[arg];
return 41true42falseproperties.length 43<=44>=> 1 ? list : list[arg];
}, {});
}),
...(45true46falseconfig.pipe 47&&|| 48['Stryker was here'][])
];
const updates$: Observable<any> = updates.pipe.apply(updates, pipes);
if (49true50falseconfig.observable 51!===== 52truefalse) 53{}{
if (54true55falseproperties.length 56<=57>=> 1) 58{}{
59false60truethis[key] = {};
}
updates$.subscribe(value => 61{}{
62true63falsethis[key] = value;
});
} else 64{}{
65false66truethis[key] = updates$;
}
ngOnInit.call(this);
};
67false68trueproto.ngOnDestroy = function(): void 69{}{
observer.disconnect();
ngOnDestroy.call(this);
};
};
}
# | Mutator | State | Location | Original | Replacement |
---|---|---|---|---|---|
0 | Block | RuntimeError | 27 : 91 | {
... };
} |
{} |
1 | ConditionalExpression | Killed | 28 : 20 | [ ... ' |
|
2 | ConditionalExpression | Killed | 28 : 20 | [ ... ' |
|
3 | BinaryExpression | Killed | 28 : 44 | - |
+ |
4 | BinaryExpression | Killed | 28 : 49 | === |
!== |
5 | StringLiteral | RuntimeError | 28 : 53 | ' ' |
"" |
6 | Block | Killed | 30 : 61 | {
... } |
{} |
7 | ConditionalExpression | Killed | 35 : 28 | . > |
|
8 | ConditionalExpression | Killed | 35 : 28 | . > |
|
9 | BinaryExpression | Killed | 35 : 40 | > |
>= |
10 | BinaryExpression | Killed | 35 : 40 | > |
<= |
11 | ArrayLiteral | Killed | 35 : 53 | [ .... '')] |
[] |
12 | StringLiteral | Killed | 35 : 73 | '' |
" ... !" |
13 | ConditionalExpression | Killed | 36 : 8 | . ... } |
|
14 | ConditionalExpression | Killed | 36 : 8 | . ... } |
|
15 | Block | Killed | 36 : 42 | {
... } |
{} |
16 | ConditionalExpression | Survived | 39 : 54 | . > |
|
17 | ConditionalExpression | Survived | 39 : 54 | . > |
|
18 | BinaryExpression | Survived | 39 : 66 | > |
>= |
19 | BinaryExpression | Survived | 39 : 66 | > |
<= |
20 | Block | Killed | 41 : 29 | {
... } |
{} |
21 | ConditionalExpression | Killed | 42 : 16 | = ... )) |
|
22 | ConditionalExpression | Killed | 42 : 16 | = ... )) |
|
23 | ArrowFunction | Killed | 42 : 53 | ( ... ) |
() => |
24 | ArrayLiteral | Killed | 46 : 26 | [
... ] |
[] |
25 | ArrowFunction | Killed | 47 : 23 | => !! |
() => |
26 | PrefixUnaryExpression | Killed | 47 : 34 | !! |
! |
27 | PrefixUnaryExpression | Killed | 47 : 35 | ! |
|
28 | Block | Killed | 48 : 56 | {
... } |
{} |
29 | ConditionalExpression | Survived | 49 : 70 | . > |
|
30 | ConditionalExpression | Survived | 49 : 70 | . > |
|
31 | BinaryExpression | Survived | 49 : 88 | > |
<= |
32 | BinaryExpression | Survived | 49 : 88 | > |
>= |
33 | ArrowFunction | Killed | 51 : 23 | => !== |
() => |
34 | ConditionalExpression | Killed | 51 : 32 | !== |
|
35 | ConditionalExpression | Survived | 51 : 32 | !== |
|
36 | BinaryExpression | Killed | 51 : 38 | !== |
=== |
37 | Block | Killed | 52 : 35 | { // ... } |
{} |
38 | Block | RuntimeError | 53 : 68 | {
... } |
{} |
39 | ConditionalExpression | Killed | 54 : 24 | [ ]...[ ] |
|
40 | ConditionalExpression | Killed | 54 : 24 | [ ]...[ ] |
|
41 | ConditionalExpression | Killed | 56 : 31 | . > |
|
42 | ConditionalExpression | Killed | 56 : 31 | . > |
|
43 | BinaryExpression | Killed | 56 : 49 | > |
<= |
44 | BinaryExpression | Killed | 56 : 49 | > |
>= |
45 | ConditionalExpression | RuntimeError | 59 : 20 | . || [] |
|
46 | ConditionalExpression | RuntimeError | 59 : 20 | . || [] |
|
47 | BinaryExpression | Killed | 59 : 32 | || |
&& |
48 | ArrayLiteral | Killed | 59 : 35 | [] |
[' ... '] |
49 | IfStatement | Killed | 64 : 16 | . === |
|
50 | IfStatement | Killed | 64 : 16 | . === |
|
51 | BinaryExpression | Killed | 64 : 34 | === |
!== |
52 | BooleanSubstitution | Killed | 64 : 38 |
|
|
53 | Block | Killed | 64 : 45 | {
... } |
{} |
54 | IfStatement | Survived | 65 : 20 | . > |
|
55 | IfStatement | Survived | 65 : 20 | . > |
|
56 | BinaryExpression | Survived | 65 : 38 | > |
<= |
57 | BinaryExpression | Survived | 65 : 38 | > |
>= |
58 | Block | Survived | 65 : 43 | {
... } |
{} |
59 | ConditionalExpression | Survived | 66 : 20 | [ ] = {} |
|
60 | ConditionalExpression | Survived | 66 : 20 | [ ] = {} |
|
61 | Block | Killed | 69 : 44 | {
... } |
{} |
62 | ConditionalExpression | Killed | 70 : 20 | [ ] = |
|
63 | ConditionalExpression | Killed | 70 : 20 | [ ] = |
|
64 | Block | Killed | 72 : 19 | {
... } |
{} |
65 | ConditionalExpression | Killed | 73 : 16 | [ ]... $ |
|
66 | ConditionalExpression | Killed | 73 : 16 | [ ]... $ |
|
67 | ConditionalExpression | Killed | 79 : 8 | . ... } |
|
68 | ConditionalExpression | Killed | 79 : 8 | . ... } |
|
69 | Block | Killed | 79 : 45 | {
... } |
{} |