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.
26 lines
791 B
26 lines
791 B
import Editor from '../src/editor';
|
|
|
|
// DocEl + Head + Wrapper
|
|
export const DEFAULT_CMPS = 3;
|
|
|
|
export function setupTestEditor() {
|
|
const editor = new Editor({
|
|
mediaCondition: 'max-width',
|
|
avoidInlineStyle: true,
|
|
});
|
|
const em = editor.getModel();
|
|
const dsm = em.DataSources;
|
|
document.body.innerHTML = '<div id="fixtures"></div>';
|
|
const { Pages, Components } = em;
|
|
Pages.onLoad();
|
|
const cmpRoot = Components.getWrapper()!;
|
|
const View = Components.getType('wrapper')!.view;
|
|
const wrapperEl = new View({
|
|
model: cmpRoot,
|
|
config: { ...cmpRoot.config, em },
|
|
});
|
|
wrapperEl.render();
|
|
const fixtures = document.body.querySelector('#fixtures')!;
|
|
fixtures.appendChild(wrapperEl.el);
|
|
return { editor, em, dsm, cmpRoot, fixtures: fixtures as HTMLElement };
|
|
}
|
|
|