File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
ember-routing/lib/location Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -52,10 +52,16 @@ Ember.HistoryLocation = Ember.Object.extend({
5252 */
5353 getURL : function ( ) {
5454 var rootURL = get ( this , 'rootURL' ) ,
55- url = get ( this , 'location' ) . pathname ;
55+ location = get ( this , 'location' ) ,
56+ path = location . pathname ;
5657
5758 rootURL = rootURL . replace ( / \/ $ / , '' ) ;
58- url = url . replace ( rootURL , '' ) ;
59+ var url = path . replace ( rootURL , '' ) ;
60+
61+ if ( Ember . FEATURES . isEnabled ( "query-params" ) ) {
62+ var search = location . search || '' ;
63+ url += search ;
64+ }
5965
6066 return url ;
6167 } ,
Original file line number Diff line number Diff line change @@ -446,4 +446,21 @@ if (Ember.FEATURES.isEnabled("query-params")) {
446446
447447 equal ( editCount , 2 , 'set up the edit route twice without failure' ) ;
448448 } ) ;
449+
450+ test ( "History location can handle queryparams" , function ( ) {
451+ var location = {
452+ pathname : "/foo" ,
453+ search : "?bar=baz"
454+ } ;
455+
456+ var history = {
457+ pushState : Ember . K ,
458+ replaceState : Ember . K
459+ } ;
460+
461+ var historyLocation = Ember . HistoryLocation . create ( { location : location , history : history } ) ;
462+
463+ equal ( historyLocation . getURL ( ) , "/foo?bar=baz" , "The query params are present" ) ;
464+ } ) ;
465+
449466}
You can’t perform that action at this time.
0 commit comments