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:
parent
51061370d6
commit
7504b09a12
@ -72,7 +72,8 @@ function convertText(txt) {
|
|||||||
if (curlyCounter !== 0) {
|
if (curlyCounter !== 0) {
|
||||||
throw 'Failed to parse text';
|
throw 'Failed to parse text';
|
||||||
} else {
|
} 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;
|
first = false;
|
||||||
txt = txt.substr(end);
|
txt = txt.substr(end);
|
||||||
}
|
}
|
||||||
|
4
test/data/eval.rt
Normal file
4
test/data/eval.rt
Normal 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
1
test/data/eval.rt.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<div>Strings and execution mixing is:correct</div>
|
@ -1,3 +1,4 @@
|
|||||||
|
/*eslint new-cap:0,no-unused-vars:0*/
|
||||||
define([
|
define([
|
||||||
'react',
|
'react',
|
||||||
'lodash'
|
'lodash'
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/*eslint new-cap:0,no-unused-vars:0*/
|
||||||
define([
|
define([
|
||||||
'react',
|
'react',
|
||||||
'lodash'
|
'lodash'
|
||||||
|
@ -36,7 +36,7 @@ function normalizeHtml(html) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test('html tests', function (t) {
|
test('html tests', function (t) {
|
||||||
var files = ['scope.rt', 'lambda.rt'];
|
var files = ['scope.rt', 'lambda.rt','eval.rt'];
|
||||||
t.plan(files.length);
|
t.plan(files.length);
|
||||||
|
|
||||||
files.forEach(check);
|
files.forEach(check);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user