-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename requirejs to amdefine test then add new requirejs test
- Loading branch information
Showing
5 changed files
with
41 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ node_modules | |
dist | ||
build | ||
|
||
tasks/test_amdefine.js | ||
tasks/test_requirejs.js | ||
test/jasmine/assets/jquery-1.8.3.min.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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) { | ||
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() {}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters