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);
|
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);
|
this.$detectNewLine(text);
|
||||||
|
|
||||||
var lines = this.$split(text);
|
var lines = this.$split(text);
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,6 @@ module.exports = {
|
||||||
worker.setValue('"a\n\\nn"');
|
worker.setValue('"a\n\\nn"');
|
||||||
worker.deferredUpdate.call();
|
worker.deferredUpdate.call();
|
||||||
|
|
||||||
console.log(this.sender.events)
|
|
||||||
var error = this.sender.events[0][1];
|
var error = this.sender.events[0][1];
|
||||||
assert.equal(error.text, "Unterminated string literal");
|
assert.equal(error.text, "Unterminated string literal");
|
||||||
assert.equal(error.type, "error");
|
assert.equal(error.type, "error");
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
* 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
|
* 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
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
|
@ -37,6 +36,7 @@
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var oop = require("../lib/oop");
|
var oop = require("../lib/oop");
|
||||||
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
|
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
|
||||||
|
|
@ -100,11 +100,11 @@ var LiquidHighlightRules = function() {
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "meta.tag",
|
token : "meta.tag",
|
||||||
regex : "<(?=\s*script\\b)",
|
regex : "<(?=\\s*script\\b)",
|
||||||
next : "script"
|
next : "script"
|
||||||
}, {
|
}, {
|
||||||
token : "meta.tag",
|
token : "meta.tag",
|
||||||
regex : "<(?=\s*style\\b)",
|
regex : "<(?=\\s*style\\b)",
|
||||||
next : "style"
|
next : "style"
|
||||||
}, {
|
}, {
|
||||||
token : "meta.tag", // opening tag
|
token : "meta.tag", // opening tag
|
||||||
|
|
@ -184,14 +184,14 @@ var LiquidHighlightRules = function() {
|
||||||
regex : "\/|\\*|\\-|\\+|=|!=|\\?\\:"
|
regex : "\/|\\*|\\-|\\+|=|!=|\\?\\:"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]"
|
regex : /[\[\({]/
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : "\\s+"
|
||||||
}, ]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
xmlUtil.tag(this.$rules, "tag", "start");
|
xmlUtil.tag(this.$rules, "tag", "start");
|
||||||
|
|
|
||||||
|
|
@ -55,22 +55,22 @@ module.exports = {
|
||||||
"test: tokenize tags" : function() {
|
"test: tokenize tags" : function() {
|
||||||
var line = "for one in many";
|
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("keyword", tokens[0].type);
|
||||||
assert.equal("text", tokens[1].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("text", tokens[3].type);
|
||||||
assert.equal("keyword.operator", tokens[3].type);
|
assert.equal("keyword", tokens[4].type);
|
||||||
assert.equal("text", tokens[4].type);
|
|
||||||
assert.equal("text", tokens[5].type);
|
assert.equal("text", tokens[5].type);
|
||||||
|
assert.equal("identifier", tokens[6].type);
|
||||||
},
|
},
|
||||||
|
|
||||||
"test: tokenize parens" : function() {
|
"test: tokenize parens" : function() {
|
||||||
var line = "[{( )}]";
|
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(7, tokens.length);
|
||||||
assert.equal("paren.lparen", tokens[0].type);
|
assert.equal("paren.lparen", tokens[0].type);
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,9 @@ MockRenderer.prototype.scrollToLine = function(line, center) {
|
||||||
this.scrollToRow(row);
|
this.scrollToRow(row);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MockRenderer.prototype.scrollSelectionIntoView = function() {
|
||||||
|
};
|
||||||
|
|
||||||
MockRenderer.prototype.scrollCursorIntoView = function() {
|
MockRenderer.prototype.scrollCursorIntoView = function() {
|
||||||
var cursor = this.session.getSelection().getCursor();
|
var cursor = this.session.getSelection().getCursor();
|
||||||
if (cursor.row < this.layerConfig.firstVisibleRow) {
|
if (cursor.row < this.layerConfig.firstVisibleRow) {
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,6 @@ module.exports = {
|
||||||
iterator.stepForward();
|
iterator.stepForward();
|
||||||
iterator.stepForward();
|
iterator.stepForward();
|
||||||
iterator.stepForward();
|
iterator.stepForward();
|
||||||
iterator.stepForward();
|
|
||||||
|
|
||||||
assert.equal(iterator.getCurrentToken().value, "for");
|
assert.equal(iterator.getCurrentToken().value, "for");
|
||||||
assert.equal(iterator.getCurrentTokenRow(), 1);
|
assert.equal(iterator.getCurrentTokenRow(), 1);
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"asyncjs": "0.0.x",
|
"asyncjs": "0.0.x",
|
||||||
"jsdom": "0.2.x",
|
"jsdom": "0.2.x",
|
||||||
"amd-loader": ">=0.0.3",
|
"amd-loader": "~0.0.4",
|
||||||
"libxml": "0.0.x",
|
"libxml": "0.0.x",
|
||||||
"dryice": ">=0.4.1"
|
"dryice": "~0.4.1"
|
||||||
},
|
},
|
||||||
|
|
||||||
"licenses": [{
|
"licenses": [{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue