3 <script src=
"../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"editor-test.js"></script>
9 var textEditor
= InspectorTest
.createTestEditor();
10 textEditor
.setText("1\n2\n3\n4");
12 InspectorTest
.runTestSuite([
13 function testMarkiningInitialStateAsClean(next
)
15 InspectorTest
.addResult("Initial state: clean=" + textEditor
.isClean());
16 textEditor
.markClean();
17 InspectorTest
.addResult("After marking clean: clean=" + textEditor
.isClean());
18 textEditor
.editRange(WebInspector
.TextRange
.createFromLocation(0, 0), "newText");
19 InspectorTest
.addResult("EDIT; clean=" + textEditor
.isClean());
21 InspectorTest
.addResult("UNDO; clean=" + textEditor
.isClean());
23 InspectorTest
.addResult("REDO; clean=" + textEditor
.isClean());
25 InspectorTest
.addResult("UNDO; clean=" + textEditor
.isClean());
26 textEditor
.editRange(WebInspector
.TextRange
.createFromLocation(1, 0), "newText2");
27 InspectorTest
.addResult("EDIT; clean=" + textEditor
.isClean());
29 InspectorTest
.addResult("UNDO; clean=" + textEditor
.isClean());
33 function testMiddleStateAsClean(next
)
35 InspectorTest
.addResult("Initial state: clean=" + textEditor
.isClean());
36 for(var i
= 0; i
< 3; ++i
) {
37 textEditor
.editRange(WebInspector
.TextRange
.createFromLocation(i
, 0), "newText" + i
);
38 InspectorTest
.addResult("EDIT; clean=" + textEditor
.isClean());
40 textEditor
.markClean();
41 InspectorTest
.addResult("After marking clean: clean=" + textEditor
.isClean());
42 textEditor
.editRange(WebInspector
.TextRange
.createFromLocation(3, 0), "newText" + 3);
43 InspectorTest
.addResult("EDIT; clean=" + textEditor
.isClean());
44 for(var i
= 0; i
< 4; ++i
) {
46 InspectorTest
.addResult("UNDO; clean=" + textEditor
.isClean());
48 for(var i
= 0; i
< 4; ++i
) {
50 InspectorTest
.addResult("REDO; clean=" + textEditor
.isClean());
52 for(var i
= 0; i
< 2; ++i
) {
54 InspectorTest
.addResult("UNDO; clean=" + textEditor
.isClean());
56 textEditor
.editRange(WebInspector
.TextRange
.createFromLocation(1, 0), "foo");
57 InspectorTest
.addResult("EDIT; clean=" + textEditor
.isClean());
59 InspectorTest
.addResult("UNDO; clean=" + textEditor
.isClean());
61 InspectorTest
.addResult("UNDO; clean=" + textEditor
.isClean());
70 <body onload=
"runTest()">
72 This test checks TextEditorModel.markClean/isClean methods