mirror of https://github.com/artf/grapesjs.git
86 changed files with 264 additions and 264 deletions
@ -1,49 +0,0 @@ |
|||
import _ from 'underscore'; |
|||
import sinon from 'sinon'; |
|||
import { JSDOM } from 'jsdom'; |
|||
|
|||
const dom = new JSDOM('<!doctype html><html><body></body></html>', { |
|||
resources: 'usable' |
|||
}); |
|||
const window = dom.window; |
|||
|
|||
// Fix for the require of jquery
|
|||
var Module = require('module'); |
|||
var originalRequire = Module.prototype.require; |
|||
Module.prototype.require = function(name) { |
|||
if (name == 'jquery') { |
|||
return originalRequire.call(this, 'cash-dom'); |
|||
} |
|||
return originalRequire.apply(this, arguments); |
|||
}; |
|||
|
|||
var localStorage = { |
|||
getItem(key) { |
|||
return this[key]; |
|||
}, |
|||
setItem(key, value) { |
|||
this[key] = value; |
|||
}, |
|||
removeItem(key, value) { |
|||
delete this[key]; |
|||
} |
|||
}; |
|||
|
|||
global.window = window; |
|||
global.document = window.document; |
|||
global.FormData = window.FormData; |
|||
global._ = _; |
|||
global.expect = expect; |
|||
global.sinon = sinon; |
|||
global.grapesjs = require('./../src'); |
|||
global.Backbone = require('backbone'); |
|||
global.localStorage = localStorage; |
|||
global.SVGElement = global.Element; |
|||
window.$ = Backbone.$; |
|||
global.navigator = { userAgent: 'node.js' }; |
|||
|
|||
Object.keys(window).forEach(key => { |
|||
if (!(key in global)) { |
|||
global[key] = window[key]; |
|||
} |
|||
}); |
|||
@ -0,0 +1,23 @@ |
|||
import _ from 'underscore'; |
|||
import Backbone from 'backbone'; |
|||
import sinon from 'sinon'; |
|||
import grapesjs from './../src'; |
|||
|
|||
const localStorage = { |
|||
getItem(key) { |
|||
return this[key]; |
|||
}, |
|||
setItem(key, value) { |
|||
this[key] = value; |
|||
}, |
|||
removeItem(key, value) { |
|||
delete this[key]; |
|||
} |
|||
}; |
|||
|
|||
global.Backbone = Backbone; |
|||
global._ = _; |
|||
global.sinon = sinon; |
|||
global.grapesjs = grapesjs; |
|||
global.$ = Backbone.$; |
|||
global.localStorage = localStorage; |
|||
Loading…
Reference in new issue