it('should init views', function () {
      MainView.prototype._initViews.and.callThrough();

      this.view._initViews();

      expect(_.size(this.view._subviews)).toBe(8);
    });
 it('shouldn\'t show error block when collection fetch is aborted', function() {
   this.router.model.set({ content_type: 'datasets' });
   this.collection.trigger('loading');
   expect(this.view._isBlockEnabled('error')).toBeFalsy();
   this.collection.trigger('error', this.collection, { statusText: 'abort' }, {});
   expect(this.view._isBlockEnabled('error')).toBeFalsy();
   expect(_.size(this.view.enabledViews)).toBe(2);
 });
 it('should show list when collection fetch works', function() {
   this.router.model.set({ content_type: 'datasets' });
   this.collection.reset([ this.vis ]);
   expect(this.view._isBlockEnabled('list')).toBeTruthy();
   expect(this.view._isBlockEnabled('content_footer')).toBeTruthy();
   expect(this.view._isBlockEnabled('main_loader')).toBeFalsy();
   expect(_.size(this.view.enabledViews)).toBe(3);
 });
      it('should init views', function () {
        MainView.prototype._initViews.and.callThrough();
        cdb.config.set('cartodb_com_hosted', true);

        this.view._initViews();

        expect(_.size(this.view._subviews)).toBe(7);
      });
 it('should show error block when collection fetch fails', function() {
   this.router.model.set({ content_type: 'datasets' });
   this.collection.trigger('loading');
   expect(this.view._isBlockEnabled('error')).toBeFalsy();
   this.collection.trigger('error');
   expect(this.view._isBlockEnabled('error')).toBeTruthy();
   expect(this.view._isBlockEnabled('list')).toBeFalsy();
   expect(_.size(this.view.enabledViews)).toBe(2);
 });
    it('should show the trial notification if the user\'s account is PERSONAL30', function () {
      this.user = new cdb.admin.User({
        username: '******',
        base_url: 'http://pepe.carto.com',
        email: '*****@*****.**',
        account_type: 'PERSONAL30',
        id: 1,
        api_key: 'hello-apikey'
      });

      this.view = new AccountMainView({
        el: this.$el,
        user: this.user,
        config: {}
      });

      expect(_.size(this.view._subviews)).toBe(8);
    });
    it('should init views', function () {
      this.view.render();

      expect(_.size(this.view._subviews)).toBe(1);
    });
 it('should be rendered properly', function() {
   expect(this.view.$('.ImportPanel-header').length).toBe(1);
   expect(this.view.$('.ImportPanel-form').length).toBe(1);
   expect(this.view.$('.DatasetSelected').length).toBe(1);
   expect(_.size(this.view._subviews)).toBe(3);
 });
Esempio n. 9
0
 it('should render correctly', function() {
   expect(_.size(this.view._subviews)).toBe(5);
   expect(this.view.createPane).toBeDefined();
   expect(this.view.$('.Filters--navListing').length).toBe(1);
   expect(this.view.$('.CreateDialog-listing').length).toBe(1);
 });
  it('should render properly', function () {
    expect(this.view.$el.html()).toContain('Organization icons');

    expect(this.view.$('.js-dialogIconPicker').length).toBe(1);
    expect(_.size(this.view._subviews)).toBe(1); // iconPicker
  });
 it('should render properly', function () {
   expect(_.size(this.view._subviews)).toBe(1);
 });
 it('should init views properly', function () {
   expect(_.size(this.view._subviews)).toBe(7);
 });
 it('should have a tabs panel', function() {
   expect(this.view._panes).not.toBeUndefined();
   expect(_.size(this.view._panes._subviews)).toBe(4);
 });