diff --git a/test/data/invalid-exp.rt b/test/data/invalid-exp.rt new file mode 100644 index 0000000..6d37e12 --- /dev/null +++ b/test/data/invalid-exp.rt @@ -0,0 +1,4 @@ + +
+ {z +
\ No newline at end of file diff --git a/test/data/invalid-html.rt b/test/data/invalid-html.rt new file mode 100644 index 0000000..0519e0b --- /dev/null +++ b/test/data/invalid-html.rt @@ -0,0 +1,2 @@ + +
+
+
\ No newline at end of file diff --git a/test/data/invalid-scope.rt b/test/data/invalid-scope.rt index 7bce3e7..08278c1 100644 --- a/test/data/invalid-scope.rt +++ b/test/data/invalid-scope.rt @@ -1,3 +1,3 @@
-
\ No newline at end of file diff --git a/test/src/test.js b/test/src/test.js index 75b0c5e..d6aeeb1 100644 --- a/test/src/test.js +++ b/test/src/test.js @@ -11,7 +11,10 @@ var dataPath = path.resolve(__dirname, '..', 'data'); test('invalid tests', function (t) { var files = [ - {file: 'invalid-scope.rt', issue: new reactTemplates.RTCodeError('invalid scope part \'a in a in a\'', 14, 1)} + {file: 'invalid-scope.rt', issue: new reactTemplates.RTCodeError("invalid scope part 'a in a in a'", 14, 1)}, + {file: 'invalid-html.rt', issue: new reactTemplates.RTCodeError('Document should have a root element', -1, -1)}, + {file: 'invalid-exp.rt', issue: new reactTemplates.RTCodeError("Failed to parse text '\n {z\n'", 19, 3)}, + {file: 'invalid-lambda.rt', issue: new reactTemplates.RTCodeError("when using 'on' events, use lambda '(p1,p2)=>body' notation or use {} to return a callback function. error: [onClick='']", 14, 1)} ]; t.plan(files.length); @@ -77,7 +80,7 @@ test('html tests', function (t) { var expected = fs.readFileSync(filename + '.html').toString().replace(/\r/g, ''); // var expected = fs.readFileSync(filename.replace(".html", ".js")).toString(); var code = reactTemplates.convertTemplateToReact(html).replace(/\r/g, ''); - var defineMap = {"react/addons": React, lodash: _}; + var defineMap = {'react/addons': React, lodash: _}; var define = function (requirementsNames, content) { var requirements = _.map(requirementsNames, function (reqName) { return defineMap[reqName];