diff --git a/contrib/cursor/__tests__/Cursor.ts b/contrib/cursor/__tests__/Cursor.ts index 91adc3521c..e05c1e1460 100644 --- a/contrib/cursor/__tests__/Cursor.ts +++ b/contrib/cursor/__tests__/Cursor.ts @@ -49,6 +49,13 @@ describe('Cursor', () => { expect(deepCursor.deref()).toBe(data.getIn(Immutable.fromJS(['a', 'b']))); }); + it('cursor return new cursors of correct type', () => { + var data = Immutable.fromJS({ a: [1, 2, 3] }); + var cursor = Cursor.from(data); + var deepCursor = cursor.cursor('a'); + expect(deepCursor.findIndex).toBeDefined(); + }); + it('can be treated as a value', () => { var data = Immutable.fromJS(json); var cursor = Cursor.from(data, ['a', 'b']); diff --git a/contrib/cursor/index.js b/contrib/cursor/index.js index 206c310781..aa73e3a0ce 100644 --- a/contrib/cursor/index.js +++ b/contrib/cursor/index.js @@ -220,7 +220,7 @@ IndexedCursor.prototype = IndexedCursorPrototype; var NOT_SET = {}; // Sentinel value function makeCursor(rootData, keyPath, onChange, value) { - if (arguments.length < 4) { + if (value === void 0) { value = rootData.getIn(keyPath); } var size = value && value.size;