Exemplo n.º 1
0
  it('should not call again if a request is ongoing', function () {
    var stateModel = {};

    // First call
    zoomToData(configModel, stateModel, query);
    expect(jasmine.Ajax.requests.count()).toBe(1);

    // Second call
    zoomToData(configModel, stateModel, query);
    expect(jasmine.Ajax.requests.count()).toBe(1);
  });
Exemplo n.º 2
0
  it('should call stateModel.setBounds with the bounds response', function () {
    var result;
    var stateModel = {
      setBounds: function (bounds) {
        result = bounds;
      }
    };

    // Actual call
    zoomToData(configModel, stateModel, query);

    // Respond to call
    var request = jasmine.Ajax.requests.mostRecent();
    request.respondWith(responses.success);
    jasmine.clock().tick(10);

    expect(result[0][1]).toBe(bounds.rows[0].maxx);
  });
Exemplo n.º 3
0
 expect(function () {
   zoomToData({});
 }).toThrowError('stateModel is required');
Exemplo n.º 4
0
 expect(function () {
   zoomToData({}, {});
 }).toThrowError('query is required');
Exemplo n.º 5
0
 expect(function () {
   zoomToData();
 }).toThrowError('configModel is required');