aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/locationSpec.js
diff options
context:
space:
mode:
authorMisko Hevery2012-06-11 21:24:23 -0700
committerIgor Minar2012-06-12 00:27:25 -0700
commit74fa65ecb7c4e2df966a179952b35700912e065f (patch)
treec949e6859c60c86bb4d215fec6a6a1390cbdaa2b /test/ng/locationSpec.js
parentee6014a3aa90232ed263fe9c9e0860c777b37a30 (diff)
downloadangular.js-74fa65ecb7c4e2df966a179952b35700912e065f.tar.bz2
fix($location): correctly parse link urls in hashbang mode
This is a fix for a regression that was introduced by 92a2e180 Closes #1037
Diffstat (limited to 'test/ng/locationSpec.js')
-rw-r--r--test/ng/locationSpec.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/ng/locationSpec.js b/test/ng/locationSpec.js
index e6ee6604..543232c3 100644
--- a/test/ng/locationSpec.js
+++ b/test/ng/locationSpec.js
@@ -968,6 +968,37 @@ describe('$location', function() {
);
});
}
+
+
+ it('should not mess up hash urls when clicking on links in hashbang mode', function() {
+ var base;
+ module(function() {
+ return function($browser) {
+ window.location.hash = 'someHash';
+ base = window.location.href
+ $browser.url(base);
+ base = base.split('#')[0];
+ }
+ });
+ inject(function($rootScope, $compile, $browser, $rootElement, $document, $location) {
+ // we need to do this otherwise we can't simulate events
+ $document.find('body').append($rootElement);
+
+ var element = $compile('<a href="#/view1">v1</a><a href="#/view2">v2</a>')($rootScope);
+ $rootElement.append(element);
+ var av1 = $rootElement.find('a').eq(0);
+ var av2 = $rootElement.find('a').eq(1);
+
+
+ browserTrigger(av1, 'click');
+ expect($browser.url()).toEqual(base + '#/view1');
+
+ browserTrigger(av2, 'click');
+ expect($browser.url()).toEqual(base + '#/view2');
+
+ $rootElement.remove();
+ });
+ });
});