Skip to content

Commit

Permalink
Added test for external helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
davglass committed Jul 6, 2012
1 parent d1b26bb commit caded4c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tests/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ var suite = new YUITest.TestSuite({
var options = {
quiet: true,
paths: [ 'input/' ],
outdir: './out'
outdir: './out',
helpers: [
path.join(__dirname, 'lib/davglass.js')
]
};
var json = (new Y.YUIDoc(options)).run();

Expand Down Expand Up @@ -140,6 +143,21 @@ suite.add(new YUITest.TestCase({
Assert.isObject(method, 'Failed to find inherited method');
Assert.isObject(method.overwritten_from, 'Failed to find overwritten data');
}, item);
},
'test: helper methods': function() {
var item = suite.data.classes['mywidget.SuperWidget'];
Assert.isObject(item, 'Failed to parse class');
suite.builder.renderClass(function(html, view, opts) {
var method;
opts.meta.methods.forEach(function(i) {
if (i.name === 'getTargets2' && i.class === 'mywidget.SuperWidget') {
method = i;
}
});

Assert.isObject(method, 'Failed to find inherited method');
Assert.isTrue((method.description.indexOf('DAVGLASS_WAS_HERE::Foo') > 0), 'Helper failed to parse');
}, item);
}
}));

Expand Down
5 changes: 5 additions & 0 deletions tests/lib/davglass.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
davglass: function(str) {
return 'DAVGLASS_WAS_HERE::' + str;
}
}

0 comments on commit caded4c

Please sign in to comment.