forked from mrdoob/three.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestNegativeCases.js
More file actions
55 lines (40 loc) · 1.94 KB
/
TestNegativeCases.js
File metadata and controls
55 lines (40 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* @author lxxxvi / https://github.com/lxxxvi
* Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch)
*/
module( "NegativeCases" );
test( "Test unwanted situations ", function() {
var editor = new Editor();
// illegal
editor.undo();
ok( editor.history.undos.length == 0, "OK, (illegal) undo did not affect the undo history" );
ok( editor.history.redos.length == 0, "OK, (illegal) undo did not affect the redo history" );
// illegal
editor.redo();
ok( editor.history.undos.length == 0, "OK, (illegal) redo did not affect the undo history" );
ok( editor.history.redos.length == 0, "OK, (illegal) redo did not affect the redo history" );
var box = aBox();
var cmd = new AddObjectCommand( box );
cmd.updatable = false;
editor.execute( cmd );
ok( editor.history.undos.length == 1, "OK, execute changed undo history" );
ok( editor.history.redos.length == 0, "OK, execute did not change redo history" );
// illegal
editor.redo();
ok( editor.history.undos.length == 1, "OK, (illegal) redo did not affect the undo history" );
ok( editor.history.redos.length == 0, "OK, (illegal) redo did not affect the redo history" );
editor.undo();
ok( editor.history.undos.length == 0, "OK, undo changed the undo history" );
ok( editor.history.redos.length == 1, "OK, undo changed the redo history" );
// illegal
editor.undo();
ok( editor.history.undos.length == 0, "OK, (illegal) undo did not affect the undo history" );
ok( editor.history.redos.length == 1, "OK, (illegal) undo did not affect the redo history" );
editor.redo();
ok( editor.history.undos.length == 1, "OK, redo changed the undo history" );
ok( editor.history.redos.length == 0, "OK, undo changed the redo history" );
// illegal
editor.redo();
ok( editor.history.undos.length == 1, "OK, (illegal) did not affect the undo history" );
ok( editor.history.redos.length == 0, "OK, (illegal) did not affect the redo history" );
} );