Browse Source

enabled iframes in jsdoc and added positive and negative tests for baseCss overwriting feature

pull/942/head
Tom Medema 8 years ago
parent
commit
aba4b2362a
  1. 6
      test/helper.js
  2. 31
      test/specs/grapesjs/index.js

6
test/helper.js

@ -3,7 +3,10 @@ import expect from 'expect';
import sinon from 'sinon';
import { JSDOM } from 'jsdom';
const dom = new JSDOM('<!doctype html><html><body></body></html>');
const dom = new JSDOM('<!doctype html><html><body></body></html>', {
resources: 'usable',
pretendToBeVisual: true
});
const window = dom.window;
// Fix for the require of jquery
@ -28,6 +31,7 @@ var localStorage = {
}
};
global.dom = dom;
global.window = window;
global.document = window.document;
global.FormData = window.FormData;

31
test/specs/grapesjs/index.js

@ -79,19 +79,30 @@ describe('GrapesJS', () => {
expect(editor.getStyle().length).toEqual(0);
});
// FIXME: remove .only
it.only('Editor canvas baseCSS can be overwritten', done => {
it('Editor canvas baseCSS can be overwritten', () => {
config.components = htmlString;
config.baseCss = '#wrapper { background-color: #fff; }';
config.baseCss = '#wrapper { background-color: #eee; }';
config.protectedCss = '';
var editor = obj.init(config);
const frame = editor.Canvas.getFrameEl();
console.log(frame);
frame.onload = () => {
// FIXME: this never fires
console.log(frame.contentDocument.outerHTML);
done();
};
expect(window.frames[0].document.documentElement.outerHTML).toInclude(
config.baseCss
);
expect(window.frames[0].document.documentElement.outerHTML)
.toNotInclude(`body {
margin: 0;`);
});
it('Editor canvas baseCSS defaults to sensible values if not defined', () => {
config.components = htmlString;
config.protectedCss = '';
var editor = obj.init(config);
expect(window.frames[0].document.documentElement.outerHTML)
.toInclude(`body {
margin: 0;`);
});
it('Init editor with html', () => {

Loading…
Cancel
Save