Permalink
Browse files

Formatting, and remove console.log in tests

  • Loading branch information...
1 parent 875bfb2 commit 902e262272832261b4eacb55ff31991e1ed48175 @larzconwell larzconwell committed Dec 22, 2012
Showing with 16 additions and 15 deletions.
  1. +7 −8 lib/template/adapters/handlebars.js
  2. +9 −7 test/templates/engines/handlebars_mustache.js
View
15 lib/template/adapters/handlebars.js
@@ -76,25 +76,24 @@ Handlebars.prototype.registerHelpers = function (helpers) {
*/
Handlebars.prototype.wrapOptions = function (helper) {
- return function() {
- var argsLen = arguments.length,
- options = argsLen ? arguments[argsLen - 1] : null,
- i = 0 , newArgs;
+ return function () {
+ var argsLen = arguments.length
+ , options = argsLen ? arguments[argsLen - 1] : null
+ , i, newArgs;
if (options && options.hash) {
newArgs = [];
- for (;i<argsLen - 1; i++) {
+ for (i = 0; i<argsLen - 1; i++) {
newArgs.push(arguments[i]);
}
newArgs.push(options.hash);
return helper.apply(this, newArgs);
- }
- else {
+ } else {
return helper.apply(this, arguments);
}
}
}
-module.exports = Handlebars;
+module.exports = Handlebars;
View
16 test/templates/engines/handlebars_mustache.js
@@ -80,18 +80,20 @@ tests = {
var html = '<p>foo</p>',
str = '<p>{{#items}}{{foo}}{{/items}}</p>';
assert.equal(html, render(str, {items: [{foo: 'foo'}]}));
- },
+ }
- 'test hash arguments' : function () {
+, 'test hash arguments' : function () {
var html = 'foobar.com/main/index'
, tpl = "{{url host='foobar.com' controller='main' action='index'}}"
- , helper = function(options) {
- console.log(options);
- return options.host + '/' + options.controller + '/' + options.action
- }
+ , helper, adapter;
+
+ helper = function (options) {
+ return options.host + '/' + options.controller + '/' + options.action
+ };
- var adapter = new Adapter({engine: 'handlebars', template: tpl});
+ adapter = new Adapter({engine: 'handlebars', template: tpl});
adapter.registerHelper('url', helper);
+
assert.equal(html, adapter.render());
}

0 comments on commit 902e262

Please sign in to comment.