Comments (5)
@geekdave I created some tests to show what I mean (I've never used jasmine before, so apologies if they're not well written). I created them on a fork at https://github.com/joshuaballoch/backbone.subroute/blob/polluted-routes/spec/js/route-pollution-specs.js
I ran the tests; if you comment out the second test at https://github.com/joshuaballoch/backbone.subroute/blob/polluted-routes/spec/js/route-pollution-specs.js#L14 and just run https://github.com/joshuaballoch/backbone.subroute/blob/polluted-routes/spec/js/route-pollution-specs.js#L9, then you see the routes being initialized as expected.
Subsequently, if you run https://github.com/joshuaballoch/backbone.subroute/blob/polluted-routes/spec/js/route-pollution-specs.js#L14, you will perhaps see in more detail what I mean.
from backbone.subroute.
Looks like this may be a regression caused by #22 caused by #16. I am looking into it.
In the meantime, to unblock yourself, you can use v0.3.2 which does not have this issue:
https://github.com/ModelN/backbone.subroute/blob/0.3.2/backbone.subroute.js
Note that in your test spec:
var subRouter = Backbone.SubRoute.extend( {
routes: {
"":"handDefaultRoute"
}
} );
it ( 'should have normal subroutes if just one subroute is initialized', function () {
SubRouterOne = new subRouter("subrouterone");
expect(SubRouterOne.routes).toEqual( { '' : 'handDefaultRoute', subrouterone : 'handDefaultRoute' } );
} );
The it
block should not expect { '' : 'handDefaultRoute', subrouterone : 'handDefaultRoute' }
but rather { "subrouterone" : 'handDefaultRoute' }
This is because the default empty string route should get the prefix prepended to it.
from backbone.subroute.
Specifically, this seems to be caused by some change in PR #23 PR #16.
EDIT: Mistakenly attributed the regression to the wrong change. Appears to be due to the switch to using dynamic runtime processing of prefixed routes, instead of constructing the routes only at initialization time.
from backbone.subroute.
Fixed. Big thanks to @mikesnare for suggesting the fix, and for @joshuaballoch for providing the specs to identify the issue (merged in PR #28)
from backbone.subroute.
Released version 0.4.1 with this fix (https://github.com/ModelN/backbone.subroute/releases/tag/0.4.1)
from backbone.subroute.
Related Issues (20)
- Routes with named params HOT 6
- How can I restart subroutes? HOT 2
- Suggestion: returning Backbone.navigate or at least returning "this" HOT 3
- Problem with Backbone AMD HOT 3
- Minified version produces wrong route HOT 1
- Filter support HOT 5
- Publish latest version to npm HOT 1
- Backbone and underscore should be dependencies (not devDependencies) HOT 1
- Route gets triggered twice HOT 3
- accessing router initialize parameters from the route callback? HOT 3
- using back button does not re-trigger all my routes
- loadUrl into uninitialized subroute fails HOT 3
- Seeking New Ownership! HOT 6
- Specify createTrailingSlashRoutes as an instance property when extending from Backbone.Subroute
- handling zombie views in the subroute
- Update bower info
- npm support
- Regex routes
- Multiple SubRoutes - is it possible?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from backbone.subroute.