X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fdate_formats.js;h=d15567b2562b02ac34e791fdef3b14075c1829da;hb=2ef8997fe939afdfd7c2c09c393a3073897633bd;hp=27ddadbd154a12bcda3145fd09e8f4cd2de57ad2;hpb=769e8bc7b8799385e2677b26a5c0a72e839f44ca;p=dygraphs.git diff --git a/auto_tests/tests/date_formats.js b/auto_tests/tests/date_formats.js index 27ddadb..d15567b 100644 --- a/auto_tests/tests/date_formats.js +++ b/auto_tests/tests/date_formats.js @@ -3,22 +3,27 @@ * * @author dan@dygraphs.com (Dan Vanderkam) */ -var dateFormatsTestCase = TestCase("date-formats"); +describe("date-formats", function() { -dateFormatsTestCase.prototype.setUp = function() { -}; +beforeEach(function() { +}); -dateFormatsTestCase.prototype.tearDown = function() { -}; +afterEach(function() { +}); -dateFormatsTestCase.prototype.testISO8601 = function() { +it('testISO8601', function() { // Format: YYYY-MM-DDTHH:MM:SS.ddddddZ // The "Z" indicates UTC, so this test should pass regardless of the time // zone of the machine on which it is run. - assertEquals(946816496789, Dygraph.dateParser("2000-01-02T12:34:56.789012Z")); -}; -dateFormatsTestCase.prototype.testHyphenatedDate = function() { + // Firefox <4 does not support this format: + // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/parse + if (navigator.userAgent.indexOf("Firefox/3.5") == -1) { + assert.equal(946816496789, Dygraph.dateParser("2000-01-02T12:34:56.789012Z")); + } +}); + +it('testHyphenatedDate', function() { // Format: YYYY-MM-DD HH:MM // Midnight February 2, 2000, UTC @@ -31,5 +36,7 @@ dateFormatsTestCase.prototype.testHyphenatedDate = function() { zp(d.getDate()) + ' ' + zp(d.getHours()) + ':' + zp(d.getMinutes()); - assertEquals(Date.UTC(2000, 1, 2), Dygraph.dateParser(str)); -}; + assert.equal(Date.UTC(2000, 1, 2), Dygraph.dateParser(str)); +}); + +});