File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Original file line number Diff line number Diff line change @@ -49,6 +49,13 @@ describe('Cursor', () => {
49
49
expect ( deepCursor . deref ( ) ) . toBe ( data . getIn ( Immutable . fromJS ( [ 'a' , 'b' ] ) ) ) ;
50
50
} ) ;
51
51
52
+ it ( 'cursor return new cursors of correct type' , ( ) => {
53
+ var data = Immutable . fromJS ( { a : [ 1 , 2 , 3 ] } ) ;
54
+ var cursor = Cursor . from ( data ) ;
55
+ var deepCursor = < any > cursor . cursor ( 'a' ) ;
56
+ expect ( deepCursor . findIndex ) . toBeDefined ( ) ;
57
+ } ) ;
58
+
52
59
it ( 'can be treated as a value' , ( ) => {
53
60
var data = Immutable . fromJS ( json ) ;
54
61
var cursor = Cursor . from ( data , [ 'a' , 'b' ] ) ;
Original file line number Diff line number Diff line change @@ -233,6 +233,13 @@ function wrappedValue(cursor, keyPath, value) {
233
233
}
234
234
235
235
function subCursor ( cursor , keyPath , value ) {
236
+ if ( arguments . length < 3 ) {
237
+ return makeCursor ( // call without value
238
+ cursor . _rootData ,
239
+ newKeyPath ( cursor . _keyPath , keyPath ) ,
240
+ cursor . _onChange
241
+ ) ;
242
+ }
236
243
return makeCursor (
237
244
cursor . _rootData ,
238
245
newKeyPath ( cursor . _keyPath , keyPath ) ,
You can’t perform that action at this time.
0 commit comments