✔️ Allow for tests of data module at frontend

This commit is contained in:
Andrés Moya 2021-01-15 10:52:17 +01:00 committed by Andrey Antukh
parent 87cf91a044
commit bde62473a4
5 changed files with 110 additions and 4 deletions

View file

@ -13,6 +13,7 @@
[app.common.data :as d]
[app.common.spec :as us]
[app.common.version :as v]
[app.util.globals :as globals]
[app.util.object :as obj]
[app.util.dom :as dom]
[app.util.avatars :as avatars]
@ -73,7 +74,7 @@
(def login-with-ldap (obj/get global "appLoginWithLDAP" false))
(def worker-uri (obj/get global "appWorkerURI" "/js/worker.js"))
(def public-uri (or (obj/get global "appPublicURI")
(.-origin ^js js/location)))
(.-origin ^js globals/location)))
(def media-uri (str public-uri "/assets"))
(def version (delay (parse-version global)))
(def target (delay (parse-target global)))

View file

@ -10,7 +10,8 @@
[beicon.core :as rx]
[app.main.store :as st]
[app.main.refs :as refs]
[app.common.geom.point :as gpt]))
[app.common.geom.point :as gpt]
[app.util.globals :as globals]))
;; --- User Events
@ -103,7 +104,7 @@
(defonce window-blur
(->> (rx/from-event js/window "blur")
(->> (rx/from-event globals/window "blur")
(rx/share)))
(defonce keyboard-alt

View file

@ -0,0 +1,42 @@
/**
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This Source Code Form is "Incompatible With Secondary Licenses", as
* defined by the Mozilla Public License, v. 2.0.
*
* Copyright (c) 2020 UXBOX Labs SL
*/
/*
* Provide instances of some javascript global objects, by looking for
* them in the browser, the current worker or creating a dummy for test
* environment.
*/
"use strict";
goog.provide("app.util.globals");
goog.scope(function() {
var win;
if (typeof goog.global.window !== "undefined") {
win = goog.global.window;
} else {
win = {};
}
app.util.globals.window = win;
var loc;
if (typeof goog.global.location !== "undefined") {
loc = goog.global.location;
} else {
loc = {};
}
app.util.globals.location = loc;
});