Add some basic testing using jasmine

Summary:
Make some tests that test the parser. So far, there are no DOM tests,
but maybe later.

Test Plan:
Run `make serve` and then visit `/test/test.html`. Make sure all the
tests pass.

Reviewers: alpert

Reviewed By: alpert

Differential Revision: http://phabricator.khanacademy.org/D2987
This commit is contained in:
Emily Eisenberg
2013-07-11 18:32:44 -07:00
parent adb8b5d671
commit 507a552ffd
9 changed files with 3765 additions and 8 deletions

View File

@@ -1,10 +1,4 @@
var parser = require("./parser.jison");
parser.lexer = require("./lexer");
parser.yy = {
parseError: function(str) {
throw new Error(str);
}
};
var parseTree = require("./parseTree");
var buildExpression = function(expression) {
return _.map(expression, function(ex, i) {
@@ -138,7 +132,7 @@ var clearNode = function(node) {
};
var process = function(toParse, baseElem) {
var tree = parser.parse(toParse);
var tree = parseTree(toParse);
clearNode(baseElem);
_.each(buildExpression(tree), function(elem) {
baseElem.appendChild(elem);