Skip to content

Commit

Permalink
[changed] TestLocation is a constructor
Browse files Browse the repository at this point in the history
TestLocation is no longer a singleton. Instead, it's a constructor.
This has the side effect that when a new TestLocation is created it
automatically updates History.length. In practice this shouldn't be
a problem any more than the singleton implementation was, since it
still permits you to run only one test at a time.
  • Loading branch information
mjackson committed Feb 13, 2015
1 parent 166b9a2 commit 7d52d55
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 159 deletions.
7 changes: 4 additions & 3 deletions modules/__tests__/History-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ describe('History', function () {
});

describe('after navigating to a route', function () {
var location;
beforeEach(function () {
TestLocation.history = [ '/foo' ];
location = new TestLocation([ '/foo' ]);
});

it('has length 2', function (done) {
Expand All @@ -26,7 +27,7 @@ describe('History', function () {

var count = 0;

var router = Router.run(routes, TestLocation, function (Handler) {
var router = Router.run(routes, location, function (Handler) {
count += 1;

if (count === 2) {
Expand All @@ -47,7 +48,7 @@ describe('History', function () {

var count = 0;

var router = Router.run(routes, TestLocation, function (Handler) {
var router = Router.run(routes, location, function (Handler) {
count += 1;

if (count === 2) {
Expand Down
Loading

0 comments on commit 7d52d55

Please sign in to comment.