Quellcode durchsuchen

fix: Sorting of Pagelinks in Query tables

sallto vor 3 Jahren
Ursprung
Commit
2883bae097
2 geänderte Dateien mit 11 neuen und 2 gelöschten Zeilen
  1. 1 1
      src/main/frontend/format/block.cljs
  2. 10 1
      src/test/frontend/format/block_test.cljs

+ 1 - 1
src/main/frontend/format/block.cljs

@@ -59,7 +59,7 @@ and handles unexpected failure."
   "Normalizes supported formats such as dates and percentages."
   ([block]
    (->> [normalize-as-percentage normalize-as-date identity]
-        (map #(% block))
+        (map #(% (if (set? block) (first block) block)))
         (remove nil?)
         (first))))
 

+ 10 - 1
src/test/frontend/format/block_test.cljs

@@ -9,6 +9,12 @@
          "2022-08-12T00:00:00Z"
 
          "2022-08-12T00:00:00Z"
+         "2022-08-12T00:00:00Z"
+
+         #{"Aug 12th, 2022"}
+         "2022-08-12T00:00:00Z"
+
+         #{"2022-08-12T00:00:00Z"}
          "2022-08-12T00:00:00Z")))
 
 (deftest test-normalize-percentage
@@ -21,7 +27,10 @@
          0
 
          "-5%"
-         -0.05)))
+         -0.05
+
+         #{"50%"}
+         0.5)))
 
 (deftest test-random-values
   (testing "random values should not be processed"