Skip to content

Commit f5fe448

Browse files
committed
Added mocks-ionic to project
1 parent 3ff57ce commit f5fe448

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

test-config/mocks-ionic.ts

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
export class PlatformMock {
2+
public ready(): Promise<{String}> {
3+
return new Promise((resolve) => {
4+
resolve('READY');
5+
});
6+
}
7+
8+
public getQueryParam() {
9+
return true;
10+
}
11+
12+
public registerBackButtonAction(fn: Function, priority?: number): Function {
13+
return (() => true);
14+
}
15+
16+
public hasFocus(ele: HTMLElement): boolean {
17+
return true;
18+
}
19+
20+
public doc(): HTMLDocument {
21+
return document;
22+
}
23+
24+
public is(): boolean {
25+
return true;
26+
}
27+
28+
public getElementComputedStyle(container: any): any {
29+
return {
30+
paddingLeft: '10',
31+
paddingTop: '10',
32+
paddingRight: '10',
33+
paddingBottom: '10',
34+
};
35+
}
36+
37+
public onResize(callback: any) {
38+
return callback;
39+
}
40+
41+
public registerListener(ele: any, eventName: string, callback: any): Function {
42+
return (() => true);
43+
}
44+
45+
public win(): Window {
46+
return window;
47+
}
48+
49+
public raf(callback: any): number {
50+
return 1;
51+
}
52+
53+
public timeout(callback: any, timer: number): any {
54+
return setTimeout(callback, timer);
55+
}
56+
57+
public cancelTimeout(id: any) {
58+
// do nothing
59+
}
60+
61+
public getActiveElement(): any {
62+
return document['activeElement'];
63+
}
64+
}

0 commit comments

Comments
 (0)