Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit d8fe5d7

Browse files
committed
split out hash monkeying from the navigate method for testing
1 parent dc37693 commit d8fe5d7

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

js/navigation/navigator.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,8 @@ define([ "jquery", "./events/navigate", "./path", "./history" ], function( $ ) {
4545
return state;
4646
},
4747

48-
// TODO reconsider name
49-
go: function( url, data, noEvents ) {
50-
var state, href, parsed, loc, hash, popstateEvent,
51-
isPopStateEvent = $.event.special.navigate.isPushStateEnabled(),
52-
resolutionUrl = path.isPath( url ) ? path.getLocation() : path.getDocumentUrl();
53-
54-
// Get the url as it would look squashed on to the current resolution url
55-
href = path.squash( url );
48+
hash: function( url, href ) {
49+
var parsed, loc, hash;
5650

5751
// Grab the hash for recording. If the passed url is a path
5852
// we used the parsed version of the squashed url to reconstruct,
@@ -73,6 +67,20 @@ define([ "jquery", "./events/navigate", "./path", "./history" ], function( $ ) {
7367
hash = url;
7468
}
7569

70+
return hash;
71+
},
72+
73+
// TODO reconsider name
74+
go: function( url, data, noEvents ) {
75+
var state, href, hash, popstateEvent,
76+
isPopStateEvent = $.event.special.navigate.isPushStateEnabled();
77+
78+
// Get the url as it would look squashed on to the current resolution url
79+
href = path.squash( url );
80+
81+
// sort out what the hash sould be from the url
82+
hash = this.hash( url, href );
83+
7684
// Here we prevent the next hash change or popstate event from doing any
7785
// history management. In the case of hashchange we don't swallow it
7886
// if there will be no hashchange fired (since that won't reset the value)

0 commit comments

Comments
 (0)