You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
902 B

var Backbone = require('backbone');
var DataviewModel = require('../../../src/dataviews/dataview-model-base');
var MockFactory = require('../../helpers/mockFactory');
describe('dataviews/dataview-collection', function () {
beforeEach(function () {
this.collection = new Backbone.Collection();
this.source = MockFactory.createAnalysisModel({ id: 'a0' });
});
it('should remove item when removed', function () {
var map = jasmine.createSpyObj('map', ['getViewBounds', 'off']);
map.getViewBounds.and.returnValue([[0, 0], [0, 0]]);
var engineMock = jasmine.createSpyObj('engine', ['reload']);
var dataviewModel = new DataviewModel({ source: this.source }, { map: map, engine: engineMock });
this.collection.add(dataviewModel);
expect(this.collection.length).toEqual(1);
this.collection.first().remove();
expect(this.collection.length).toEqual(0);
});
});