Skip to content

Commit 6ff598a

Browse files
committed
fix typo and tests
1 parent 21b641b commit 6ff598a

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/reagent/cursor.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,4 @@
106106
107107
Behaves like a normal atom for the value at the specified path."
108108
[a path]
109-
(cursor path ))
109+
(cursor path a))

test/cursor_impl.cljs

+9-6
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,24 @@
1212
test-cursor (c/cur test-atom [:a :b :c :d])
1313
test-cursor2 (c/cur test-atom [])] ;; nasty edge case
1414

15+
(is (= cljs.core/Atom (type test-cursor2)))
16+
1517
;; get the initial values
1618
(is (= (get-in @test-atom [:a :b :c :d])
1719
@test-cursor))
1820

19-
(is (= get-in @test-atom []
21+
(is (= (get-in @test-atom [])
2022
@test-cursor2))
2123

2224
;; now we update the cursor with a reset
2325
(reset! test-cursor 2)
2426
(is (= @test-cursor 2))
25-
(is (= (get-in @test-atom [:a :b :c :d]) 2))
26-
27-
(reset! test-cursor2 2)
28-
(is (= @test-cursor2 2))
29-
(is (= (get-in @test-atom []) 2))
27+
(is (= (get-in @test-atom [:a :b :c :d]) 2))
28+
29+
(reset! test-cursor2 3)
30+
(is (= @test-cursor2 3))
31+
(is (= @test-atom 3))
32+
(reset! test-atom {:a {:b {:c {:d 1}}}}) ;; restore test-atom
3033

3134
;; swap
3235
(reset! test-cursor {}) ;; empty map

0 commit comments

Comments
 (0)