Merge pull request #1257 from BallBearing/issue1253
Give some more love to #1253.
This commit is contained in:
commit
f99827e01b
2 changed files with 12 additions and 3 deletions
|
|
@ -744,7 +744,7 @@ var EditSession = function(text, mode) {
|
|||
|
||||
/**
|
||||
* Returns the annotations for the `EditSession`.
|
||||
* @returns {Object}
|
||||
* @returns {Array}
|
||||
**/
|
||||
this.getAnnotations = function() {
|
||||
return this.$annotations || [];
|
||||
|
|
@ -754,8 +754,7 @@ var EditSession = function(text, mode) {
|
|||
* Clears all the annotations for this session. This function also triggers the `'changeAnnotation'` event.
|
||||
**/
|
||||
this.clearAnnotations = function() {
|
||||
this.$annotations = [];
|
||||
this._emit("changeAnnotation", {});
|
||||
this.setAnnotations([]);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1007,6 +1007,16 @@ module.exports = {
|
|||
session.documentToScreenPosition(2,0);
|
||||
assertArray(session.$docRowCache, [1,2]);
|
||||
assertArray(session.$screenRowCache, [1,2]);
|
||||
},
|
||||
|
||||
"test annotations": function() {
|
||||
var session = new EditSession([]),
|
||||
annotation = {row: 0, type: 'info', text: "This is a test."};
|
||||
|
||||
session.clearAnnotations();
|
||||
assertArray(session.getAnnotations(), []);
|
||||
session.setAnnotations([annotation]);
|
||||
assertArray(session.getAnnotations(), [annotation]);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue