|
|
|
@ -4,13 +4,10 @@ import sinon from 'sinon'; |
|
|
|
import Backbone from 'backbone'; |
|
|
|
import grapesjs from './../src'; |
|
|
|
import { JSDOM } from 'jsdom'; |
|
|
|
import jquery from 'jquery'; |
|
|
|
|
|
|
|
const dom = new JSDOM('<!doctype html><html><body></body></html>'); |
|
|
|
const window = dom.window; |
|
|
|
const $ = jquery(window); |
|
|
|
|
|
|
|
//https://www.npmjs.com/package/proxyquire
|
|
|
|
//const $ = jquery(window);
|
|
|
|
|
|
|
|
// Fix for the spectrum lib
|
|
|
|
var Module = require('module'); |
|
|
|
@ -18,7 +15,7 @@ var originalRequire = Module.prototype.require; |
|
|
|
|
|
|
|
Module.prototype.require = function(name) { |
|
|
|
if (name == 'jquery') { |
|
|
|
return $; |
|
|
|
return Backbone.$; |
|
|
|
} |
|
|
|
return originalRequire.apply(this, arguments); |
|
|
|
}; |
|
|
|
@ -37,7 +34,6 @@ var localStorage = { |
|
|
|
|
|
|
|
global.window = window; |
|
|
|
global.document = window.document; |
|
|
|
global.$ = $; |
|
|
|
global._ = _; |
|
|
|
global.expect = expect; |
|
|
|
global.sinon = sinon; |
|
|
|
@ -45,8 +41,13 @@ global.grapesjs = grapesjs; |
|
|
|
global.Backbone = Backbone; |
|
|
|
global.localStorage = localStorage; |
|
|
|
global.SVGElement = global.Element; |
|
|
|
window.$ = $; |
|
|
|
Backbone.$ = $; |
|
|
|
global.navigator = { |
|
|
|
userAgent: 'node.js' |
|
|
|
}; |
|
|
|
|
|
|
|
// Need this to trigger the cash generation
|
|
|
|
grapesjs.init({container: 'body', autorender: 0}); |
|
|
|
window.$ = Backbone.$; |
|
|
|
|
|
|
|
Object.keys(window).forEach((key) => { |
|
|
|
if (!(key in global)) { |
|
|
|
|