nosco / hx

A simple, easy to use library for React development in ClojureScript.
MIT License
247 stars 16 forks source link

Functional components can't be specced #8

Closed lilactown closed 5 years ago

lilactown commented 5 years ago

Because functional components are expected to take in a JavaScript object as props, and return a React Element, it is not currently possible to write a spec for them.

lilactown commented 5 years ago

https://github.com/Lokeh/hx/commit/c5fccda1f1ae34973372ea2af9a17d69f4595550 adds support for pre- and post-conditions in the defnc macro.

I think that this adequately satisfies most uses of speccing React components.

One enhancement might be to enable/disable pre/post checks based on goog.DEBUG.