Browse files

update README

  • Loading branch information...
1 parent 894c4ed commit 4121dae0109eea691e83800f22a567e3ce8a42b5 @rtsinani rtsinani committed Apr 10, 2012
Showing with 13 additions and 4 deletions.
  1. +13 −3 README.md
  2. +0 −1 test/router.js
View
16 README.md
@@ -14,12 +14,22 @@ Let's say, you navigate to a URL fragment `/products/search?names=apple&names=ne
```js
// URL fragment: /products/search?names=apple&names=nectarine&page=1
-path = Backbone.history.path // path : 'products/search'
-names = Backbone.history.params['names'] // names : ['apple', 'nectarine']
-page = Backbone.history.params['page'] // page : '1'
+Backbone.history.path // 'products/search'
+Backbone.history.params['names'] // ['apple', 'nectarine']
+Backbone.history.params['page'] // '1'
```
+#### Navigate With
+
+You can also use `Backbone.history.navigateWith` to go to a path with a query string.
+
+```js
+Backbone.history.navigateWith('/products/search', { names: ['apple', 'nectarine'], page: 1 }, {trigger: true});
+Backbone.history.fragment // 'products/search?names=apple&names=nectarine&page=1');
+```
+
+
### Tests
Colonne passes all Backbone tests for the router, copied at `test/router.js`. The new functionality is tested at the end of the same file.
View
1 test/router.js
@@ -319,7 +319,6 @@ $(document).ready(function () {
})
test("Navigate correctly with navigateWith", function () {
- var route = '/products?name=apple&page=1';
Backbone.history.navigateWith('/products/search', { names: ['apple', 'nectarine'], page: 1 }, {trigger: true});
equal(Backbone.history.fragment, 'products/search?names=apple&names=nectarine&page=1');
window.location.hash = '';

0 comments on commit 4121dae

Please sign in to comment.