Skip to content

Commit

Permalink
reorganize and refactor applicaiton, behavior, and childView unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wesmangum authored and paulfalgout committed Nov 9, 2017
1 parent 2b33e64 commit 91ab7ea
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 36 deletions.
1 change: 1 addition & 0 deletions test/unit/application.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

import _ from 'underscore';
import Application from '../../src/application';
import View from '../../src/view';

Expand Down
72 changes: 36 additions & 36 deletions test/unit/child-view-container.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,42 +31,6 @@ describe('#ChildViewContainer', function() {
});
});

describe('#_set', function() {
let container;
let views;
let originalViews;

beforeEach(function() {
views = [
new Backbone.View(),
new Backbone.View()
];

container = new ChildViewContainer();

container._add(new Backbone.View());
container._add(new Backbone.View());
container._add(new Backbone.View());

originalViews = container._views;

container._set(views);
});

it('should replace the contents of _views', function() {
expect(container._views[0]).to.equal(views[0]);
});

it('should keep the _views array reference', function() {
expect(container._views).to.equal(originalViews);
});

it('should update the container length', function() {
expect(container.length).to.equal(2);
});

});

describe('#_add', function() {
describe('when adding a view that does not have a model', function() {
let container;
Expand Down Expand Up @@ -151,6 +115,42 @@ describe('#ChildViewContainer', function() {

});

describe('#_set', function() {
let container;
let views;
let originalViews;

beforeEach(function() {
views = [
new Backbone.View(),
new Backbone.View()
];

container = new ChildViewContainer();

container._add(new Backbone.View());
container._add(new Backbone.View());
container._add(new Backbone.View());

originalViews = container._views;

container._set(views);
});

it('should replace the contents of _views', function() {
expect(container._views[0]).to.equal(views[0]);
});

it('should keep the _views array reference', function() {
expect(container._views).to.equal(originalViews);
});

it('should update the container length', function() {
expect(container.length).to.equal(2);
});

});

describe('#_remove', function() {
describe('when removing a view that has a model', function() {
let container;
Expand Down

0 comments on commit 91ab7ea

Please sign in to comment.