Sha256: 44955082ea5fa5a2a3fea1c01b01d1589eb7a3995ef7a4d5b14d74d8b8738b27

Contents?: true

Size: 1.2 KB

Versions: 31

Compression:

Stored size: 1.2 KB

Contents

require("../env");
require("../../d3");
require("../../d3.time");

var vows = require("vows"),
    assert = require("assert");

var suite = vows.describe("d3.time.year");

suite.addBatch({
  "year": {
    topic: function() {
      return d3.time.year;
    },
    "returns years": function(floor) {
      assert.deepEqual(floor(local(2010, 11, 31, 23, 59, 59)), local(2010, 0, 1));
      assert.deepEqual(floor(local(2011, 0, 1, 0, 0, 0)), local(2011, 0, 1));
      assert.deepEqual(floor(local(2011, 0, 1, 0, 0, 1)), local(2011, 0, 1));
    },
    "UTC": {
      topic: function(floor) {
        return floor.utc;
      },
      "returns years": function(floor) {
        assert.deepEqual(floor(utc(2010, 11, 31, 23, 59, 59)), utc(2010, 0, 1));
        assert.deepEqual(floor(utc(2011, 0, 1, 0, 0, 0)), utc(2011, 0, 1));
        assert.deepEqual(floor(utc(2011, 0, 1, 0, 0, 1)), utc(2011, 0, 1));
      }
    }
  }
});

function local(year, month, day, hours, minutes, seconds) {
  return new Date(year, month, day, hours || 0, minutes || 0, seconds || 0);
}

function utc(year, month, day, hours, minutes, seconds) {
  return new Date(Date.UTC(year, month, day, hours || 0, minutes || 0, seconds || 0));
}

suite.export(module);

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
picky-statistics-4.5.0 lib/picky-statistics/application/javascripts/d3/test/time/year-test.js
picky-statistics-4.4.2 lib/picky-statistics/application/javascripts/d3/test/time/year-test.js
picky-statistics-4.4.1 lib/picky-statistics/application/javascripts/d3/test/time/year-test.js
picky-statistics-4.4.0 lib/picky-statistics/application/javascripts/d3/test/time/year-test.js
picky-statistics-4.3.2 lib/picky-statistics/application/javascripts/d3/test/time/year-test.js
picky-statistics-4.3.1 lib/picky-statistics/application/javascripts/d3/test/time/year-test.js
picky-statistics-4.3.0 lib/picky-statistics/application/javascripts/d3/test/time/year-test.js
picky-statistics-4.2.4 lib/picky-statistics/application/javascripts/d3/test/time/year-test.js
picky-statistics-4.2.3 lib/picky-statistics/application/javascripts/d3/test/time/year-test.js
picky-statistics-4.2.2 lib/picky-statistics/application/javascripts/d3/test/time/year-test.js
picky-statistics-4.2.1 lib/picky-statistics/application/javascripts/d3/test/time/year-test.js
picky-statistics-4.2.0 lib/picky-statistics/application/javascripts/d3/test/time/year-test.js
picky-statistics-4.1.0 lib/picky-statistics/application/javascripts/d3/test/time/year-test.js
picky-statistics-4.0.9 lib/picky-statistics/application/javascripts/d3/test/time/year-test.js
picky-statistics-4.0.8 lib/picky-statistics/application/javascripts/d3/test/time/year-test.js
picky-statistics-4.0.7 lib/picky-statistics/application/javascripts/d3/test/time/year-test.js
picky-statistics-4.0.6 lib/picky-statistics/application/javascripts/d3/test/time/year-test.js
picky-statistics-4.0.5 lib/picky-statistics/application/javascripts/d3/test/time/year-test.js
picky-statistics-4.0.4 lib/picky-statistics/application/javascripts/d3/test/time/year-test.js
picky-statistics-4.0.3 lib/picky-statistics/application/javascripts/d3/test/time/year-test.js