I am trying to test a backbone application.
When I need to test a simple backbone.view I have no problem.
If I need to test a Backbone View made by using Backbone.Marionette (ItemView or CompositeView) and Handlebars template I get the following message:
NoTemplateError: Could not find template:
function(context, options) {
if (!compiled) {
compiled = compile();
}
return compiled.call(this, context, options);
};
The code about function(context, options) comes from handlebars-1.0.0.beta.6.js.
Any idea how to fix the code?
Here the test which I am performing:
describe("AppViewMarionette", function() {
beforeEach(function(){
this.view = new AppViewMarionette();
});
describe("Rendering", function () {
it("returns the view object", function () {
expect(this.view.render()).toEqual(this.view);
});
});
});
You need to update your version of Marionette. v0.9.1 doesn’t support pre-compiled templates being directly assigned to the
templatesetting. You need v0.9.7 or higher for that.If you can’t update, you’ll need to follow these instructions to get it working: https://github.com/derickbailey/backbone.marionette/wiki/Using-pre-compiled-templates