success: function (data) {
    var geoserve,
        product;

    product = Product(data.properties.products['phase-data'][0]);
    geoserve = Product(data.properties.products.geoserve[0]);

    OriginView({
      el: document.querySelector('#origin-view-example'),
      model: product,
      geoserve: geoserve,
      eventConfig: {
        'GEOSERVE_WS_URL': 'http://earthquake.usgs.gov/ws/geoserve/'
      }
    }).render();
  },
    it('includes 10k and 1k when present', function () {
      var dyfi,
          overlays,
          view;

      view = InteractiveMapView();

      dyfi = Product({
        contents: {
          'dyfi_geo_10km.geojson': {'url': '10k'},
          'dyfi_geo_1km.geojson': {'url': '1k'},
          'dyfi_geo.geojson': {'url': 'default'}
        }
      });

      overlays = view.addDyfiOverlays(dyfi);

      /* jshint -W030 */
      expect(overlays.hasOwnProperty(
          InteractiveMapView.DYFI_10K_OVERLAY)).to.be.true;
      expect(overlays.hasOwnProperty(
          InteractiveMapView.DYFI_1K_OVERLAY)).to.be.true;
      expect(overlays.hasOwnProperty(
          InteractiveMapView.DYFI_DEFAULT_OVERLAY)).to.be.false;
      /* jshint +W030 */

      dyfi.destroy();
    });
    beforeEach(function () {
      view = InteractiveMapView();

      shakemap = Product({
        contents: {
          'download/cont_mi.json': {url: 'contours'},
          'download/stationlist.json': {url: 'stationlist'}
        }
      });
    });
  success: function (data) {
    var product;

    product = Product(data.properties.products['finite-fault'][0]);

    FiniteFaultView({
      el: document.querySelector('#finite-fault-view-example'),
      model: product
    }).render();
  },
    it('does not include default if either 10k or 1k is present', function () {
      var dyfi,
          overlays,
          view;

      view = InteractiveMapView();

      // 10km is present
      dyfi = Product({
        contents: {
          'dyfi_geo_10km.geojson': {'url': '10k'},
          'dyfi_geo.geojson': {'url': 'default'}
        }
      });

      overlays = view.addDyfiOverlays(dyfi);

      /* jshint -W030 */
      expect(overlays.hasOwnProperty(
          InteractiveMapView.DYFI_DEFAULT_OVERLAY)).to.be.false;
      /* jshint -W030 */

      dyfi.destroy();


      // 1k is present
      dyfi = Product({
        contents: {
          'dyfi_geo_1km.geojson': {'url': '1k'},
          'dyfi_geo.geojson': {'url': 'default'}
        }
      });

      overlays = view.addDyfiOverlays(dyfi);

      /* jshint -W030 */
      expect(overlays.hasOwnProperty(
          InteractiveMapView.DYFI_DEFAULT_OVERLAY)).to.be.false;
      /* jshint -W030 */

      dyfi.destroy();
    });
  success: function (data) {
    var product, content;

    product = Product(data.properties.products.dyfi[0]);

    content = product.getContent('cdi_zip.xml');

    DYFIResponsesView({
      el: document.querySelector('#dyfiresponses-view-example'),
      model: product.getContent('cdi_zip.xml')
    }).render();
  },
  success: function (data) {
    var product;

    product = Product(data.properties.products.dyfi[0]);

    var dyfiIntensityGraphView = DYFIIntensityGraphView({
      el: document.querySelector('#dyfi-intensity-graph-view-example'),
      model: product.getContent('dyfi_plot_atten.json')
    });

    dyfiIntensityGraphView.render();
  },
  success: function (data) {
    var content,
        product;

    product = Product(data.properties.products['phase-data'][0]);
    content = product.getContent('quakeml.xml');

    PhasesView({
      el: document.querySelector('#phases-view-example'),
      model: content,
      product: product
    }).render();
  },
    it('delegates to getProductHeader', function () {
      var module,
          stub;

      module = OriginModule();
      stub = sinon.stub(module, 'getProductHeader', function () {});

      module.renderHeader(Product());

      expect(stub.callCount).to.equal(1);

      stub.restore();
      module.destroy();
    });
    it('delegates to image method when appropriate', function () {
      var spy,
          tab,
          view;

      view = DYFIView({
        model: Product(dyfiProductJson)
      });
      spy = sinon.spy(view, 'createImageTab');
      tab = view.createTab({
        suffix: '_ciim.jpg'
      });

      expect(spy.callCount).to.equal(1);
      /* jshint -W030 */
      expect(tab).to.not.be.undefined;
      /* jshint +W030 */

      spy.restore();
      view.destroy();
    });
    it('delegates to sub-view method when appropirate', function () {
      var spy,
          tab,
          view;

      view = DYFIView({
        model: Product(dyfiProductJson)
      });
      spy = sinon.spy(view, 'createSubViewTab');
      tab = view.createTab({
        subview: View,
        subviewContent: 'contents.xml'
      });

      expect(spy.callCount).to.equal(1);
      /* jshint -W030 */
      expect(tab).to.not.be.undefined;
      /* jshint +W030 */

      spy.restore();
      view.destroy();
    });
    it('uses configured url and correct search parameters', function () {
      var view;

      view = GeoserveRegionSummaryView({
        url: 'testurl',
        model: Product({
          properties: {
            latitude: 1.23,
            longitude: 4.56
          }
        })
      });

      view.fetchData();
      expect(args[0].url).to.equal('testurl');
      expect(args[0].data).to.deep.equal({
        latitude: 1.23,
        longitude: 4.56,
        type: 'tectonic'
      });

      view.destroy();
    });
    it('only uses configured source/code properties for type', function () {
      var dyfi,
          mapConfig,
          spy,
          view;

      view = _createMapView();
      dyfi = Product(eventDetails.properties.products.dyfi[0]);
      spy = sinon.spy();
      mapConfig = view.model.get('map') || {};
      mapConfig.shakemapSource = 'fakeSource';
      mapConfig.shakemapCode = 'fakeCode';
      view.model.set({map: mapConfig}, {silent: true});

      view.getProductOverlays('shakemap', spy);
      expect(spy.callCount).to.equal(0); // No matching product, not called

      view.getProductOverlays('dyfi', spy);
      expect(spy.callCount).to.equal(1); // Should still get preferred dyfi
      expect(spy.getCall(0).args[0].get('id')).to.equal(dyfi.get('id'));

      dyfi.destroy();
      view.destroy();
    });
 success: function (data) {
   momentTensorProduct = Product(data.properties.products['moment-tensor'][0]);
   shakemapProduct = Product(data.properties.products.shakemap[0]);
   done();
 },
  _initialize = function (options) {
    _product = options.product || Product();

    _this.el.classList.add('download-view');
    _formatter = options.formatter || Formatter();
  };
 success: function (data) {
   product = Product(data.properties.products['moment-tensor'][0]);
   done();
 },