Browse Source

Refactor index.js

pull/288/head
Artur Arseniev 9 years ago
parent
commit
273d056921
  1. 2
      dist/grapes.min.js
  2. 4
      src/grapesjs/index.js
  3. 12
      test/specs/grapesjs/index.js

2
dist/grapes.min.js

File diff suppressed because one or more lines are too long

4
src/grapesjs/index.js

@ -16,7 +16,7 @@ module.exports = (() => {
/**
* Initializes an editor based on passed options
* @param {Object} config Configuration object
* @param {string} config.container Selector which indicates where render the editor
* @param {string|HTMLElement} config.container Selector which indicates where render the editor
* @param {Object|string} config.components='' HTML string or Component model in JSON format
* @param {Object|string} config.style='' CSS string or CSS model in JSON format
* @param {Boolean} [config.fromElement=false] If true, will fetch HTML and CSS from selected container
@ -44,7 +44,7 @@ module.exports = (() => {
}
defaults(config, defaultConfig);
config.el = document.querySelector(els);
config.el = els instanceof window.HTMLElement ? els : document.querySelector(els);
const editor = new Editor(config).init();
// Load plugins

12
test/specs/grapesjs/index.js

@ -59,6 +59,18 @@ describe('GrapesJS', () => {
var editor = obj.init(config);
expect(editor).toExist();
});
it('Init new editor with node for container', () => {
var configAlt = {
container: document.createElement('div'),
storageManager: {
autoload: 0,
type:'none'
},
}
var editor = obj.init(configAlt);
expect(editor).toExist();
});
it('New editor is empty', () => {
var editor = obj.init(config);

Loading…
Cancel
Save