cartodb/lib/assets/test/spec/builder/components/infobox/infobox-factory.spec.js
2020-06-15 10:58:47 +08:00

49 lines
1.2 KiB
JavaScript

var Infobox = require('builder/components/infobox/infobox-factory');
describe('components/infobox/infobox-factory', function () {
var view;
describe('createInfo', function () {
it('no closable', function () {
view = Infobox.createInfo({
title: 'Info',
body: 'Lorem ipsum dolor sit amet.',
closable: false
});
view.render();
expect(view.$('button').length).toBe(0);
});
it('closable', function () {
view = Infobox.createInfo({
title: 'Info',
body: 'Lorem ipsum dolor sit amet.'
});
view.render();
expect(view.$('button').length).toBe(1);
expect(view.$('button').eq(0).html()).toContain('editor.messages.common.cancel');
});
});
describe('createWithActions', function () {
it('main action', function () {
view = Infobox.createWithAction({
title: 'Info',
body: 'Lorem ipsum dolor sit amet.',
closable: false,
action: {
label: 'Confirm'
}
});
view.render();
expect(view.$('.Infobox')).toBeDefined();
expect(view.$('button').length).toBe(1);
expect(view.$('button').text()).toContain('Confirm');
});
});
});