Skip to content

Commit

Permalink
Failing test for makePath with route params
Browse files Browse the repository at this point in the history
Reported by @daytonlowell
  • Loading branch information
TehShrike committed Apr 22, 2016
1 parent 1dba3bc commit 9739c39
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/make-path.js
Expand Up @@ -78,3 +78,38 @@ test('makePath respects the inherit option', function(t) {
originalParameter: 'original value'
})
})

test('makePath inheriting parameters from the route', function(t) {
var stateRouter = getTestState(t, null, {
pathPrefix: ''
}).stateRouter

stateRouter.addState({
name: 'parent',
template: '',
route: '/parent/:someParam/yarp'
})

stateRouter.addState({
name: 'parent.child1',
template: '',
route: '/child1',
activate: function(context) {
t.equal(context.parameters.someParam, 'totally')

var path = stateRouter.makePath('parent.child1', {}, {
inherit: true
})

t.equal(path, '/parent/totally/yarp/child2', 'Output path contains the route parameter')
t.end()
}
})
stateRouter.addState({
name: 'parent.child2',
template: '',
route: '/child2'
})

stateRouter.go('parent.child1', { someParam: 'totally' })
})

0 comments on commit 9739c39

Please sign in to comment.