mirror of
https://github.com/penpot/penpot.git
synced 2025-04-12 06:51:23 -05:00
🐛 Fix frontend tests
This commit is contained in:
parent
d946aceacb
commit
dd6bd6bbff
5 changed files with 31 additions and 9 deletions
|
@ -16,7 +16,7 @@
|
|||
(s/def ::frame-id uuid?)
|
||||
(s/def ::id uuid?)
|
||||
(s/def ::name string?)
|
||||
(s/def ::path string?)
|
||||
(s/def ::path (s/nilable string?))
|
||||
(s/def ::page-id uuid?)
|
||||
(s/def ::parent-id uuid?)
|
||||
(s/def ::string string?)
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
commit-local? false}
|
||||
:as opts}]
|
||||
(us/verify ::cp/changes changes)
|
||||
;; (us/verify ::cp/changes undo-changes)
|
||||
(us/verify ::cp/changes undo-changes)
|
||||
(log/debug :msg "commit-changes"
|
||||
:js/changes changes
|
||||
:js/undo-changes undo-changes)
|
||||
|
|
|
@ -20,11 +20,23 @@ goog.provide("app.util.globals");
|
|||
goog.scope(function() {
|
||||
app.util.globals.global = goog.global;
|
||||
|
||||
function createGlobalEventEmiter(k) {
|
||||
/* Allow mocked objects to be event emitters, so other modules
|
||||
* may subscribe to them.
|
||||
*/
|
||||
return {
|
||||
addListener(...args) {
|
||||
},
|
||||
removeListener(...args) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
app.util.globals.window = (function() {
|
||||
if (typeof goog.global.window !== "undefined") {
|
||||
return goog.global.window;
|
||||
} else {
|
||||
return {};
|
||||
return createGlobalEventEmiter();
|
||||
}
|
||||
})();
|
||||
|
||||
|
@ -32,7 +44,7 @@ goog.scope(function() {
|
|||
if (typeof goog.global.document !== "undefined") {
|
||||
return goog.global.document;
|
||||
} else {
|
||||
return {};
|
||||
return createGlobalEventEmiter();
|
||||
}
|
||||
})();
|
||||
|
||||
|
@ -40,7 +52,7 @@ goog.scope(function() {
|
|||
if (typeof goog.global.location !== "undefined") {
|
||||
return goog.global.location;
|
||||
} else {
|
||||
return {};
|
||||
return createGlobalEventEmiter();
|
||||
}
|
||||
})();
|
||||
|
||||
|
@ -48,7 +60,15 @@ goog.scope(function() {
|
|||
if (typeof goog.global.navigator !== "undefined") {
|
||||
return goog.global.navigator;
|
||||
} else {
|
||||
return {};
|
||||
return createGlobalEventEmiter();
|
||||
}
|
||||
})();
|
||||
|
||||
app.util.globals.FormData = (function() {
|
||||
if (typeof goog.global.FormData !== "undefined") {
|
||||
return goog.global.FormData;
|
||||
} else {
|
||||
return function() {};
|
||||
}
|
||||
})();
|
||||
});
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.config :as cfg]
|
||||
[app.util.globals :as globals]
|
||||
[app.util.object :as obj]
|
||||
[app.util.transit :as t]
|
||||
[beicon.core :as rx]
|
||||
|
@ -22,7 +23,7 @@
|
|||
(-get-body-data [_]))
|
||||
|
||||
(extend-protocol IBodyData
|
||||
js/FormData
|
||||
globals/FormData
|
||||
(-get-body-data [it] it)
|
||||
(-update-headers [it headers]
|
||||
(dissoc headers "content-type" "Content-Type"))
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
"A i18n foundation."
|
||||
(:require
|
||||
[app.config :as cfg]
|
||||
[app.util.globals :as globals]
|
||||
[app.util.storage :refer [storage]]
|
||||
[app.util.transit :as t]
|
||||
[beicon.core :as rx]
|
||||
|
@ -28,7 +29,7 @@
|
|||
|
||||
(defn- parse-locale
|
||||
[locale]
|
||||
(let [locale (-> (.-language js/navigator)
|
||||
(let [locale (-> (.-language globals/navigator)
|
||||
(str/lower)
|
||||
(str/replace "-" "_"))]
|
||||
(cond-> [locale]
|
||||
|
@ -37,7 +38,7 @@
|
|||
|
||||
(def ^:private browser-locales
|
||||
(delay
|
||||
(-> (.-language js/navigator)
|
||||
(-> (.-language globals/navigator)
|
||||
(parse-locale))))
|
||||
|
||||
(defn- autodetect
|
||||
|
|
Loading…
Add table
Reference in a new issue