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];
}, {});
}),
...(45false46trueconfig.pipe 47&&|| 48['Stryker was here'][])
];
const updates$: Observable<any> = updates.pipe.apply(updates, pipes);
if (49true50falseconfig.observable 51!===== 52truefalse) 53{}{
if (54false55trueproperties.length 56<=57>=> 1) 58{}{
59false60truethis[key] = {};
}
updates$.subscribe(value => 61{}{
62false63truethis[key] = value;
});
} else 64{}{
65true66falsethis[key] = updates$;
}
ngOnInit.call(this);
};
67false68trueproto.ngOnDestroy = function(): void 69{}{
observer.disconnect();
ngOnDestroy.call(this);
};
};
}
# | Mutator | State | Location | Original | Replacement |
---|---|---|---|---|---|
0 | Block | RuntimeError | 31 : 91 | {
... };
} |
{} |
1 | ConditionalExpression | Killed | 32 : 20 | [ ... " |
|
2 | ConditionalExpression | Killed | 32 : 20 | [ ... " |
|
3 | BinaryExpression | Killed | 32 : 44 | - |
+ |
4 | BinaryExpression | Killed | 32 : 49 | === |
!== |
5 | StringLiteral | RuntimeError | 32 : 53 | " " |
"" |
6 | Block | Killed | 34 : 61 | {
... } |
{} |
7 | ConditionalExpression | Killed | 39 : 28 | . > |
|
8 | ConditionalExpression | Killed | 39 : 28 | . > |
|
9 | BinaryExpression | Killed | 39 : 40 | > |
<= |
10 | BinaryExpression | Killed | 39 : 40 | > |
>= |
11 | ArrayLiteral | Killed | 39 : 53 | [ .... "")] |
[] |
12 | StringLiteral | Killed | 39 : 73 | "" |
" ... !" |
13 | ConditionalExpression | Killed | 40 : 8 | . ... } |
|
14 | ConditionalExpression | Killed | 40 : 8 | . ... } |
|
15 | Block | Killed | 40 : 42 | {
... } |
{} |
16 | ConditionalExpression | Survived | 43 : 54 | . > |
|
17 | ConditionalExpression | Survived | 43 : 54 | . > |
|
18 | BinaryExpression | Survived | 43 : 66 | > |
>= |
19 | BinaryExpression | Survived | 43 : 66 | > |
<= |
20 | Block | Killed | 45 : 29 | {
... } |
{} |
21 | ConditionalExpression | Killed | 46 : 16 | = ... )) |
|
22 | ConditionalExpression | Killed | 46 : 16 | = ... )) |
|
23 | ArrowFunction | Killed | 46 : 53 | ( ... ) |
() => |
24 | ArrayLiteral | Killed | 50 : 26 | [
... ] |
[] |
25 | ArrowFunction | Killed | 51 : 23 | => !! |
() => |
26 | PrefixUnaryExpression | Killed | 51 : 34 | !! |
! |
27 | PrefixUnaryExpression | Killed | 51 : 35 | ! |
|
28 | Block | Killed | 52 : 56 | {
... } |
{} |
29 | ConditionalExpression | Survived | 53 : 70 | . > |
|
30 | ConditionalExpression | Survived | 53 : 70 | . > |
|
31 | BinaryExpression | Survived | 53 : 88 | > |
>= |
32 | BinaryExpression | Survived | 53 : 88 | > |
<= |
33 | ArrowFunction | Killed | 55 : 23 | => !== |
() => |
34 | ConditionalExpression | Killed | 55 : 32 | !== |
|
35 | ConditionalExpression | Survived | 55 : 32 | !== |
|
36 | BinaryExpression | Killed | 55 : 38 | !== |
=== |
37 | Block | Killed | 56 : 35 | { // ... } |
{} |
38 | Block | RuntimeError | 57 : 68 | {
... } |
{} |
39 | ConditionalExpression | Killed | 58 : 24 | [ ]...[ ] |
|
40 | ConditionalExpression | Killed | 58 : 24 | [ ]...[ ] |
|
41 | ConditionalExpression | Killed | 60 : 31 | . > |
|
42 | ConditionalExpression | Killed | 60 : 31 | . > |
|
43 | BinaryExpression | Killed | 60 : 49 | > |
>= |
44 | BinaryExpression | Killed | 60 : 49 | > |
<= |
45 | ConditionalExpression | RuntimeError | 63 : 20 | . || [] |
|
46 | ConditionalExpression | RuntimeError | 63 : 20 | . || [] |
|
47 | BinaryExpression | Killed | 63 : 32 | || |
&& |
48 | ArrayLiteral | Killed | 63 : 35 | [] |
[' ... '] |
49 | IfStatement | Killed | 68 : 16 | . === |
|
50 | IfStatement | Killed | 68 : 16 | . === |
|
51 | BinaryExpression | Killed | 68 : 34 | === |
!== |
52 | BooleanSubstitution | Killed | 68 : 38 |
|
|
53 | Block | Killed | 68 : 45 | {
... } |
{} |
54 | IfStatement | Survived | 69 : 20 | . > |
|
55 | IfStatement | Survived | 69 : 20 | . > |
|
56 | BinaryExpression | Survived | 69 : 38 | > |
<= |
57 | BinaryExpression | Survived | 69 : 38 | > |
>= |
58 | Block | Survived | 69 : 43 | {
... } |
{} |
59 | ConditionalExpression | Survived | 70 : 20 | [ ] = {} |
|
60 | ConditionalExpression | Survived | 70 : 20 | [ ] = {} |
|
61 | Block | Killed | 73 : 44 | {
... } |
{} |
62 | ConditionalExpression | Killed | 74 : 20 | [ ] = |
|
63 | ConditionalExpression | Killed | 74 : 20 | [ ] = |
|
64 | Block | Killed | 76 : 19 | {
... } |
{} |
65 | ConditionalExpression | Killed | 77 : 16 | [ ]... $ |
|
66 | ConditionalExpression | Killed | 77 : 16 | [ ]... $ |
|
67 | ConditionalExpression | Killed | 83 : 8 | . ... } |
|
68 | ConditionalExpression | Killed | 83 : 8 | . ... } |
|
69 | Block | Killed | 83 : 45 | {
... } |
{} |