Merge pull request #674 from danvk/module
[dygraphs.git] / auto_tests / tests / per_axis.js
index 4ae6208..d7f1a49 100644 (file)
@@ -3,9 +3,18 @@
  *
  * @author konigsberg@google.com (Robert Konigsberg)
  */
+
+import Dygraph from '../../src/dygraph';
+import * as utils from '../../src/dygraph-utils';
+
+import Util from './Util';
+import CanvasAssertions from './CanvasAssertions';
+import Proxy from './Proxy';
+
 describe("per-axis", function() {
 
-var _origGetContext = Dygraph.getContext;
+cleanupAfterEach();
+useProxyCanvas(utils, Proxy);
 
 var xAxisLineColor = "#00ffff";
 var yAxisLineColor = "#ffff00";
@@ -13,11 +22,6 @@ var yAxisLineColor = "#ffff00";
 var g, graph;
 
 beforeEach(function() {
-  document.body.innerHTML = "<div id='graph'></div>";
-  Dygraph.getContext = function(canvas) {
-    return new Proxy(_origGetContext(canvas));
-  }
-
   var opts = {
     axes : {
       x : {
@@ -42,10 +46,6 @@ beforeEach(function() {
   g = new Dygraph(graph, data, opts);
 });
 
-afterEach(function() {
-  Dygraph.getContext = _origGetContext;
-});
-
 it('testDrawXAxis', function() {
   g.updateOptions({ axes : { x : { drawAxis: true }} });
   assert.isTrue(graph.getElementsByClassName('dygraph-axis-label-x').length > 0);