Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion specs/URLStore.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,53 @@ describe('when a new path is pushed to the URL', function () {
URLStore.push('/a/b/c');
});

afterEach(function () {
URLStore.teardown();
});

it('has the correct path', function () {
expect(URLStore.getCurrentPath()).toEqual('/a/b/c');
});
});

describe('when a new path is used to replace the URL', function () {
beforeEach(function () {
URLStore.push('/a/b/c');
URLStore.replace('/a/b/c');
});

afterEach(function () {
URLStore.teardown();
});

it('has the correct path', function () {
expect(URLStore.getCurrentPath()).toEqual('/a/b/c');
});
});

describe('when going back in history', function () {
afterEach(function () {
URLStore.teardown();
});

it('has the correct path', function () {
URLStore.push('/a/b/c');
expect(URLStore.getCurrentPath()).toEqual('/a/b/c');

URLStore.push('/d/e/f');
expect(URLStore.getCurrentPath()).toEqual('/d/e/f');

URLStore.back();
expect(URLStore.getCurrentPath()).toEqual('/a/b/c');
});

it('should not go back before recorded history', function () {
var error = false;
try {
URLStore.back();
} catch (e) {
error = true;
}

expect(error).toEqual(true);
});
});