projects
/
dygraphs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Support boolean array in setVisibility
[dygraphs.git]
/
auto_tests
/
tests
/
range_selector.js
diff --git
a/auto_tests/tests/range_selector.js
b/auto_tests/tests/range_selector.js
index
b04cbb5
..
584e054
100644
(file)
--- a/
auto_tests/tests/range_selector.js
+++ b/
auto_tests/tests/range_selector.js
@@
-6,11
+6,15
@@
*/
describe("range-selector", function() {
*/
describe("range-selector", function() {
+var restoreConsole;
+var logs = {};
beforeEach(function() {
document.body.innerHTML = "<div id='graph'></div>";
beforeEach(function() {
document.body.innerHTML = "<div id='graph'></div>";
+ restoreConsole = Util.captureConsole(logs);
});
afterEach(function() {
});
afterEach(function() {
+ restoreConsole();
});
it('testRangeSelector', function() {
});
it('testRangeSelector', function() {
@@
-183,8
+187,13
@@
it('testRangeSelectorEnablingAfterCreation', function() {
];
var graph = document.getElementById("graph");
var g = new Dygraph(graph, data, opts);
];
var graph = document.getElementById("graph");
var g = new Dygraph(graph, data, opts);
+ var initialChartHeight = g.getArea().h;
g.updateOptions({showRangeSelector: true});
assertGraphExistence(g, graph);
g.updateOptions({showRangeSelector: true});
assertGraphExistence(g, graph);
+ assert(g.getArea().h < initialChartHeight); // range selector shown
+
+ g.updateOptions({showRangeSelector: false});
+ assert.equal(g.getArea().h, initialChartHeight); // range selector hidden
});
// The animatedZooms option does not work with the range selector. Make sure it gets turned off.
});
// The animatedZooms option does not work with the range selector. Make sure it gets turned off.
@@
-211,6
+220,10
@@
it('testRangeSelectorWithAnimatedZoomsOption', function() {
var g = new Dygraph(graph, data, opts);
assertGraphExistence(g, graph);
assert.isFalse(g.getOption('animatedZooms'));
var g = new Dygraph(graph, data, opts);
assertGraphExistence(g, graph);
assert.isFalse(g.getOption('animatedZooms'));
+ assert.deepEqual(logs, {
+ log: [], error: [],
+ warn: ["Animated zooms and range selector are not compatible; disabling animatedZooms."]
+ });
});
it('testRangeSelectorWithAnimatedZoomsOption2', function() {
});
it('testRangeSelectorWithAnimatedZoomsOption2', function() {
@@
-236,6
+249,10
@@
it('testRangeSelectorWithAnimatedZoomsOption2', function() {
g.updateOptions({showRangeSelector: true});
assertGraphExistence(g, graph);
assert.isFalse(g.getOption('animatedZooms'));
g.updateOptions({showRangeSelector: true});
assertGraphExistence(g, graph);
assert.isFalse(g.getOption('animatedZooms'));
+ assert.deepEqual(logs, {
+ log: [], error: [],
+ warn: ["Animated zooms and range selector are not compatible; disabling animatedZooms."]
+ });
});
it('testRangeSelectorInteraction', function() {
});
it('testRangeSelectorInteraction', function() {
@@
-288,7
+305,7
@@
it('testRangeSelectorInteraction', function() {
zoomhandles[0].dispatchEvent(mouseUpEvent);
var newXRange = g.xAxisRange().slice();
zoomhandles[0].dispatchEvent(mouseUpEvent);
var newXRange = g.xAxisRange().slice();
- assert(
'left zoomhandle should have moved: '+newXRange[0]+'>'+xRange[0], newXRange[0] >
xRange[0]);
+ assert(
newXRange[0] > xRange[0], 'left zoomhandle should have moved: '+newXRange[0]+'>'+
xRange[0]);
assert.equal(xRange[1], newXRange[1], 'right zoomhandle should not have moved');
// Move right zoomhandle in
assert.equal(xRange[1], newXRange[1], 'right zoomhandle should not have moved');
// Move right zoomhandle in
@@
-353,8
+370,8
@@
it('testRangeSelectorInteraction', function() {
fgcanvas.dispatchEvent(mouseUpEvent);
var newXRange = g.xAxisRange().slice();
fgcanvas.dispatchEvent(mouseUpEvent);
var newXRange = g.xAxisRange().slice();
- assert(newXRange[0]
+'<'+xRange[0], newXRange[0] <
xRange[0]);
- assert(newXRange[1]
+'<'+xRange[1], newXRange[1] <
xRange[1]);
+ assert(newXRange[0]
< xRange[0], newXRange[0]+'<'+
xRange[0]);
+ assert(newXRange[1]
< xRange[1], newXRange[1]+'<'+
xRange[1]);
});
});
@@
-389,7
+406,6
@@
it('testMiniPlotDrawn', function() {
var origFunc = Dygraph.getContext;
var miniHtx;
Dygraph.getContext = function(canvas) {
var origFunc = Dygraph.getContext;
var miniHtx;
Dygraph.getContext = function(canvas) {
- console.log(canvas.className);
if (canvas.className != 'dygraph-rangesel-bgcanvas') {
return origFunc(canvas);
}
if (canvas.className != 'dygraph-rangesel-bgcanvas') {
return origFunc(canvas);
}