February 2019
Beginner
694 pages
18h 4m
English
Once we are happy that our Backbone models are hydrating correctly, we can turn our attention to their views, and write some tests to ensure that they render these model properties correctly to the DOM. We will use Jasmine's setFixtures function to set up our Backbone templates, as follows:
describe("views.spec.ts : ItemView tests", () => {
let itemModel: ItemModel;
beforeEach(() => {
jasmine.getFixtures().fixturesPath = "./";
loadFixtures("views.spec.html");
itemModel = new ItemModel({
Id: 10,
DisplayName: "testDisplayName"
});
});
Here, we have created and instantiated an ItemModel instance named itemModel for reuse within each test. We are also calling the Jasmine function loadFixtures in order to inject the HTML <script> ...
Read now
Unlock full access