|
|
|
@ -1,7 +1,15 @@
|
|
|
|
|
define([
|
|
|
|
|
'backbone',
|
|
|
|
|
'marionette',
|
|
|
|
|
'core/layout/module'
|
|
|
|
|
], function (Marionette, LayoutModule) {
|
|
|
|
|
], function (Backbone, Marionette, LayoutModule) {
|
|
|
|
|
|
|
|
|
|
function MockModel() {
|
|
|
|
|
Backbone.Model.apply(this, arguments);
|
|
|
|
|
}
|
|
|
|
|
MockModel.prototype = new Backbone.Model();
|
|
|
|
|
MockModel.prototype.sync = function () {};
|
|
|
|
|
|
|
|
|
|
describe('LayoutModule', function () {
|
|
|
|
|
it('→ exits', function () {
|
|
|
|
|
var app = new Marionette.Application();
|
|
|
|
@ -10,13 +18,26 @@ define([
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('→ onStart', function () {
|
|
|
|
|
var app = null;
|
|
|
|
|
var module = null;
|
|
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
|
app = new Marionette.Application();
|
|
|
|
|
module = new LayoutModule('layout', app, {});
|
|
|
|
|
module.Model = MockModel;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('→ will render view', function () {
|
|
|
|
|
var app = new Marionette.Application();
|
|
|
|
|
var module = new LayoutModule('layout', app, {});
|
|
|
|
|
spyOn(module.View.prototype, 'render');
|
|
|
|
|
module.onStart();
|
|
|
|
|
expect(module.View.prototype.render).toHaveBeenCalled();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('→ will fetch model', function () {
|
|
|
|
|
spyOn(module.Model.prototype, 'fetch');
|
|
|
|
|
module.onStart();
|
|
|
|
|
expect(module.Model.prototype.fetch).toHaveBeenCalled();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|