Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fix(test.core.format) Fixes a dumb test that I wrote. (ready) #81

Merged
merged 1 commit into from

2 participants

Ed Rooth Amruta Chitnis
Ed Rooth

No description provided.

Amruta Chitnis
Owner

:+1:

Ed Rooth sym3tri merged commit df0da9e into from
Ed Rooth sym3tri deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 29, 2013
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 2 deletions.
  1. +11 −2 test/unit/core/format.spec.js
13 test/unit/core/format.spec.js
View
@@ -8,6 +8,10 @@ function(format) {
var epoch, dayAfterEpoch, domain;
+ function formatLocalDate(d) {
+ return d3.time.format('%b %-e, %I:%M %p')(d);
+ }
+
beforeEach(function() {
epoch = new Date(0);
dayAfterEpoch = new Date(24 * 60 * 60 * 1000);
@@ -29,15 +33,20 @@ function(format) {
});
describe('.timeDomain()', function() {
+ var expected;
it('formats the date', function() {
+ expected = formatLocalDate(domain[0]) + ' - ' +
+ formatLocalDate(domain[1]);
expect(format.timeDomain(domain))
- .toBe('Dec 31, 04:00 PM - Jan 1, 04:00 PM');
+ .toBe(expected);
});
it('appends the optional suffix', function() {
+ expected = formatLocalDate(domain[0]) + ' - ' +
+ formatLocalDate(domain[1]) + ' (local)';
expect(format.timeDomain(domain, '(local)'))
- .toBe('Dec 31, 04:00 PM - Jan 1, 04:00 PM (local)');
+ .toBe(expected);
});
});
Something went wrong with that request. Please try again.