body:"My favorite websites are www.televisionwithoutpity.com, http://daringfireball.net and you can email me at pottedmeat@sitepen.com"
});
vartpl=newdd.Template("{{ body|urlize }}");
t.is('My favorite websites are <a href="http://www.televisionwithoutpity.com" rel="nofollow">www.televisionwithoutpity.com</a> <a href="http://daringfireball.net" rel="nofollow">http://daringfireball.net</a> and you can email me at <a href="mailto:pottedmeat@sitepen.com">pottedmeat@sitepen.com</a>',tpl.render(context));
},
functiontest_filter_urlizetrunc(t){
vardd=dojox.dtl;
varcontext=newdd.Context({
body:"My favorite websites are www.televisionwithoutpity.com, http://daringfireball.net and you can email me at pottedmeat@sitepen.com"
});
vartpl=newdd.Template("{{ body|urlizetrunc }}");
t.is('My favorite websites are <a href="http://www.televisionwithoutpity.com" rel="nofollow">www.televisionwithoutpity.com</a> <a href="http://daringfireball.net" rel="nofollow">http://daringfireball.net</a> and you can email me at <a href="mailto:pottedmeat@sitepen.com">pottedmeat@sitepen.com</a>',tpl.render(context));
tpl=newdd.Template('{{ body|urlizetrunc:"2" }}');
t.is('My favorite websites are <a href="http://www.televisionwithoutpity.com" rel="nofollow">www.televisionwithoutpity.com</a> <a href="http://daringfireball.net" rel="nofollow">http://daringfireball.net</a> and you can email me at <a href="mailto:pottedmeat@sitepen.com">pottedmeat@sitepen.com</a>',tpl.render(context));
t.is('My favorite websites are <a href="http://www.televisionwithoutpity.com" rel="nofollow">www.tel...</a> <a href="http://daringfireball.net" rel="nofollow">http://...</a> and you can email me at <a href="mailto:pottedmeat@sitepen.com">pottedmeat@sitepen.com</a>',tpl.render(context));
},
functiontest_filter_wordcount(t){
vardd=dojox.dtl;
varcontext=newdd.Context({
food:"Hot Pocket"
});
vartpl=newdd.Template("{{ food|wordcount }}");
t.is("2",tpl.render(context));
context.food="";
t.is("0",tpl.render(context));
context.food="A nice barbecue, maybe a little grilled veggies, some cole slaw.";
t.is("11",tpl.render(context));
},
functiontest_filter_wordwrap(t){
vardd=dojox.dtl;
varcontext=newdd.Context({
body:"shrimp gumbo, shrimp pie, shrimp scampi, shrimp stew, fried shrimp, baked shrimp, shrimp o grotten, grilled shrimp, shrimp on a stick, shrimp salad, shrimp pop overs, shrimp cake, shrimp legs, shrimp stuffed eggs, shrimp cre oll, shrimp soup, creamed shrimp on toast, shrimp crapes, shrimply good crescent rolls, shrimp pizza, scalloped shrimp, boiled shrimp, shrimp cocktail"