X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Futils_test.js;h=5bd7f8df22564cd62be1c14ca14e5dacf69634fd;hb=575b2dcdd982fc2a79d829556fdbbb5c6f6b6b6e;hp=62b2c63c8b13ad4830fba1efab38973c54b728b0;hpb=5dfebe76ebfa5442d53f1c4a7e6fc384c439cccb;p=dygraphs.git diff --git a/auto_tests/tests/utils_test.js b/auto_tests/tests/utils_test.js index 62b2c63..5bd7f8d 100644 --- a/auto_tests/tests/utils_test.js +++ b/auto_tests/tests/utils_test.js @@ -95,7 +95,7 @@ UtilsTestCase.prototype.testIterator_nopredicate = function() { assertEquals('e', iter.next()); assertFalse(iter.hasNext); -} +}; UtilsTestCase.prototype.testIterator_predicate = function() { var array = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']; @@ -119,7 +119,7 @@ UtilsTestCase.prototype.testIterator_empty = function() { var array = []; var iter = Dygraph.createIterator([], 0, 0); assertFalse(iter.hasNext); -} +}; UtilsTestCase.prototype.testIterator_outOfRange = function() { var array = ['a', 'b', 'c']; @@ -134,7 +134,7 @@ UtilsTestCase.prototype.testIterator_outOfRange = function() { assertEquals('c', iter.next()); assertFalse(iter.hasNext); -} +}; // Makes sure full array is tested, and that the predicate isn't called // with invalid boundaries. @@ -156,7 +156,7 @@ UtilsTestCase.prototype.testIterator_whole_array = function() { assertEquals('c', iter.next()); assertFalse(iter.hasNext); assertNull(iter.next()); -} +}; UtilsTestCase.prototype.testIterator_no_args = function() { var array = ['a', 'b', 'c']; @@ -169,4 +169,32 @@ UtilsTestCase.prototype.testIterator_no_args = function() { assertEquals('c', iter.next()); assertFalse(iter.hasNext); assertNull(iter.next()); -} +}; + +UtilsTestCase.prototype.testToRGB = function() { + assertEquals({r: 255, g: 200, b: 150}, Dygraph.toRGB_('rgb(255,200,150)')); + assertEquals({r: 255, g: 200, b: 150}, Dygraph.toRGB_('#FFC896')); + assertEquals({r: 255, g: 0, b: 0}, Dygraph.toRGB_('red')); +}; + +UtilsTestCase.prototype.testIsPixelChangingOptionList = function() { + var isPx = Dygraph.isPixelChangingOptionList; + assertTrue(isPx([], { axes: { y: { digitsAfterDecimal: 3 }}})); + assertFalse(isPx([], { axes: { y: { axisLineColor: 'blue' }}})); +}; + +/* +UtilsTestCase.prototype.testDateSet = function() { + var base = new Date(1383455100000); + var d = new Date(base); + + // A one hour shift -- this is surprising behavior! + d.setMilliseconds(10); + assertEquals(3600010, d.getTime() - base.getTime()); + + // setDateSameTZ compensates for this surprise. + d = new Date(base); + Dygraph.setDateSameTZ(d, {ms: 10}); + assertEquals(10, d.getTime() - base.getTime()); +}; +*/