Skip to content

Commit

Permalink
added test on alias element meta merging
Browse files Browse the repository at this point in the history
  • Loading branch information
onionpancakes committed Feb 22, 2024
1 parent 1c5bbb4 commit d74248b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions test/dev/onionpancakes/chassis/tests/test_core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,18 @@
[_ _ _]
[:div])

(defmethod c/resolve-alias ::TestMetaMerge
[_ _ _]
(with-meta [:div] {:inner-meta "foo"
:common-meta "old"}))

(deftest test-alias-meta
(let [elem ^::test-meta [::TestMeta]]
(is (= (meta elem) (meta (c/resolve-alias-element elem))))))
(let [elem (with-meta [::TestMeta] {:foo "bar"})]
(is (= (meta (c/resolve-alias-element elem))
{:foo "bar"})))
(let [elem (with-meta [::TestMetaMerge] {:outer-meta "bar"
:common-meta "new"})]
(is (= (meta (c/resolve-alias-element elem))
{:inner-meta "foo"
:outer-meta "bar"
:common-meta "new"}))))

0 comments on commit d74248b

Please sign in to comment.