*
* @author konigsberg@google.com (Robert Konigsberg)
*/
+
+import Dygraph from '../../src/dygraph';
+
+import DygraphOps from './DygraphOps';
+import Util from './Util';
+
describe("resize", function() {
+cleanupAfterEach();
+
var data =
"X,Y\n" +
"1,100\n" +
"5,300\n" +
"6,100\n";
-beforeEach(function() {
- document.body.innerHTML = "<div id='graph'></div>";
-});
-
-afterEach(function() {
-});
-
it('testResizeMaintainsMouseOperations', function() {
- document.body.innerHTML =
- '<div id="graph" style="width: 640px; height: 480px;"></div>' +
- '</div>';
- var graph = document.getElementById("graph");
+ var graph = document.getElementById('graph');
+ graph.setAttribute('style', 'width: 640px; height: 480px;');
var callbackCount = 0;
var callback = function() {
strum(g, 300, 640);
assert.equal(6, callbackCount);
- document.getElementById("graph").style.width = "500px";
+ graph.style.width = "500px";
g.resize();
callbackCount = 0;
g.resize();
var x = Math.floor(g.toDomXCoord(2));
var y = Math.floor(g.toDomYCoord(200));
- assert.equal("Unexpected grid color found at pixel: x: " + x + " y: " + y,
- [0, 128, 128, 255], Util.samplePixel(g.hidden_, x, y));
+ assert.deepEqual([0, 128, 128, 255], Util.samplePixel(g.hidden_, x, y),
+ "Unexpected grid color found at pixel: x: " + x + " y: " + y);
});
});