From adf7eebb5fb5ceab6dd527a3130503095d0e7e0f Mon Sep 17 00:00:00 2001 From: nightwing Date: Fri, 28 Jun 2013 19:22:21 +0400 Subject: [PATCH] fix tests --- lib/ace/ext/static_highlight_test.js | 57 ++++++++++++++-------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/lib/ace/ext/static_highlight_test.js b/lib/ace/ext/static_highlight_test.js index 8e300555..bdbecbfc 100644 --- a/lib/ace/ext/static_highlight_test.js +++ b/lib/ace/ext/static_highlight_test.js @@ -17,34 +17,35 @@ module.exports = { "test simple snippet": function(next) { var theme = require("../theme/tomorrow"); - var snippet = "\ -/** this is a function\n\ -*\n\ -*/\n\ -function hello (a, b, c) {\n\ - console.log(a * b + c + 'sup?');\n\ -}"; + var snippet = [ + "/** this is a function", + "*", + "*/", + "function hello (a, b, c) {", + " console.log(a * b + c + 'sup$');", + "}" + ].join("\n"); var mode = new JavaScriptMode(); var result = highlighter.render(snippet, mode, theme); - assert.equal(result.html, "
1/**\xa0this\xa0is\xa0a\xa0function
2*
3*/
4function\xa0hello\xa0(a,\xa0b,\xa0c)\xa0{
5\xa0\xa0\xa0\xa0console.log(a\xa0*\xa0b\xa0+\xa0c\xa0+\xa0'sup?');
6}
"); + assert.equal(result.html, "
1/**\xa0this\xa0is\xa0a\xa0function
2*
3*/
4function\xa0hello\xa0(a,\xa0b,\xa0c)\xa0{
5\xa0\xa0\xa0\xa0console.log(a\xa0*\xa0b\xa0+\xa0c\xa0+\xa0'sup$');
6}
"); assert.ok(!!result.css); next(); }, "test css from theme is used": function(next) { var theme = require("../theme/tomorrow"); - var snippet = "\ -/** this is a function\n\ -*\n\ -*/\n\ -function hello (a, b, c) {\n\ - console.log(a * b + c + 'sup?');\n\ -}"; + var snippet = [ + "/** this is a function", + "*", + "*/", + "function hello (a, b, c) {", + " console.log(a * b + c + 'sup?');", + "}" + ].join("\n"); var mode = new JavaScriptMode(); - var isError = false, result; - result = highlighter.render(snippet, mode, theme); + var result = highlighter.render(snippet, mode, theme); assert.ok(result.css.indexOf(theme.cssText) !== -1); @@ -53,17 +54,17 @@ function hello (a, b, c) {\n\ "test theme classname should be in output html": function(next) { var theme = require("../theme/tomorrow"); - var snippet = "\ -/** this is a function\n\ -*\n\ -*/\n\ -function hello (a, b, c) {\n\ - console.log(a * b + c + 'sup?');\n\ -}"; + var snippet = [ + "/** this is a function", + "*", + "*/", + "function hello (a, b, c) {", + " console.log(a * b + c + 'sup?');", + "}" + ].join("\n"); var mode = new JavaScriptMode(); - var isError = false, result; - result = highlighter.render(snippet, mode, theme); + var result = highlighter.render(snippet, mode, theme); assert.equal(!!result.html.match(/
/), true); next(); @@ -71,10 +72,10 @@ function hello (a, b, c) {\n\ "test js string replace specials": function(next) { var theme = require("../theme/tomorrow"); - var snippet = "$'$&$1$2$$"; + var snippet = "$'$1$2$$$&"; var mode = new TextMode(); - result = highlighter.render(snippet, mode, theme); + var result = highlighter.render(snippet, mode, theme); assert.ok(result.html.indexOf(snippet) != -1); next();