summaryrefslogtreecommitdiffstats
path: root/spec/utils.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2013-12-23 00:48:28 -0600
committerkpdecker <kpdecker@gmail.com>2013-12-23 02:19:09 -0600
commit494232425033d7d3aade5b0eba641a93e68e9f89 (patch)
tree3e4fd8fd04b6d670d3da6e2c5e27311b21c80e68 /spec/utils.js
parent0cf5657c43791817776477b727b30ad7f6275707 (diff)
downloadhandlebars.js-494232425033d7d3aade5b0eba641a93e68e9f89.zip
handlebars.js-494232425033d7d3aade5b0eba641a93e68e9f89.tar.gz
handlebars.js-494232425033d7d3aade5b0eba641a93e68e9f89.tar.bz2
Move away from should asserts to internal
This is needed as neither Sinon nor Chai support in-browser testing under IE.
Diffstat (limited to 'spec/utils.js')
-rw-r--r--spec/utils.js44
1 files changed, 23 insertions, 21 deletions
diff --git a/spec/utils.js b/spec/utils.js
index 5eee69e..390ad05 100644
--- a/spec/utils.js
+++ b/spec/utils.js
@@ -1,11 +1,13 @@
-/*global shouldCompileTo */
+/*global Handlebars, shouldCompileTo */
describe('utils', function() {
describe('#SafeString', function() {
it("constructing a safestring from a string and checking its type", function() {
var safe = new Handlebars.SafeString("testing 1, 2, 3");
- safe.should.be.instanceof(Handlebars.SafeString);
- (safe == "testing 1, 2, 3").should.equal(true, "SafeString is equivalent to its underlying string");
+ if (!(safe instanceof Handlebars.SafeString)) {
+ throw new Error('Must be instance of SafeString');
+ }
+ equals(safe == 'testing 1, 2, 3', true, 'SafeString is equivalent to its underlying string');
});
it("it should not escape SafeString properties", function() {
@@ -17,41 +19,41 @@ describe('utils', function() {
describe('#escapeExpression', function() {
it('shouhld escape html', function() {
- Handlebars.Utils.escapeExpression('foo<&"\'>').should.equal('foo&lt;&amp;&quot;&#x27;&gt;');
+ equals(Handlebars.Utils.escapeExpression('foo<&"\'>'), 'foo&lt;&amp;&quot;&#x27;&gt;');
});
it('should not escape SafeString', function() {
var string = new Handlebars.SafeString('foo<&"\'>');
- Handlebars.Utils.escapeExpression(string).should.equal('foo<&"\'>');
+ equals(Handlebars.Utils.escapeExpression(string), 'foo<&"\'>');
});
it('should handle falsy', function() {
- Handlebars.Utils.escapeExpression('').should.equal('');
- Handlebars.Utils.escapeExpression(undefined).should.equal('');
- Handlebars.Utils.escapeExpression(null).should.equal('');
- Handlebars.Utils.escapeExpression(false).should.equal('');
+ equals(Handlebars.Utils.escapeExpression(''), '');
+ equals(Handlebars.Utils.escapeExpression(undefined), '');
+ equals(Handlebars.Utils.escapeExpression(null), '');
+ equals(Handlebars.Utils.escapeExpression(false), '');
- Handlebars.Utils.escapeExpression(0).should.equal('0');
+ equals(Handlebars.Utils.escapeExpression(0), '0');
});
it('should handle empty objects', function() {
- Handlebars.Utils.escapeExpression({}).should.equal({}.toString());
- Handlebars.Utils.escapeExpression([]).should.equal([].toString());
+ equals(Handlebars.Utils.escapeExpression({}), {}.toString());
+ equals(Handlebars.Utils.escapeExpression([]), [].toString());
});
});
describe('#isEmpty', function() {
it('should not be empty', function() {
- Handlebars.Utils.isEmpty(undefined).should.equal(true);
- Handlebars.Utils.isEmpty(null).should.equal(true);
- Handlebars.Utils.isEmpty(false).should.equal(true);
- Handlebars.Utils.isEmpty('').should.equal(true);
- Handlebars.Utils.isEmpty([]).should.equal(true);
+ equals(Handlebars.Utils.isEmpty(undefined), true);
+ equals(Handlebars.Utils.isEmpty(null), true);
+ equals(Handlebars.Utils.isEmpty(false), true);
+ equals(Handlebars.Utils.isEmpty(''), true);
+ equals(Handlebars.Utils.isEmpty([]), true);
});
it('should be empty', function() {
- Handlebars.Utils.isEmpty(0).should.equal(false);
- Handlebars.Utils.isEmpty([1]).should.equal(false);
- Handlebars.Utils.isEmpty('foo').should.equal(false);
- Handlebars.Utils.isEmpty({bar: 1}).should.equal(false);
+ equals(Handlebars.Utils.isEmpty(0), false);
+ equals(Handlebars.Utils.isEmpty([1]), false);
+ equals(Handlebars.Utils.isEmpty('foo'), false);
+ equals(Handlebars.Utils.isEmpty({bar: 1}), false);
});
});
});