@@ -22,21 +22,24 @@ describe('Cursor', () => {
22
22
expect ( cursor . deref ( ) ) . toBe ( data ) ;
23
23
24
24
var deepCursor = cursor . cursor ( [ 'a' , 'b' ] ) ;
25
- expect ( deepCursor . deref ( ) . toJS ( ) ) . toEqual ( json . a . b ) ;
26
- expect ( deepCursor . deref ( ) ) . toBe ( data . getIn ( [ 'a' , 'b' ] ) ) ;
25
+ expect ( deepCursor . toJS ( ) ) . toEqual ( json . a . b ) ;
26
+ expect ( deepCursor ) . toEqual ( data . getIn ( [ 'a' , 'b' ] ) ) ;
27
27
expect ( deepCursor . get ( 'c' ) ) . toBe ( 1 ) ;
28
28
29
29
var leafCursor = deepCursor . cursor ( 'c' ) ;
30
- expect ( leafCursor . deref ( ) ) . toBe ( 1 ) ;
30
+ expect ( leafCursor ) . toBe ( 1 ) ;
31
31
32
- var missCursor = leafCursor . cursor ( 'd' ) ;
32
+ var missCursor = deepCursor . cursor ( 'd' ) ;
33
+ expect ( Immutable . is ( missCursor , undefined ) ) . toBe ( true ) ;
33
34
expect ( missCursor . deref ( ) ) . toBe ( undefined ) ;
34
35
} ) ;
35
36
36
37
it ( 'appears to be the type it points to' , ( ) => {
37
- var data = Immutable . fromJS ( json ) ;
38
+ var data = Immutable . fromJS ( { a : [ 1 , 2 , 3 ] } ) ;
38
39
var cursor = data . cursor ( ) ;
40
+ var aCursor = cursor . cursor ( 'a' ) ;
39
41
expect ( cursor instanceof Immutable . Map ) . toBe ( true ) ;
42
+ expect ( aCursor instanceof Immutable . Vector ) . toBe ( true ) ;
40
43
} ) ;
41
44
42
45
it ( 'gets return new cursors' , ( ) => {
@@ -55,12 +58,10 @@ describe('Cursor', () => {
55
58
expect ( cursor . get ( 'c' ) ) . toBe ( 1 ) ;
56
59
} ) ;
57
60
58
- it ( 'can be value compared to a primitive ' , ( ) => {
61
+ it ( 'returns scalars directly ' , ( ) => {
59
62
var data = Immutable . Map ( { a : 'A' } ) ;
60
63
var aCursor = data . cursor ( 'a' ) ;
61
- expect ( aCursor . length ) . toBe ( null ) ;
62
- expect ( aCursor . deref ( ) ) . toBe ( 'A' ) ;
63
- expect ( Immutable . is ( aCursor , 'A' ) ) . toBe ( true ) ;
64
+ expect ( aCursor ) . toBe ( 'A' ) ;
64
65
} ) ;
65
66
66
67
it ( 'updates at its path' , ( ) => {
@@ -115,7 +116,7 @@ describe('Cursor', () => {
115
116
var bCursor = aCursor . cursor ( 'b' ) ;
116
117
var cCursor = bCursor . cursor ( 'c' ) ;
117
118
118
- expect ( bCursor . set ( 'c' , 10 ) . deref ( ) ) . toEqual (
119
+ expect ( bCursor . set ( 'c' , 10 ) ) . toEqual (
119
120
Immutable . fromJS ( { c : 10 } )
120
121
) ;
121
122
expect ( onChange ) . lastCalledWith (
0 commit comments