mirror of https://github.com/artf/grapesjs.git
nocodeframeworkdrag-and-dropsite-buildersite-generatortemplate-builderui-builderweb-builderweb-builder-frameworkwebsite-builderno-codepage-builder
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.2 KiB
60 lines
1.2 KiB
const Modal = require('modal_dialog');
|
|
const ModalView = require('./view/ModalView');
|
|
|
|
describe('Modal dialog', () => {
|
|
describe('Main', () => {
|
|
var obj;
|
|
|
|
beforeEach(() => {
|
|
obj = new Modal().init();
|
|
});
|
|
|
|
afterEach(() => {
|
|
obj = null;
|
|
});
|
|
|
|
test('Object exists', () => {
|
|
expect(obj).toBeTruthy();
|
|
});
|
|
|
|
test('Is close by default', () => {
|
|
expect(obj.isOpen()).toEqual(false);
|
|
});
|
|
|
|
test('Title is empty', () => {
|
|
expect(obj.getTitle()).toEqual('');
|
|
});
|
|
|
|
test('Content is empty', () => {
|
|
expect(obj.getContent()).toEqual('');
|
|
});
|
|
|
|
test('Set title', () => {
|
|
obj.setTitle('Test');
|
|
expect(obj.getTitle()).toEqual('Test');
|
|
});
|
|
|
|
test('Set content', () => {
|
|
obj.setContent('Test');
|
|
expect(obj.getContent()).toEqual('Test');
|
|
});
|
|
|
|
test('Set HTML content', () => {
|
|
obj.setContent('<h1>Test</h1>');
|
|
expect(obj.getContent()).toEqual('<h1>Test</h1>');
|
|
});
|
|
|
|
test('Open modal', () => {
|
|
obj.open();
|
|
expect(obj.isOpen()).toEqual(true);
|
|
});
|
|
|
|
test('Close modal', () => {
|
|
obj.open();
|
|
obj.close();
|
|
expect(obj.isOpen()).toEqual(false);
|
|
});
|
|
});
|
|
|
|
ModalView.run();
|
|
});
|
|
|