spiffy-navigation
spiffy-navigation copied to clipboard
Correct isActive when default params are set
I don't really understand the logic of paramsAreEqual
.
When default parameters where set, none of my navigation was active.
The logic used in Zend/Navigation/Page/Mvc
works fine for me.
Coverage decreased (-0.13%) when pulling d2238f7c514c761c4ddf1b74b31da68ad07178bf on maxnuf:default_param into 6599c515be8ffc8042d7db91bebcc12637e9d3c1 on spiffyjr:master.
Can you rebase this with master?
I will, but it conflicts with PR #25
it feels like the tests are trying to accomplish something different then they should.
Come to think of it, my PR should solve the use case in PR #25 too.
There is no need to add ignore_params
to the navigation. Nor should you want to.
Test testIsActiveWithIgnoringParamRecursion
is in essence similar to the test I gave.
- There is a matched route with a param (could be an optional param, or could be default).
- In navigation we have a link to that route (no param provided)
- It should be active.
In that light, I think testIsActiveWithoutIgnoringParamRecursion
is faulty.
If you don't want the nav link to be active, you should provide the correct param for it.
...
'page' => array(
'pages' => array(
'child'=> array(
'options' => array(
'route' => 'test',
'id' => 20,
...
And if you do want it to match (for any id
found in the matched route), don't set the id
in navigation config.
@dready thoughts?
I saw his PR first which is why I merged it but I like this solution more.