diff --git a/src/reactTemplates.js b/src/reactTemplates.js index 68646bc..ea35e7e 100644 --- a/src/reactTemplates.js +++ b/src/reactTemplates.js @@ -94,7 +94,7 @@ function convertText(node, context, txt) { var start = txt.indexOf('{'); var pre = txt.substr(0, start); if (pre) { - res += (first ? '' : '+') + JSON.stringify(pre); + res += (first ? '' : ',') + JSON.stringify(pre); first = false; } var curlyCounter = 1; @@ -106,13 +106,13 @@ function convertText(node, context, txt) { throw RTCodeError.build("Failed to parse text '" + txt + "'", context, node); } else { var needsParens = start !== 0 || end !== txt.length - 1; - res += (first ? '' : '+') + (needsParens ? '(' : '') + txt.substr(start + 1, end - start - 2) + (needsParens ? ')' : ''); + res += (first ? '' : ',') + (needsParens ? '(' : '') + txt.substr(start + 1, end - start - 2) + (needsParens ? ')' : ''); first = false; txt = txt.substr(end); } } if (txt) { - res += (first ? '' : '+') + JSON.stringify(txt); + res += (first ? '' : ',') + JSON.stringify(txt); } if (res === '') { res = 'true'; diff --git a/test/data/concat.rt b/test/data/concat.rt new file mode 100644 index 0000000..9fa7b50 --- /dev/null +++ b/test/data/concat.rt @@ -0,0 +1 @@ +
Hello RT!{React.DOM.span({},'test')}
diff --git a/test/data/concat.rt.html b/test/data/concat.rt.html new file mode 100644 index 0000000..2ca73e1 --- /dev/null +++ b/test/data/concat.rt.html @@ -0,0 +1 @@ +
Hello RT!test
diff --git a/test/data/require.rt.js b/test/data/require.rt.js index 799d640..b1564de 100644 --- a/test/data/require.rt.js +++ b/test/data/require.rt.js @@ -6,6 +6,6 @@ define([ ], function (React, _, myComp, utils) { 'use strict'; return function () { - return React.createElement(myComp, {}, '\n' + utils.translate('Hello', 'es') + '\n'); + return React.createElement(myComp, {}, '\n', utils.translate('Hello', 'es'), '\n'); }; }); \ No newline at end of file diff --git a/test/src/test.js b/test/src/test.js index 2bea995..da2fc3c 100644 --- a/test/src/test.js +++ b/test/src/test.js @@ -158,7 +158,7 @@ function normalizeHtml(html) { } test('html tests', function (t) { - var files = ['scope.rt', 'lambda.rt', 'eval.rt', 'props.rt', 'custom-element.rt', 'style.rt']; + var files = ['scope.rt', 'lambda.rt', 'eval.rt', 'props.rt', 'custom-element.rt', 'style.rt', 'concat.rt']; t.plan(files.length); files.forEach(check); @@ -231,7 +231,7 @@ test('test shell', function (t) { test('test convertText', function (t) { var texts = [ {input: '{}', expected: '()'}, - {input: "a {'b'}", expected: '"a "+(\'b\')'} + {input: "a {'b'}", expected: '"a ",(\'b\')'} ]; t.plan(texts.length); texts.forEach(check); @@ -244,7 +244,7 @@ test('test convertText', function (t) { test('test convertText errors', function (t) { var texts = [ {input: '{}', expected: '()'}, - {input: "a {'b'}", expected: '"a "+(\'b\')'} + {input: "a {'b'}", expected: '"a ",(\'b\')'} ]; t.plan(texts.length); texts.forEach(check);