Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

test-driving backbone views with jquery templates

View 1-problem.js
1 2 3 4 5 6 7 8
NutShell = Backbone.View.extend({
initialize: function(){
 
// road block!
this.template = $("#some-template-id");
 
}
});
View 1-problem.js
1 2 3 4 5 6
<script id="some-template-id" type="text/x-jquery-tmpl">
<h1>some template {{name}}</h1>
<div id="foo">
and stuff here. {{description}}
</div>
</script>
View 1-problem.js
1 2 3 4 5 6 7 8 9
describe("a test with a fixture", function(){
beforeEach(function(){
 
// load my template for use in this spec!
loadFixtures("some-template-id.erb");
 
});
it("...", function(){ /* ... */ });
});
View 1-problem.js
1 2 3 4 5 6 7 8 9 10 11
<html>
<head>
 
<%= erb :'some-template-id' %>
 
...
</head>
<body>
...
</body>
</html>
View 1-problem.js
1
jasmine.getFixtures().fixturesPath = '/views/';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.