Browse files

escapeExpression tests

  • Loading branch information...
1 parent fe74d65 commit f4d0092bb836f2c12ddf42dfe6be8e16778ffea5 @kpdecker kpdecker committed Apr 6, 2013
Showing with 13 additions and 0 deletions.
  1. +13 −0 spec/qunit_spec.js
View
13 spec/qunit_spec.js
@@ -1406,6 +1406,19 @@ test('GS-428: Nested if else rendering', function() {
suite('Utils');
+test('escapeExpression', function() {
+ equal(Handlebars.Utils.escapeExpression('foo<&"\'>'), 'foo&lt;&amp;&quot;&#x27;&gt;');
+ equal(Handlebars.Utils.escapeExpression(new Handlebars.SafeString('foo<&"\'>')), 'foo<&"\'>');
+ equal(Handlebars.Utils.escapeExpression(''), '');
+ equal(Handlebars.Utils.escapeExpression(undefined), '');
+ equal(Handlebars.Utils.escapeExpression(null), '');
+ equal(Handlebars.Utils.escapeExpression(false), '');
+
+ equal(Handlebars.Utils.escapeExpression(0), '0');
+ equal(Handlebars.Utils.escapeExpression({}), {}.toString());
+ equal(Handlebars.Utils.escapeExpression([]), [].toString());
+});
+
test('isEmpty', function() {
equal(Handlebars.Utils.isEmpty(undefined), true);
equal(Handlebars.Utils.isEmpty(null), true);

0 comments on commit f4d0092

Please sign in to comment.