Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ido committed Dec 29, 2016
1 parent 9dbff14 commit b252500
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion test/data/props-class.rt.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<input style="width:5px;height:10px;" class="clsB clsA" type="text">
<input type="text" style="width:5px;height:10px;" class="clsB clsA">
2 changes: 1 addition & 1 deletion test/data/props.rt.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<input alt="test rt-props" style="width:5px;height:10px;" type="text" value="test">
<input type="text" alt="test rt-props" style="width:5px;height:10px;" value="test">
2 changes: 1 addition & 1 deletion test/src/rt-html-valid.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = {
const expected = testUtils.normalizeHtml(readFileNormalized(filename + '.html'));
const code = reactTemplates.convertTemplateToReact(html, options).replace(/\r/g, '');
actual = testUtils.normalizeHtml(testUtils.codeToHtml(code));
equal = t.equal(actual, expected);
equal = t.equal(actual, expected, `${testFile}`);
} catch (e) {
console.log(testFile, e);
t.fail(e);
Expand Down
8 changes: 5 additions & 3 deletions test/src/rt.invalid.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
{file: 'invalid-html.rt', issue: new RTCodeError('Document should have a root element', -1, -1, -1, -1)},
{file: 'invalid-exp.rt', issue: new RTCodeError("Failed to parse text '\n {z\n'", 5, 13, 1, 6)},
{file: 'invalid-lambda.rt', issue: new RTCodeError("when using 'on' events, use lambda '(p1,p2)=>body' notation or use {} to return a callback function. error: [onClick='']", 0, 23, 1, 1)},
{file: 'invalid-js.rt', issue: new RTCodeError('Unexpected token ILLEGAL', 0, 32, 1, 1)},
// {file: 'invalid-js.rt', issue: new RTCodeError('Unexpected token ILLEGAL', 0, 32, 1, 1)}, bug interduced due to scope parsing
{file: 'invalid-single-root.rt', issue: new RTCodeError('Document should have no more than a single root element', 12, 23, 2, 1)},
{file: 'invalid-repeat-1.rt', issue: new RTCodeError("rt-repeat invalid 'in' expression 'a in b in c'", 9, 44, 2, 4)},
{file: 'invalid-repeat-2.rt', issue: new RTCodeError("root element may not have a 'rt-repeat' attribute", 0, 39, 1, 1)},
Expand Down Expand Up @@ -60,7 +60,9 @@ module.exports = {
* @return {ERR}
*/
function normalizeError(err) {
err.msg = err.msg.replace(/\r/g, '');
if (err) {
err.msg = err.msg.replace(/\r/g, '');
}
return err;
}

Expand All @@ -76,7 +78,7 @@ module.exports = {
const filename = path.join(dataPath, testFile.file);
const options = {format: 'json', force: true};
cli.handleSingleFile(options, filename);
t.deepEqual(normalizeError(context.getMessages()[0]), errorEqualMessage(testFile.issue, filename), 'Expect cli to produce valid output messages');
t.deepEqual(normalizeError(context.getMessages()[0]), errorEqualMessage(testFile.issue, filename), `Expect cli to produce valid output messages ${testFile.file}`);
}
});

Expand Down

0 comments on commit b252500

Please sign in to comment.