diff --git a/src/reactTemplates.js b/src/reactTemplates.js index e0ed627..b877066 100644 --- a/src/reactTemplates.js +++ b/src/reactTemplates.js @@ -72,7 +72,8 @@ function convertText(txt) { if (curlyCounter !== 0) { throw 'Failed to parse text'; } else { - res += (first ? '' : '+') + txt.substr(start + 1, end - start - 2); + var needsParens = start !== 0 || end !== txt.length -1; + res += (first ? '' : '+') + (needsParens?'(':'')+txt.substr(start + 1, end - start - 2)+(needsParens?')':''); first = false; txt = txt.substr(end); } diff --git a/test/data/eval.rt b/test/data/eval.rt new file mode 100644 index 0000000..f68497b --- /dev/null +++ b/test/data/eval.rt @@ -0,0 +1,4 @@ + +
+ Strings and execution mixing is:{2>1?'correct':'incorrect'} +
\ No newline at end of file diff --git a/test/data/eval.rt.html b/test/data/eval.rt.html new file mode 100644 index 0000000..396c3d0 --- /dev/null +++ b/test/data/eval.rt.html @@ -0,0 +1 @@ +
Strings and execution mixing is:correct
\ No newline at end of file diff --git a/test/data/repeat.rt.js b/test/data/repeat.rt.js index e6bbb90..3ed0b71 100644 --- a/test/data/repeat.rt.js +++ b/test/data/repeat.rt.js @@ -1,3 +1,4 @@ +/*eslint new-cap:0,no-unused-vars:0*/ define([ 'react', 'lodash' diff --git a/test/data/test.rt.js b/test/data/test.rt.js index 226cd77..cd7a26e 100644 --- a/test/data/test.rt.js +++ b/test/data/test.rt.js @@ -1,3 +1,4 @@ +/*eslint new-cap:0,no-unused-vars:0*/ define([ 'react', 'lodash' diff --git a/test/src/test.js b/test/src/test.js index 0a97d31..2db5f6a 100644 --- a/test/src/test.js +++ b/test/src/test.js @@ -36,7 +36,7 @@ function normalizeHtml(html) { } test('html tests', function (t) { - var files = ['scope.rt', 'lambda.rt']; + var files = ['scope.rt', 'lambda.rt','eval.rt']; t.plan(files.length); files.forEach(check);