practicalli / practicalli/clojure

spec with reagent views

Open
#194 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

spec
Dominant language
Makefile
Stars
117
Forks
36
PR merge metrics
No merged PRs in 30d

Description

An example from the app: http://covid19.doctorevidence.com/ (this is a free preview of it)

Specs not often created for reagent components as they have so many options

(s/fdef dre.components.widget/widget
  :args
  (s/and
   (s/cat
    :opts
    (s/keys
     :req-un [::title ;; title in header
              ::content ;; Contents to show in widget. It must be a Hiccup
              ;; vector. Widget does not support varying arguments in
              ;; content, they are for initialization only.
              ]
     :opt-un [::id ;; unique identifier for widget (page wide, not app
              ;; wide)
              ::icon ;; icon to show in header
              ::widget-class ;; CSS class
              ::collapsable? ;; If it can be collapsed
              ::init-collapsed? ;; initialize the widget in a collapsed
              ;; state?
              ::help ;; help contents which are shown in modal
              ::controls ;; Arbitrary component rendered in the
              ;; header. What it does is up to you.
              ::selections ;; coll of dropdown/tabs
              ::dropdown ;; convenience option, singular version of
              ;; selections with
              ;; {:type :dropdown, :id :dropdown} by default
              ::tabs ;; convenience option, singular version of selections
              ;; with {:type :tabs, :id :tabs}
              ::loading? ;; Whether or not to display a loading indicator
              ::locked? ;; Whether or not content modifications are possible
              ::menu ;; menu
              ::on-will-unmount]))
   (fn [{:keys [opts]}]
     (if-let [unexpected
              (seq (apply dissoc opts expected-keys))]
       (do
         (warn "Unexpected options" unexpected)
         false)
       true))))

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the dre.components.widget/widget entry point and compare its options with the example s/fdef shown in the issue. Define coverage for the documented options and unexpected-option behavior; done means the reagent widget has a usable spec and the relevant checks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
frontend, testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.