Skip to content

Commit 17e7757

Browse files
test(): add test for generating urls with default params
1 parent 4b978ac commit 17e7757

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/stateSpec.js

+7
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ describe('state', function () {
3232
RSP = { url: '^/:doReload/search?term', reloadOnSearch: false },
3333
OPT = { url: '/opt/:param', params: { param: "100" } },
3434
OPT2 = { url: '/opt2/:param2/:param3', params: { param3: "300", param4: "400" } },
35+
ISS2101 = { params: { bar: { squash: false, value: 'qux'}}, url: '/2101/{bar:string}' };
3536
AppInjectable = {};
3637

3738
beforeEach(module(function ($stateProvider, $provide) {
@@ -55,6 +56,7 @@ describe('state', function () {
5556
.state('HHH', HHH)
5657
.state('OPT', OPT)
5758
.state('OPT.OPT2', OPT2)
59+
.state('ISS2101', ISS2101)
5860
.state('RS', RS)
5961
.state('RSP', RSP)
6062

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

936+
it('generates urls with unsquashable default params', inject(function($state) {
937+
expect($state.href("ISS2101")).toEqual("#/2101/qux");
938+
}));
939+
934940
describe('when $browser.baseHref() exists', function() {
935941
beforeEach(inject(function($browser) {
936942
spyOn($browser, 'baseHref').andCallFake(function() {
@@ -977,6 +983,7 @@ describe('state', function () {
977983
'H',
978984
'HH',
979985
'HHH',
986+
'ISS2101',
980987
'OPT',
981988
'OPT.OPT2',
982989
'RS',

0 commit comments

Comments
 (0)