projects
/
dygraphs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bump to version 2 🎉
[dygraphs.git]
/
auto_tests
/
tests
/
date_ticker.js
diff --git
a/auto_tests/tests/date_ticker.js
b/auto_tests/tests/date_ticker.js
index
665a463
..
c02331d
100644
(file)
--- a/
auto_tests/tests/date_ticker.js
+++ b/
auto_tests/tests/date_ticker.js
@@
-6,22
+6,23
@@
* @author danvdk@gmail.com (Dan Vanderkam)
*/
* @author danvdk@gmail.com (Dan Vanderkam)
*/
+import * as DygraphTickers from '../../src/dygraph-tickers';
+import DEFAULT_ATTRS from '../../src/dygraph-default-attrs';
+
describe("date-ticker-tests", function() {
describe("date-ticker-tests", function() {
-beforeEach(function() {
- document.body.innerHTML = "<div id='graph'></div>";
-});
+cleanupAfterEach();
var createOptionsViewForAxis = function(axis, dict) {
return function (x) {
if (dict && dict.hasOwnProperty(x)) {
return dict[x];
}
var createOptionsViewForAxis = function(axis, dict) {
return function (x) {
if (dict && dict.hasOwnProperty(x)) {
return dict[x];
}
- if (D
ygraph.D
EFAULT_ATTRS.axes[axis].hasOwnProperty(x)) {
- return D
ygraph.D
EFAULT_ATTRS.axes[axis][x];
+ if (DEFAULT_ATTRS.axes[axis].hasOwnProperty(x)) {
+ return DEFAULT_ATTRS.axes[axis][x];
}
}
- if (D
ygraph.D
EFAULT_ATTRS.hasOwnProperty(x)) {
- return D
ygraph.D
EFAULT_ATTRS[x];
+ if (DEFAULT_ATTRS.hasOwnProperty(x)) {
+ return DEFAULT_ATTRS[x];
}
if (x == 'axisLabelFormatter') return null;
throw "mysterious " + axis + "-axis option: " + x;
}
if (x == 'axisLabelFormatter') return null;
throw "mysterious " + axis + "-axis option: " + x;
@@
-41,7
+42,7
@@
it('testBasicDateTicker', function() {
var opts = {labelsUTC: true};
var options = createOptionsViewForAxis('x', opts);
var opts = {labelsUTC: true};
var options = createOptionsViewForAxis('x', opts);
- var ticks = Dygraph.dateTicker(-1797534000000, 1255579200000, 800, options);
+ var ticks = Dygraph
Tickers
.dateTicker(-1797534000000, 1255579200000, 800, options);
var expected_ticks = [
{"v":-1577923200000,"label":"1920"},
{"v":-1262304000000,"label":"1930"},
var expected_ticks = [
{"v":-1577923200000,"label":"1920"},
{"v":-1262304000000,"label":"1930"},
@@
-53,12
+54,12
@@
it('testBasicDateTicker', function() {
{"v": 631152000000, "label":"1990"},
{"v": 946684800000, "label":"2000"}
];
{"v": 631152000000, "label":"1990"},
{"v": 946684800000, "label":"2000"}
];
- assert.
e
qual(expected_ticks, ticks);
+ assert.
deepE
qual(expected_ticks, ticks);
var start = Date.UTC(1999, 11, 31, 14, 0, 0);
var end = Date.UTC(2000, 0, 1, 12, 0, 0);
var start = Date.UTC(1999, 11, 31, 14, 0, 0);
var end = Date.UTC(2000, 0, 1, 12, 0, 0);
- var granularity = Dygraph.TWO_HOURLY;
- ticks = Dygraph.getDateAxis(start, end, granularity, options);
+ var granularity = Dygraph
Tickers.Granularity
.TWO_HOURLY;
+ ticks = Dygraph
Tickers
.getDateAxis(start, end, granularity, options);
changeNbspToSpace(ticks);
expected_ticks = [ // months of the year are zero-based.
{v: Date.UTC(1999, 11, 31, 14, 0, 0), label: '14:00'},
changeNbspToSpace(ticks);
expected_ticks = [ // months of the year are zero-based.
{v: Date.UTC(1999, 11, 31, 14, 0, 0), label: '14:00'},
@@
-74,7
+75,7
@@
it('testBasicDateTicker', function() {
{v: Date.UTC(2000, 0, 1, 10, 0, 0), label: '10:00'},
{v: Date.UTC(2000, 0, 1, 12, 0, 0), label: '12:00'}
];
{v: Date.UTC(2000, 0, 1, 10, 0, 0), label: '10:00'},
{v: Date.UTC(2000, 0, 1, 12, 0, 0), label: '12:00'}
];
- assert.
e
qual(expected_ticks, ticks);
+ assert.
deepE
qual(expected_ticks, ticks);
});
it('testAllDateTickers', function() {
});
it('testAllDateTickers', function() {
@@
-86,7
+87,7
@@
it('testAllDateTickers', function() {
// In these tests, those spurious ticks are removed to test new behavior.
var ticker = function() {
// In these tests, those spurious ticks are removed to test new behavior.
var ticker = function() {
- var ticks = Dygraph.dateTicker.apply(null, arguments);
+ var ticks = Dygraph
Tickers
.dateTicker.apply(null, arguments);
changeNbspToSpace(ticks);
return ticks;
};
changeNbspToSpace(ticks);
return ticks;
};