-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba1cdca
commit b762e79
Showing
3 changed files
with
50 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import deepDiff from 'deep-diff'; | ||
|
||
import { CommandManager } from '../CommandManager'; | ||
|
||
test('Add', () => { | ||
const cm = new CommandManager(); | ||
|
||
const s0 = { | ||
state: 0, | ||
list: [], | ||
}; | ||
|
||
const s1 = { | ||
state: 1, | ||
list: ['r1'], | ||
}; | ||
|
||
const command = { | ||
command: 'r1r2', | ||
diff: deepDiff.diff(s0, s1), | ||
undo: () => { | ||
// console.log(diff); | ||
}, | ||
redo: () => { | ||
// console.log('redeo') | ||
}, | ||
}; | ||
|
||
cm.add(command); | ||
|
||
// console.log(cm.stackList()); | ||
cm.undo(); | ||
}); |