mirror of
https://github.com/penpot/penpot.git
synced 2025-05-05 18:55:54 +02: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 ::frame-id uuid?)
|
||||||
(s/def ::id uuid?)
|
(s/def ::id uuid?)
|
||||||
(s/def ::name string?)
|
(s/def ::name string?)
|
||||||
(s/def ::path string?)
|
(s/def ::path (s/nilable string?))
|
||||||
(s/def ::page-id uuid?)
|
(s/def ::page-id uuid?)
|
||||||
(s/def ::parent-id uuid?)
|
(s/def ::parent-id uuid?)
|
||||||
(s/def ::string string?)
|
(s/def ::string string?)
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
commit-local? false}
|
commit-local? false}
|
||||||
:as opts}]
|
:as opts}]
|
||||||
(us/verify ::cp/changes changes)
|
(us/verify ::cp/changes changes)
|
||||||
;; (us/verify ::cp/changes undo-changes)
|
(us/verify ::cp/changes undo-changes)
|
||||||
(log/debug :msg "commit-changes"
|
(log/debug :msg "commit-changes"
|
||||||
:js/changes changes
|
:js/changes changes
|
||||||
:js/undo-changes undo-changes)
|
:js/undo-changes undo-changes)
|
||||||
|
|
|
@ -20,11 +20,23 @@ goog.provide("app.util.globals");
|
||||||
goog.scope(function() {
|
goog.scope(function() {
|
||||||
app.util.globals.global = goog.global;
|
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() {
|
app.util.globals.window = (function() {
|
||||||
if (typeof goog.global.window !== "undefined") {
|
if (typeof goog.global.window !== "undefined") {
|
||||||
return goog.global.window;
|
return goog.global.window;
|
||||||
} else {
|
} else {
|
||||||
return {};
|
return createGlobalEventEmiter();
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
@ -32,7 +44,7 @@ goog.scope(function() {
|
||||||
if (typeof goog.global.document !== "undefined") {
|
if (typeof goog.global.document !== "undefined") {
|
||||||
return goog.global.document;
|
return goog.global.document;
|
||||||
} else {
|
} else {
|
||||||
return {};
|
return createGlobalEventEmiter();
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
@ -40,7 +52,7 @@ goog.scope(function() {
|
||||||
if (typeof goog.global.location !== "undefined") {
|
if (typeof goog.global.location !== "undefined") {
|
||||||
return goog.global.location;
|
return goog.global.location;
|
||||||
} else {
|
} else {
|
||||||
return {};
|
return createGlobalEventEmiter();
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
@ -48,7 +60,15 @@ goog.scope(function() {
|
||||||
if (typeof goog.global.navigator !== "undefined") {
|
if (typeof goog.global.navigator !== "undefined") {
|
||||||
return goog.global.navigator;
|
return goog.global.navigator;
|
||||||
} else {
|
} 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
|
(:require
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[app.config :as cfg]
|
[app.config :as cfg]
|
||||||
|
[app.util.globals :as globals]
|
||||||
[app.util.object :as obj]
|
[app.util.object :as obj]
|
||||||
[app.util.transit :as t]
|
[app.util.transit :as t]
|
||||||
[beicon.core :as rx]
|
[beicon.core :as rx]
|
||||||
|
@ -22,7 +23,7 @@
|
||||||
(-get-body-data [_]))
|
(-get-body-data [_]))
|
||||||
|
|
||||||
(extend-protocol IBodyData
|
(extend-protocol IBodyData
|
||||||
js/FormData
|
globals/FormData
|
||||||
(-get-body-data [it] it)
|
(-get-body-data [it] it)
|
||||||
(-update-headers [it headers]
|
(-update-headers [it headers]
|
||||||
(dissoc headers "content-type" "Content-Type"))
|
(dissoc headers "content-type" "Content-Type"))
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
"A i18n foundation."
|
"A i18n foundation."
|
||||||
(:require
|
(:require
|
||||||
[app.config :as cfg]
|
[app.config :as cfg]
|
||||||
|
[app.util.globals :as globals]
|
||||||
[app.util.storage :refer [storage]]
|
[app.util.storage :refer [storage]]
|
||||||
[app.util.transit :as t]
|
[app.util.transit :as t]
|
||||||
[beicon.core :as rx]
|
[beicon.core :as rx]
|
||||||
|
@ -28,7 +29,7 @@
|
||||||
|
|
||||||
(defn- parse-locale
|
(defn- parse-locale
|
||||||
[locale]
|
[locale]
|
||||||
(let [locale (-> (.-language js/navigator)
|
(let [locale (-> (.-language globals/navigator)
|
||||||
(str/lower)
|
(str/lower)
|
||||||
(str/replace "-" "_"))]
|
(str/replace "-" "_"))]
|
||||||
(cond-> [locale]
|
(cond-> [locale]
|
||||||
|
@ -37,7 +38,7 @@
|
||||||
|
|
||||||
(def ^:private browser-locales
|
(def ^:private browser-locales
|
||||||
(delay
|
(delay
|
||||||
(-> (.-language js/navigator)
|
(-> (.-language globals/navigator)
|
||||||
(parse-locale))))
|
(parse-locale))))
|
||||||
|
|
||||||
(defn- autodetect
|
(defn- autodetect
|
||||||
|
|
Loading…
Add table
Reference in a new issue