-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #674 from danvk/module
Use ES6 modules
- Loading branch information
Showing
216 changed files
with
2,034 additions
and
3,683 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ docs/options.html | |
node_modules | ||
env | ||
dist | ||
coverage | ||
*.log |
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
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 was deleted.
Oops, something went wrong.
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,66 @@ | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>dygraphs tests</title> | ||
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" /> | ||
</head> | ||
<body> | ||
<div id="graph"></div> | ||
<div id="mocha"></div> | ||
|
||
<!-- Polyfills for PhantomJS --> | ||
<script src="../node_modules/babel-core/browser-polyfill.js"></script> | ||
|
||
<!-- Mocha --> | ||
<script src="../node_modules/mocha/mocha.js"></script> | ||
<script src="../node_modules/chai/chai.js"></script> | ||
<script> | ||
if (window.initMochaPhantomJS) { | ||
window.initMochaPhantomJS(); | ||
} | ||
</script> | ||
|
||
<script> | ||
var expect = chai.expect; | ||
var assert = chai.assert; | ||
function cleanupAfterEach() { | ||
// Clean up the DOM before each test. | ||
// This makes debugging easier than cleaning up after each test, since the | ||
// DOM stays on the screen after a failure. | ||
beforeEach(function() { | ||
var graph = document.getElementById('graph'); | ||
graph.innerHTML = ''; | ||
graph.setAttribute('style', ''); | ||
}); | ||
} | ||
function useProxyCanvas(utils, Proxy) { | ||
var _origFunc = utils.getContext; | ||
beforeEach(function() { | ||
utils.getContext = function(canvas) { | ||
return new Proxy(_origFunc(canvas)); | ||
} | ||
}); | ||
|
||
afterEach(function() { | ||
utils.getContext = _origFunc; | ||
}); | ||
} | ||
</script> | ||
<script>mocha.setup('bdd')</script> | ||
|
||
<!-- Test data --> | ||
<script src="data/data.js"></script> | ||
|
||
<!-- Bundled tests --> | ||
<script src="../coverage/tests.js"></script> | ||
|
||
<script> | ||
mocha.checkLeaks(); | ||
if (window.mochaPhantomJS) { | ||
mochaPhantomJS.run(); | ||
} else { | ||
mocha.run(); | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file was deleted.
Oops, something went wrong.
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,66 @@ | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>dygraphs tests</title> | ||
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" /> | ||
</head> | ||
<body> | ||
<div id="graph"></div> | ||
<div id="mocha"></div> | ||
|
||
<!-- Polyfills for PhantomJS --> | ||
<script src="../node_modules/babel-core/browser-polyfill.js"></script> | ||
|
||
<!-- Mocha --> | ||
<script src="../node_modules/mocha/mocha.js"></script> | ||
<script src="../node_modules/chai/chai.js"></script> | ||
<script> | ||
if (window.initMochaPhantomJS) { | ||
window.initMochaPhantomJS(); | ||
} | ||
</script> | ||
|
||
<script> | ||
var expect = chai.expect; | ||
var assert = chai.assert; | ||
function cleanupAfterEach() { | ||
// Clean up the DOM before each test. | ||
// This makes debugging easier than cleaning up after each test, since the | ||
// DOM stays on the screen after a failure. | ||
beforeEach(function() { | ||
var graph = document.getElementById('graph'); | ||
graph.innerHTML = ''; | ||
graph.setAttribute('style', ''); | ||
}); | ||
} | ||
function useProxyCanvas(utils, Proxy) { | ||
var _origFunc = utils.getContext; | ||
beforeEach(function() { | ||
utils.getContext = function(canvas) { | ||
return new Proxy(_origFunc(canvas)); | ||
} | ||
}); | ||
|
||
afterEach(function() { | ||
utils.getContext = _origFunc; | ||
}); | ||
} | ||
</script> | ||
<script>mocha.setup('bdd')</script> | ||
|
||
<!-- Test data --> | ||
<script src="data/data.js"></script> | ||
|
||
<!-- Bundled tests --> | ||
<script src="../dist/tests.js"></script> | ||
|
||
<script> | ||
mocha.checkLeaks(); | ||
if (window.mochaPhantomJS) { | ||
mochaPhantomJS.run(); | ||
} else { | ||
mocha.run(); | ||
} | ||
</script> | ||
</body> | ||
</html> |
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 |
---|---|---|
|
@@ -244,3 +244,5 @@ CanvasAssertions.match = function(predicate, call) { | |
} | ||
return true; | ||
}; | ||
|
||
export default CanvasAssertions; |
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
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,6 +3,9 @@ | |
* | ||
* @author [email protected] (Robert Konigsberg) | ||
*/ | ||
|
||
import * as utils from '../../src/dygraph-utils'; | ||
|
||
var Util = {}; | ||
|
||
/** | ||
|
@@ -90,14 +93,14 @@ Util.makeNumbers = function(ary) { | |
/** | ||
* Sample a pixel from the canvas. | ||
* Returns an [r, g, b, a] tuple where each values is in [0, 255]. | ||
* This is _very_ slow! If you want to sample many pixels, use PixelSampler. | ||
*/ | ||
Util.samplePixel = function(canvas, x, y) { | ||
var ctx = canvas.getContext("2d"); // bypasses Proxy if applied. | ||
|
||
// TODO(danvk): Any performance issues with this? | ||
var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); | ||
|
||
var scale = Dygraph.getContextPixelRatio(ctx); | ||
var scale = utils.getContextPixelRatio(ctx); | ||
|
||
var i = 4 * (x * scale + imageData.width * y * scale); | ||
var d = imageData.data; | ||
|
@@ -145,7 +148,7 @@ Util.overrideXMLHttpRequest = function(data) { | |
* @return {string} The date formatted as YYYY-MM-DD. | ||
*/ | ||
Util.formatDate = function(dateMillis) { | ||
return Dygraph.dateString_(dateMillis).slice(0, 10); // 10 == "YYYY/MM/DD".length | ||
return utils.dateString_(dateMillis).slice(0, 10); // 10 == "YYYY/MM/DD".length | ||
}; | ||
|
||
/** | ||
|
@@ -168,3 +171,5 @@ Util.captureConsole = function(obj) { | |
console.error = orig[2]; | ||
}; | ||
}; | ||
|
||
export default Util; |
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,14 +3,13 @@ | |
* | ||
* @author [email protected] (Dan Vanderkam) | ||
*/ | ||
describe("annotations", function() { | ||
|
||
beforeEach(function() { | ||
document.body.innerHTML = "<div id='graph'></div>"; | ||
}); | ||
import Dygraph from '../../src/dygraph'; | ||
import Util from './Util'; | ||
|
||
afterEach(function() { | ||
}); | ||
describe("annotations", function() { | ||
|
||
cleanupAfterEach(); | ||
|
||
it('testAnnotationsDrawn', function() { | ||
var opts = { | ||
|
Oops, something went wrong.