1
0
mirror of https://github.com/bobwen-dev/react-templates synced 2025-04-12 00:56:39 +02:00

fixed tests

Fixed problem with wrapping of injected code if concatted with strings.
This commit is contained in:
avim 2014-11-27 11:57:45 +02:00
parent 51061370d6
commit 7504b09a12
6 changed files with 10 additions and 2 deletions

View File

@ -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);
}

4
test/data/eval.rt Normal file
View File

@ -0,0 +1,4 @@
<!doctype rt>
<div>
Strings and execution mixing is:{2>1?'correct':'incorrect'}
</div>

1
test/data/eval.rt.html Normal file
View File

@ -0,0 +1 @@
<div>Strings and execution mixing is:correct</div>

View File

@ -1,3 +1,4 @@
/*eslint new-cap:0,no-unused-vars:0*/
define([
'react',
'lodash'

View File

@ -1,3 +1,4 @@
/*eslint new-cap:0,no-unused-vars:0*/
define([
'react',
'lodash'

View File

@ -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);