July 2017
Intermediate to advanced
300 pages
5h 43m
English
Seemingly, we are expected to write unit test, not just for services, but for other modules as well. When testing a view we have to check whether it renders correctly in response to specified events:
./js/View/DirList.spec.js
const { DirListView } = require( "./DirList" ), { DirService } = require( "../Service/Dir" ); describe( "View/DirList", function(){ beforeEach(() => { this.sandbox = document.getElementById( "sandbox" ); this.sandbox.innerHTML = `<ul data-bind="dirList"></ul>`; }); afterEach(() => { this.sandbox.innerHTML = ``; }); describe( "#update", function(){ it( "updates from a given collection", () => { const dirService = new DirService(), view = new DirListView( this.sandbox.querySelector( ...Read now
Unlock full access