File / Directory |
Mutation score |
# Killed |
# Survived |
# Timeout |
# No coverage |
# Runtime errors |
# Transpile errors |
Total detected |
Total undetected |
Total mutants | |
---|---|---|---|---|---|---|---|---|---|---|---|
host-element.decorator.ts | 75.41 | 46 | 15 | 0 | 0 | 8 | 0 | 46 | 15 | 69 |
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Observable } from 'rxjs/Observable';
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 = (7true8falseargs.length 9<=10>=> 0 ? args : 11[][key.replace(/\$$/, 12"Stryker was here!"'')]) as Array<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 updates$: Observable<any> = updates.pipe(
filter(24() => undefinedentries => 25!entries!26entries!entries),
map((entries: ResizeObserverEntry[]) => 27{}{
return entries.length ? entries[0].contentRect : (28false29trueproperties.length 30>=31<=> 1 ? {} : null);
}),
filter(32() => undefinedvalue => 33false34truevalue 35===!== null),
map(contentRect => 36{}{ // extract values
return properties.reduce((list, arg: string) => 37{}{
38false39truelist[arg] = contentRect[arg];
return 40false41trueproperties.length 42<=43>=> 1 ? list : list[arg];
}, {});
}),
...(44false45trueconfig.pipe 46&&|| 47['Stryker was here'][]),
);
if (48true49falseconfig.observable 50!===== 51truefalse) 52{}{
if (53false54trueproperties.length 55<=56>=> 1) 57{}{
58false59truethis[key] = {};
}
updates$.subscribe(value => 60{}{
61false62truethis[key] = value;
});
} else 63{}{
64false65truethis[key] = updates$;
}
ngOnInit.call(this);
};
66false67trueproto.ngOnDestroy = function(): void 68{}{
observer.disconnect();
ngOnDestroy.call(this);
};
};
}
# | Mutator | State | Location | Original | Replacement |
---|---|---|---|---|---|
0 | Block | RuntimeError | 28 : 91 | {
... };
} |
{} |
1 | ConditionalExpression | Killed | 29 : 20 | [ ... ' |
|
2 | ConditionalExpression | Killed | 29 : 20 | [ ... ' |
|
3 | BinaryExpression | Killed | 29 : 44 | - |
+ |
4 | BinaryExpression | Killed | 29 : 49 | === |
!== |
5 | StringLiteral | RuntimeError | 29 : 53 | ' ' |
"" |
6 | Block | Killed | 31 : 61 | {
... } |
{} |
7 | ConditionalExpression | Killed | 36 : 28 | . > |
|
8 | ConditionalExpression | Killed | 36 : 28 | . > |
|
9 | BinaryExpression | Killed | 36 : 40 | > |
<= |
10 | BinaryExpression | Killed | 36 : 40 | > |
>= |
11 | ArrayLiteral | Killed | 36 : 53 | [ .... '')] |
[] |
12 | StringLiteral | Killed | 36 : 73 | '' |
" ... !" |
13 | ConditionalExpression | Killed | 37 : 8 | . ... } |
|
14 | ConditionalExpression | Killed | 37 : 8 | . ... } |
|
15 | Block | Killed | 37 : 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 | ArrowFunction | Killed | 47 : 23 | => !! |
() => |
25 | PrefixUnaryExpression | Killed | 47 : 34 | !! |
! |
26 | PrefixUnaryExpression | Killed | 47 : 35 | ! |
|
27 | Block | Killed | 48 : 56 | {
... } |
{} |
28 | ConditionalExpression | Survived | 49 : 70 | . > |
|
29 | ConditionalExpression | Survived | 49 : 70 | . > |
|
30 | BinaryExpression | Survived | 49 : 88 | > |
>= |
31 | BinaryExpression | Survived | 49 : 88 | > |
<= |
32 | ArrowFunction | Killed | 51 : 23 | => !== |
() => |
33 | ConditionalExpression | Killed | 51 : 32 | !== |
|
34 | ConditionalExpression | Survived | 51 : 32 | !== |
|
35 | BinaryExpression | Killed | 51 : 38 | !== |
=== |
36 | Block | Killed | 52 : 35 | { // ... } |
{} |
37 | Block | RuntimeError | 53 : 68 | {
... } |
{} |
38 | ConditionalExpression | Killed | 54 : 24 | [ ]...[ ] |
|
39 | ConditionalExpression | Killed | 54 : 24 | [ ]...[ ] |
|
40 | ConditionalExpression | Killed | 56 : 31 | . > |
|
41 | ConditionalExpression | Killed | 56 : 31 | . > |
|
42 | BinaryExpression | Killed | 56 : 49 | > |
<= |
43 | BinaryExpression | Killed | 56 : 49 | > |
>= |
44 | ConditionalExpression | RuntimeError | 59 : 20 | . || [] |
|
45 | ConditionalExpression | RuntimeError | 59 : 20 | . || [] |
|
46 | BinaryExpression | Killed | 59 : 32 | || |
&& |
47 | ArrayLiteral | Killed | 59 : 35 | [] |
[' ... '] |
48 | IfStatement | RuntimeError | 62 : 16 | . === |
|
49 | IfStatement | RuntimeError | 62 : 16 | . === |
|
50 | BinaryExpression | Killed | 62 : 34 | === |
!== |
51 | BooleanSubstitution | Killed | 62 : 38 |
|
|
52 | Block | Killed | 62 : 45 | {
... } |
{} |
53 | IfStatement | RuntimeError | 63 : 20 | . > |
|
54 | IfStatement | Survived | 63 : 20 | . > |
|
55 | BinaryExpression | Survived | 63 : 38 | > |
<= |
56 | BinaryExpression | Survived | 63 : 38 | > |
>= |
57 | Block | Survived | 63 : 43 | {
... } |
{} |
58 | ConditionalExpression | Survived | 64 : 20 | [ ] = {} |
|
59 | ConditionalExpression | Survived | 64 : 20 | [ ] = {} |
|
60 | Block | Killed | 67 : 44 | {
... } |
{} |
61 | ConditionalExpression | Killed | 68 : 20 | [ ] = |
|
62 | ConditionalExpression | Killed | 68 : 20 | [ ] = |
|
63 | Block | Killed | 70 : 19 | {
... } |
{} |
64 | ConditionalExpression | Killed | 71 : 16 | [ ]... $ |
|
65 | ConditionalExpression | Killed | 71 : 16 | [ ]... $ |
|
66 | ConditionalExpression | Killed | 77 : 8 | . ... } |
|
67 | ConditionalExpression | Killed | 77 : 8 | . ... } |
|
68 | Block | Killed | 77 : 45 | {
... } |
{} |