forked from plotly/plotly.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_amdefine.js
28 lines (24 loc) · 948 Bytes
/
test_amdefine.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
var JSDOM = require('jsdom').JSDOM;
global.document = new JSDOM('<!DOCTYPE html><head></head><html><body></body></html>').window.document;
global.window = document.defaultView;
global.window.document = global.document;
global.self = global.window;
global.Blob = global.window.Blob;
global.DOMParser = global.window.DOMParser;
global.getComputedStyle = global.window.getComputedStyle;
global.window.URL.createObjectURL = function() {};
// see: Building node modules with AMD or RequireJS https://requirejs.org/docs/node.html
if(typeof define !== 'function') {
var define = require('amdefine')(module);
}
define(function(require) {
var plotly = require('../dist/plotly.min.js');
if(plotly && plotly.PlotSchema) {
console.log(plotly);
} else {
throw 'Error: loading with amdefine';
}
// The value returned from the function is
// used as the module export visible to Node.
return function() {};
});