Skip to content

Commit

Permalink
test(): add test for generating urls with default params
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherthielen committed Jul 18, 2015
1 parent 4b978ac commit 17e7757
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/stateSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('state', function () {
RSP = { url: '^/:doReload/search?term', reloadOnSearch: false },
OPT = { url: '/opt/:param', params: { param: "100" } },
OPT2 = { url: '/opt2/:param2/:param3', params: { param3: "300", param4: "400" } },
ISS2101 = { params: { bar: { squash: false, value: 'qux'}}, url: '/2101/{bar:string}' };
AppInjectable = {};

beforeEach(module(function ($stateProvider, $provide) {
Expand All @@ -55,6 +56,7 @@ describe('state', function () {
.state('HHH', HHH)
.state('OPT', OPT)
.state('OPT.OPT2', OPT2)
.state('ISS2101', ISS2101)
.state('RS', RS)
.state('RSP', RSP)

Expand Down Expand Up @@ -931,6 +933,10 @@ describe('state', function () {
expect($state.href("home")).toEqual("#!/");
}));

it('generates urls with unsquashable default params', inject(function($state) {
expect($state.href("ISS2101")).toEqual("#/2101/qux");
}));

describe('when $browser.baseHref() exists', function() {
beforeEach(inject(function($browser) {
spyOn($browser, 'baseHref').andCallFake(function() {
Expand Down Expand Up @@ -977,6 +983,7 @@ describe('state', function () {
'H',
'HH',
'HHH',
'ISS2101',
'OPT',
'OPT.OPT2',
'RS',
Expand Down

0 comments on commit 17e7757

Please sign in to comment.