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.
70 lines
1.7 KiB
70 lines
1.7 KiB
module.exports = {
|
|
run() {
|
|
describe('E2E tests', () => {
|
|
var fixtures;
|
|
var fixture;
|
|
var obj;
|
|
var config;
|
|
var editorName = 'panel-fixture';
|
|
|
|
beforeAll(() => {
|
|
fixtures = $('<div id="#fixtures"></div>').appendTo('body');
|
|
});
|
|
|
|
beforeEach(() => {
|
|
obj = grapesjs;
|
|
config = {
|
|
container: '#' + editorName,
|
|
storageManager: { autoload: 0, type: 'none' }
|
|
};
|
|
fixture = $('<div id="' + editorName + '"></div>');
|
|
fixture.empty().appendTo(fixtures);
|
|
});
|
|
|
|
afterEach(() => {
|
|
obj = null;
|
|
config = null;
|
|
fixture.remove();
|
|
});
|
|
|
|
afterAll(() => {
|
|
//fixture.remove();
|
|
});
|
|
|
|
test('Command is correctly executed on button click', () => {
|
|
var commandId = 'command-test';
|
|
config.commands = {
|
|
defaults: [
|
|
{
|
|
id: commandId,
|
|
run(ed, caller) {
|
|
ed.testValue = 'testValue';
|
|
caller.set('active', false);
|
|
}
|
|
}
|
|
]
|
|
};
|
|
config.panels = {
|
|
defaults: [
|
|
{
|
|
id: 'toolbar-test',
|
|
buttons: [
|
|
{
|
|
id: 'button-test',
|
|
className: 'fa fa-smile-o',
|
|
command: commandId
|
|
}
|
|
]
|
|
}
|
|
]
|
|
};
|
|
var editor = obj.init(config);
|
|
editor.testValue = '';
|
|
var button = editor.Panels.getButton('toolbar-test', 'button-test');
|
|
button.set('active', 1);
|
|
expect(editor.testValue).toEqual('testValue');
|
|
expect(button.get('active')).toEqual(false);
|
|
});
|
|
});
|
|
}
|
|
};
|
|
|