mirror of
https://github.com/penpot/penpot.git
synced 2026-10-30 06:20:32 +00:00
🐛 Keep missing-shape diagnostics readable with mixed labels
Sort labels by their printed value so keyword and fallback string labels can appear in the same diagnostic. The failing regression now passes. Validation: schema and runner suites, 44 tests / 119 assertions. AI-assisted-by: GPT-6
This commit is contained in:
parent
418a060ce4
commit
a8bad1c8c8
@ -251,7 +251,7 @@
|
||||
(when (nil? shape)
|
||||
(let [present (->> (vals (:objects page))
|
||||
(map (comp thi/label :id))
|
||||
(sort)
|
||||
(sort-by str)
|
||||
(vec))]
|
||||
(throw (ex-info (str "Unbound shape name: " (pr-str name)
|
||||
". Shapes present in current page: " (pr-str present))
|
||||
|
||||
@ -582,3 +582,10 @@
|
||||
result (n/applied-result duplicate (tm/file before) (tm/file after))
|
||||
new-head (tm/shape-by-id after (:new-head result))]
|
||||
(t/is (= ((n/main-head-of "a") before) (:parent-id new-head)))))
|
||||
|
||||
(t/deftest missing-shape-diagnostics-accept-mixed-label-types
|
||||
(let [situation (setup/simple-component-with-labeled-copy)
|
||||
error (try (tm/resolve-shape situation :missing)
|
||||
(catch #?(:clj Exception :cljs js/Error) error error))]
|
||||
(t/is (= ::tm/unbound-shape-name (:type (ex-data error))))
|
||||
(t/is (some #{:copy-child} (:present (ex-data error))))))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user