immutable-undo
Advanced tools
Comparing version 1.1.1 to 2.0.0
{ | ||
"name": "immutable-undo", | ||
"version": "1.1.1", | ||
"version": "2.0.0", | ||
"description": "Data structure for and Undo/Redo stack, using ImmutableJS", | ||
@@ -26,4 +26,4 @@ "main": "./dist/index.js", | ||
"homepage": "https://github.com/Soreine/immutable-undo#readme", | ||
"dependencies": { | ||
"immutable": "^3.8.1" | ||
"peerDependencies": { | ||
"immutable": "^3.8.1 | ^4.0.0-rc.12" | ||
}, | ||
@@ -41,4 +41,5 @@ "devDependencies": { | ||
"expect": "^1.20.2", | ||
"mocha": "^3.0.1" | ||
"mocha": "^3.0.1", | ||
"immutable": "^4.0.0-rc.12" | ||
} | ||
} |
@@ -101,2 +101,29 @@ const expect = require('expect'); | ||
}); | ||
it('should handle undo redo, with Smooth strategy', () => { | ||
// Serie of natural integers | ||
const serie = [...Array(30).keys()]; | ||
const history = serie.reduce( | ||
(h, n) => { | ||
h = h.push(n); | ||
const previous = h.previous; | ||
h = h.undo(n + 1); | ||
h = h.redo(previous); | ||
return h; | ||
}, | ||
History.create({ maxUndos: 3, strategy: History.smooth }) | ||
); | ||
expect(history.previous).toEqual(29); | ||
expect(history.undos.count()).toEqual(3); | ||
expect(history.redos.count()).toEqual(0); | ||
expect( | ||
history.undos.toArray() | ||
).toEqual([ | ||
{ value: 0, merged: 21 }, | ||
{ value: 21, merged: 8 }, | ||
{ value: 29, merged: 1 } | ||
]); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
113052
12
334
12
- Removedimmutable@^3.8.1
- Removedimmutable@3.8.2(transitive)