@@ -18,12 +18,12 @@ var conditionData = {
1818describe ( 'leopard' , function ( ) {
1919 it ( 'inits with simplest config' , function ( ) {
2020 var template = leo ( '<p>This is <%= a %>!</p>' , basicData )
21- assert . strictEqual ( template , escape ( '<p>This is Leopard!</p>' ) )
21+ assert . strictEqual ( template , '<p>This is Leopard!</p>' )
2222 } )
2323
2424 it ( 'handles multiple expressions' , function ( ) {
2525 var template = leo ( '<p>This is <%= a %>, AKA <%= b %>!</p>' , basicData )
26- assert . strictEqual ( template , escape ( '<p>This is Leopard, AKA leo!</p>' ) )
26+ assert . strictEqual ( template , '<p>This is Leopard, AKA leo!</p>' )
2727 } )
2828
2929 it ( 'handles complex expressions' , function ( ) {
@@ -32,8 +32,22 @@ describe('leopard', function() {
3232 '<p>I am Leopard<%= \', AKA \' + (isOk ? nickname : realname) + \'!\' %></p>' ,
3333 conditionData
3434 )
35- assert . strictEqual ( template , escape ( '<p>m + n = 3</p>' ) )
36- assert . strictEqual ( template_2 , escape ( '<p>I am Leopard, AKA leopard!</p>' ) )
35+ assert . strictEqual ( template , '<p>m + n = 3</p>' )
36+ assert . strictEqual ( template_2 , '<p>I am Leopard, AKA leopard!</p>' )
37+ } )
38+
39+ it ( 'handles html-expected interpolations and text-expected interpolations' , function ( ) {
40+ var string = '<p>html tags can be escaped and rendered as string: <%= html %>.' +
41+ ' Or can still rendered as html: <%- html %></p>'
42+ var data = {
43+ html : '<em>Leopard</em>'
44+ }
45+ var template = leo ( string , data )
46+ assert . strictEqual ( template , '<p>html tags can be escaped and rendered as string: ' +
47+ escape ( data . html ) +
48+ '. Or can still rendered as html: ' +
49+ data . html +
50+ '</p>' )
3751 } )
3852
3953 it ( 'handles conditions' , function ( ) {
@@ -44,7 +58,7 @@ describe('leopard', function() {
4458 '<% } %>'
4559
4660 var template = leo ( conditions , conditionData )
47- assert . strictEqual ( template , escape ( '<span class=\"realname\">leopard</span>' ) )
61+ assert . strictEqual ( template , '<span class=\"realname\">leopard</span>' )
4862 } )
4963
5064 it ( 'handles loops' , function ( ) {
@@ -56,6 +70,6 @@ describe('leopard', function() {
5670 '</ul>'
5771
5872 var template = leo ( loops )
59- assert . strictEqual ( template , escape ( 'Now I repeat: <ul><li>0: I am Leopard!</li><li>1: I am Leopard!</li></ul>' ) )
73+ assert . strictEqual ( template , 'Now I repeat: <ul><li>0: I am Leopard!</li><li>1: I am Leopard!</li></ul>' )
6074 } )
6175} )
0 commit comments