cleanup unit tests
This commit is contained in:
parent
8c1508ab9b
commit
cbd29bc541
7 changed files with 53 additions and 51 deletions
|
|
@ -178,7 +178,8 @@ var Document = function(text) {
|
|||
|
||||
position = this.$clipPosition(position);
|
||||
|
||||
if (this.getLength() >= 1)
|
||||
// only detect new lines if the document has no line break yet
|
||||
if (this.getLength() <= 1)
|
||||
this.$detectNewLine(text);
|
||||
|
||||
var lines = this.$split(text);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ module.exports = {
|
|||
worker.setValue('"a\n\\nn"');
|
||||
worker.deferredUpdate.call();
|
||||
|
||||
console.log(this.sender.events)
|
||||
var error = this.sender.events[0][1];
|
||||
assert.equal(error.text, "Unterminated string literal");
|
||||
assert.equal(error.type, "error");
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Mihai Sucan <mihai DOT sucan AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
|
@ -37,6 +36,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
|
||||
|
|
@ -100,11 +100,11 @@ var LiquidHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "meta.tag",
|
||||
regex : "<(?=\s*script\\b)",
|
||||
regex : "<(?=\\s*script\\b)",
|
||||
next : "script"
|
||||
}, {
|
||||
token : "meta.tag",
|
||||
regex : "<(?=\s*style\\b)",
|
||||
regex : "<(?=\\s*style\\b)",
|
||||
next : "style"
|
||||
}, {
|
||||
token : "meta.tag", // opening tag
|
||||
|
|
@ -184,14 +184,14 @@ var LiquidHighlightRules = function() {
|
|||
regex : "\/|\\*|\\-|\\+|=|!=|\\?\\:"
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : "[[({]"
|
||||
regex : /[\[\({]/
|
||||
}, {
|
||||
token : "paren.rparen",
|
||||
regex : "[\\])}]"
|
||||
regex : /[\])}]/
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
}, ]
|
||||
}]
|
||||
};
|
||||
|
||||
xmlUtil.tag(this.$rules, "tag", "start");
|
||||
|
|
|
|||
|
|
@ -55,22 +55,22 @@ module.exports = {
|
|||
"test: tokenize tags" : function() {
|
||||
var line = "for one in many";
|
||||
|
||||
var tokens = this.tokenizer.getLineTokens(line, "start").tokens;
|
||||
var tokens = this.tokenizer.getLineTokens(line, "liquid_start").tokens;
|
||||
|
||||
assert.equal(5, tokens.length);
|
||||
assert.equal(7, tokens.length);
|
||||
assert.equal("keyword", tokens[0].type);
|
||||
assert.equal("text", tokens[1].type);
|
||||
assert.equal("text", tokens[2].type);
|
||||
assert.equal("identifier", tokens[2].type);
|
||||
assert.equal("text", tokens[3].type);
|
||||
assert.equal("keyword.operator", tokens[3].type);
|
||||
assert.equal("text", tokens[4].type);
|
||||
assert.equal("keyword", tokens[4].type);
|
||||
assert.equal("text", tokens[5].type);
|
||||
assert.equal("identifier", tokens[6].type);
|
||||
},
|
||||
|
||||
"test: tokenize parens" : function() {
|
||||
var line = "[{( )}]";
|
||||
|
||||
var tokens = this.tokenizer.getLineTokens(line, "start").tokens;
|
||||
var tokens = this.tokenizer.getLineTokens(line, "liquid_start").tokens;
|
||||
|
||||
assert.equal(7, tokens.length);
|
||||
assert.equal("paren.lparen", tokens[0].type);
|
||||
|
|
|
|||
|
|
@ -117,6 +117,9 @@ MockRenderer.prototype.scrollToLine = function(line, center) {
|
|||
this.scrollToRow(row);
|
||||
};
|
||||
|
||||
MockRenderer.prototype.scrollSelectionIntoView = function() {
|
||||
};
|
||||
|
||||
MockRenderer.prototype.scrollCursorIntoView = function() {
|
||||
var cursor = this.session.getSelection().getCursor();
|
||||
if (cursor.row < this.layerConfig.firstVisibleRow) {
|
||||
|
|
|
|||
|
|
@ -205,7 +205,6 @@ module.exports = {
|
|||
iterator.stepForward();
|
||||
iterator.stepForward();
|
||||
iterator.stepForward();
|
||||
iterator.stepForward();
|
||||
|
||||
assert.equal(iterator.getCurrentToken().value, "for");
|
||||
assert.equal(iterator.getCurrentTokenRow(), 1);
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@
|
|||
"devDependencies": {
|
||||
"asyncjs": "0.0.x",
|
||||
"jsdom": "0.2.x",
|
||||
"amd-loader": ">=0.0.3",
|
||||
"amd-loader": "~0.0.4",
|
||||
"libxml": "0.0.x",
|
||||
"dryice": ">=0.4.1"
|
||||
"dryice": "~0.4.1"
|
||||
},
|
||||
|
||||
"licenses": [{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue