Skip to content

Commit

Permalink
Added tests for ConductorAxisController and TimeConductor
Browse files Browse the repository at this point in the history
  • Loading branch information
akhenry committed Oct 27, 2016
1 parent dfed0a0 commit b0901e8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ define([
$,
d3
) {
ddescribe("The ConductorAxisController", function () {
describe("The ConductorAxisController", function () {
var directive,
mockConductor,
mockConductorViewService,
Expand Down
22 changes: 17 additions & 5 deletions src/api/TimeConductorSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ define(['./TimeConductor'], function (TimeConductor) {
bounds = {start: 0, end: 1};
expect(tc.bounds()).not.toBe(bounds);
expect(tc.bounds.bind(tc, bounds)).not.toThrow();
expect(tc.bounds()).toBe(bounds);
expect(tc.bounds()).toEqual(bounds);
});

it("Disallows setting of invalid bounds", function () {
bounds = {start: 1, end: 0};
expect(tc.bounds()).not.toBe(bounds);
expect(tc.bounds()).not.toEqual(bounds);
expect(tc.bounds.bind(tc, bounds)).toThrow();
expect(tc.bounds()).not.toBe(bounds);
expect(tc.bounds()).not.toEqual(bounds);

bounds = {start: 1};
expect(tc.bounds()).not.toBe(bounds);
expect(tc.bounds()).not.toEqual(bounds);
expect(tc.bounds.bind(tc, bounds)).toThrow();
expect(tc.bounds()).not.toBe(bounds);
expect(tc.bounds()).not.toEqual(bounds);
});

it("Allows setting of time system with bounds", function () {
Expand Down Expand Up @@ -106,5 +106,17 @@ define(['./TimeConductor'], function (TimeConductor) {
tc.follow(follow);
expect(eventListener).toHaveBeenCalledWith(follow);
});

it("If bounds are set and TOI lies inside them, do not change TOI", function () {
tc.timeOfInterest(6);
tc.bounds({start: 1, end: 10});
expect(tc.timeOfInterest()).toEqual(6);
});

it("If bounds are set and TOI lies outside them, reset TOI", function () {
tc.timeOfInterest(11);
tc.bounds({start: 1, end: 10});
expect(tc.timeOfInterest()).toBeUndefined();
});
});
});

0 comments on commit b0901e8

Please sign in to comment.