cartodb-4.42/lib/assets/test/spec/builder/data/state-definition-model.spec.js

35 lines
888 B
JavaScript
Raw Normal View History

2024-04-06 13:25:13 +08:00
var StateDefinitionModel = require('builder/data/state-definition-model');
describe('data/state-definition-model', function () {
beforeEach(function () {
var anObject = { something: 'something' };
var visDefinitionModel = {};
this.model = new StateDefinitionModel({
json: JSON.stringify(anObject)
}, {
visDefinitionModel: visDefinitionModel
});
});
describe('.setBounds', function () {
it(' should trigger event when called', function () {
jasmine.clock().install();
var expectedBounds = [808];
var actualBounds;
function onBoundsSet (bounds) {
actualBounds = bounds;
}
this.model.on('boundsSet', onBoundsSet);
this.model.setBounds(expectedBounds);
jasmine.clock().tick(10);
expect(actualBounds[0]).toBe(expectedBounds[0]);
jasmine.clock().uninstall();
});
});
});