OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
4 <script src="editor-test.js"></script> | 4 <script src="editor-test.js"></script> |
5 <script> | 5 <script> |
6 | 6 |
7 function test() | 7 function test() |
8 { | 8 { |
9 var textEditor = InspectorTest.createTestEditor(); | 9 var textEditor = InspectorTest.createTestEditor(); |
10 textEditor.setText("1\n2\n3\n4"); | 10 textEditor.setText("1\n2\n3\n4"); |
11 | 11 |
12 InspectorTest.runTestSuite([ | 12 InspectorTest.runTestSuite([ |
13 function testMarkiningInitialStateAsClean(next) | 13 function testMarkiningInitialStateAsClean(next) |
14 { | 14 { |
15 InspectorTest.addResult("Initial state: clean=" + textEditor.isClean
()); | 15 InspectorTest.addResult("Initial state: clean=" + textEditor.isClean
()); |
16 textEditor.markClean(); | 16 textEditor.markClean(); |
17 InspectorTest.addResult("After marking clean: clean=" + textEditor.i
sClean()); | 17 InspectorTest.addResult("After marking clean: clean=" + textEditor.i
sClean()); |
18 textEditor.editRange(Common.TextRange.createFromLocation(0, 0), "new
Text"); | 18 textEditor.editRange(TextUtils.TextRange.createFromLocation(0, 0), "
newText"); |
19 InspectorTest.addResult("EDIT; clean=" + textEditor.isClean()); | 19 InspectorTest.addResult("EDIT; clean=" + textEditor.isClean()); |
20 textEditor.undo(); | 20 textEditor.undo(); |
21 InspectorTest.addResult("UNDO; clean=" + textEditor.isClean()); | 21 InspectorTest.addResult("UNDO; clean=" + textEditor.isClean()); |
22 textEditor.redo(); | 22 textEditor.redo(); |
23 InspectorTest.addResult("REDO; clean=" + textEditor.isClean()); | 23 InspectorTest.addResult("REDO; clean=" + textEditor.isClean()); |
24 textEditor.undo(); | 24 textEditor.undo(); |
25 InspectorTest.addResult("UNDO; clean=" + textEditor.isClean()); | 25 InspectorTest.addResult("UNDO; clean=" + textEditor.isClean()); |
26 textEditor.editRange(Common.TextRange.createFromLocation(1, 0), "new
Text2"); | 26 textEditor.editRange(TextUtils.TextRange.createFromLocation(1, 0), "
newText2"); |
27 InspectorTest.addResult("EDIT; clean=" + textEditor.isClean()); | 27 InspectorTest.addResult("EDIT; clean=" + textEditor.isClean()); |
28 textEditor.undo(); | 28 textEditor.undo(); |
29 InspectorTest.addResult("UNDO; clean=" + textEditor.isClean()); | 29 InspectorTest.addResult("UNDO; clean=" + textEditor.isClean()); |
30 next(); | 30 next(); |
31 }, | 31 }, |
32 | 32 |
33 function testMiddleStateAsClean(next) | 33 function testMiddleStateAsClean(next) |
34 { | 34 { |
35 InspectorTest.addResult("Initial state: clean=" + textEditor.isClean
()); | 35 InspectorTest.addResult("Initial state: clean=" + textEditor.isClean
()); |
36 for(var i = 0; i < 3; ++i) { | 36 for(var i = 0; i < 3; ++i) { |
37 textEditor.editRange(Common.TextRange.createFromLocation(i, 0),
"newText" + i); | 37 textEditor.editRange(TextUtils.TextRange.createFromLocation(i, 0
), "newText" + i); |
38 InspectorTest.addResult("EDIT; clean=" + textEditor.isClean()); | 38 InspectorTest.addResult("EDIT; clean=" + textEditor.isClean()); |
39 } | 39 } |
40 textEditor.markClean(); | 40 textEditor.markClean(); |
41 InspectorTest.addResult("After marking clean: clean=" + textEditor.i
sClean()); | 41 InspectorTest.addResult("After marking clean: clean=" + textEditor.i
sClean()); |
42 textEditor.editRange(Common.TextRange.createFromLocation(3, 0), "new
Text" + 3); | 42 textEditor.editRange(TextUtils.TextRange.createFromLocation(3, 0), "
newText" + 3); |
43 InspectorTest.addResult("EDIT; clean=" + textEditor.isClean()); | 43 InspectorTest.addResult("EDIT; clean=" + textEditor.isClean()); |
44 for(var i = 0; i < 4; ++i) { | 44 for(var i = 0; i < 4; ++i) { |
45 textEditor.undo(); | 45 textEditor.undo(); |
46 InspectorTest.addResult("UNDO; clean=" + textEditor.isClean()); | 46 InspectorTest.addResult("UNDO; clean=" + textEditor.isClean()); |
47 } | 47 } |
48 for(var i = 0; i < 4; ++i) { | 48 for(var i = 0; i < 4; ++i) { |
49 textEditor.redo(); | 49 textEditor.redo(); |
50 InspectorTest.addResult("REDO; clean=" + textEditor.isClean()); | 50 InspectorTest.addResult("REDO; clean=" + textEditor.isClean()); |
51 } | 51 } |
52 for(var i = 0; i < 2; ++i) { | 52 for(var i = 0; i < 2; ++i) { |
53 textEditor.undo(); | 53 textEditor.undo(); |
54 InspectorTest.addResult("UNDO; clean=" + textEditor.isClean()); | 54 InspectorTest.addResult("UNDO; clean=" + textEditor.isClean()); |
55 } | 55 } |
56 textEditor.editRange(Common.TextRange.createFromLocation(1, 0), "foo
"); | 56 textEditor.editRange(TextUtils.TextRange.createFromLocation(1, 0), "
foo"); |
57 InspectorTest.addResult("EDIT; clean=" + textEditor.isClean()); | 57 InspectorTest.addResult("EDIT; clean=" + textEditor.isClean()); |
58 textEditor.undo(); | 58 textEditor.undo(); |
59 InspectorTest.addResult("UNDO; clean=" + textEditor.isClean()); | 59 InspectorTest.addResult("UNDO; clean=" + textEditor.isClean()); |
60 textEditor.undo(); | 60 textEditor.undo(); |
61 InspectorTest.addResult("UNDO; clean=" + textEditor.isClean()); | 61 InspectorTest.addResult("UNDO; clean=" + textEditor.isClean()); |
62 next(); | 62 next(); |
63 }, | 63 }, |
64 ]); | 64 ]); |
65 } | 65 } |
66 | 66 |
67 </script> | 67 </script> |
68 </head> | 68 </head> |
69 | 69 |
70 <body onload="runTest()"> | 70 <body onload="runTest()"> |
71 <p> | 71 <p> |
72 This test checks TextEditorModel.markClean/isClean methods | 72 This test checks TextEditorModel.markClean/isClean methods |
73 </p> | 73 </p> |
74 | 74 |
75 </body> | 75 </body> |
76 </html> | 76 </html> |
OLD | NEW |