File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
addons/point_of_sale/static/tests/generic_helpers Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { ConnectionLostError } from "@web/core/network/rpc";
4
4
const originalFetch = window . fetch ;
5
5
const originalSend = XMLHttpRequest . prototype . send ;
6
6
const originalConsoleError = console . error ;
7
+ const originalNavigatorOnLine = navigator . onLine ;
7
8
8
9
export function setOfflineMode ( ) {
9
10
return run ( ( ) => {
@@ -20,6 +21,11 @@ export function setOfflineMode() {
20
21
} else {
21
22
originalConsoleError . apply ( console , args ) ;
22
23
}
24
+
25
+ Object . defineProperty ( navigator , "onLine" , {
26
+ get : ( ) => false ,
27
+ configurable : true ,
28
+ } ) ;
23
29
} ;
24
30
} , "Offline mode is now enabled" ) ;
25
31
}
@@ -29,5 +35,9 @@ export function setOnlineMode() {
29
35
window . fetch = originalFetch ;
30
36
XMLHttpRequest . prototype . send = originalSend ;
31
37
console . error = originalConsoleError ;
38
+ Object . defineProperty ( navigator , "onLine" , {
39
+ get : ( ) => originalNavigatorOnLine ,
40
+ configurable : true ,
41
+ } ) ;
32
42
} , "Offline mode is now disabled" ) ;
33
43
}
You can’t perform that action at this time.
0 commit comments