make jslint happy

This commit is contained in:
Fabian Jakobs 2010-04-12 13:10:47 +02:00
commit 443b712b8f
15 changed files with 968 additions and 949 deletions

View file

@ -1,16 +1,16 @@
MockRenderer = function() {
this.container = document.createElement("div");
this.cursor = {
row: 0,
column: 0
}
row : 0,
column : 0
};
this.visibleRowCount = 20;
this.layerConfig = {
firstVisibleRow: 0,
lastVisibleRow: this.visibleRowCount,
}
firstVisibleRow : 0,
lastVisibleRow : this.visibleRowCount
};
};
@ -41,18 +41,22 @@ MockRenderer.prototype.updateCursor = function(position) {
MockRenderer.prototype.scrollCursorIntoView = function() {
if (this.cursor.row < this.layerConfig.firstVisibleRow) {
this.scrollToRow(this.cursor.row);
} else if (this.cursor.row > this.layerConfig.lastVisibleRow) {
}
else if (this.cursor.row > this.layerConfig.lastVisibleRow) {
this.scrollToRow(this.cursor.row);
}
};
MockRenderer.prototype.scrollToRow = function(row) {
var row = Math.min(this.lines.length - this.visibleRowCount, Math.max(0, row));
var row = Math.min(this.lines.length - this.visibleRowCount, Math.max(0,
row));
this.layerConfig.firstVisibleRow = row;
this.layerConfig.lastVisibleRow = row + this.visibleRowCount;
}
};
MockRenderer.prototype.draw = function() {
};
MockRenderer.prototype.addMarker = function() {
};

View file

@ -47,5 +47,37 @@ var NavigationTest = TestCase("NavigationTest", {
editor.navigateFileStart();
assertEquals(0, editor.getFirstVisibleRow());
},
"test: move selection lead to end of file" : function() {
var editor = new ace.Editor(this.createTextDocument(200, 10),
new MockRenderer());
editor.moveCursorTo(100, 5);
editor.selectFileEnd();
var selection = editor.getSelectionRange();
assertEquals(100, selection.start.row);
assertEquals(5, selection.start.column);
assertEquals(199, selection.end.row);
assertEquals(10, selection.end.column);
},
"test: move selection lead to start of file" : function() {
var editor = new ace.Editor(this.createTextDocument(200, 10),
new MockRenderer());
editor.moveCursorTo(100, 5);
editor.selectFileStart();
var selection = editor.getSelectionRange();
assertEquals(0, selection.start.row);
assertEquals(0, selection.start.column);
assertEquals(100, selection.end.row);
assertEquals(5, selection.end.column);
}
});