cartodb-4.42/lib/assets/test/spec/deep-insights/dashboard-view.spec.js
2024-04-06 05:25:13 +00:00

55 lines
1.6 KiB
JavaScript

var Backbone = require('backbone');
var DashboardView = require('../../../javascripts/deep-insights/dashboard-view');
var cdb = require('internal-carto.js');
describe('dashboard-view', function () {
beforeEach(function () {
this.view = new DashboardView({
widgets: new Backbone.Collection(),
model: new cdb.core.Model({
renderMenu: true
})
});
});
it('should setup the template initially because it is required for vis to work', function () {
expect(this.view.$el.html()).toContain('id="map"');
});
describe('when render', function () {
beforeEach(function () {
this.view.render();
});
it('should create widgets subviews ', function () {
expect(this.view.el.querySelector('.Widget-canvas')).toBeDefined();
expect(this.view.el.querySelector('.Dashboard-belowMap')).toBeDefined();
});
});
describe('CARTO logo', function () {
beforeEach(function () {
this.view.model = new Backbone.Model({
renderMenu: true,
showLogo: true
});
this.view.render();
});
it('should render logo properly', function () {
expect(this.view.el.querySelectorAll('.CDB-Dashboard-menuLogo').length).toBe(2); // sidebar and mobile footer
this.view.model.set('renderMenu', false);
this.view.render();
expect(this.view.el.querySelectorAll('.CDB-Dashboard-menuLogo').length).toBe(0);
this.view.model.set({
renderMenu: true,
showLogo: false
});
this.view.render();
expect(this.view.el.querySelectorAll('.CDB-Dashboard-menuLogo').length).toBe(0);
});
});
});