aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ng/locationSpec.js64
1 files changed, 63 insertions, 1 deletions
diff --git a/test/ng/locationSpec.js b/test/ng/locationSpec.js
index 3588150d..cf7ceaf4 100644
--- a/test/ng/locationSpec.js
+++ b/test/ng/locationSpec.js
@@ -826,7 +826,15 @@ describe('$location', function() {
initLocation(),
function($browser) {
browserTrigger(link, 'click');
- expectNoRewrite($browser, 'http://host.com/base/');
+ expectRewriteTo($browser, 'http://host.com/base/');
+
+ jqLite(link).attr('href', 'http://host.com/base/foo');
+ browserTrigger(link, 'click');
+ expectRewriteTo($browser, 'http://host.com/base/foo');
+
+ jqLite(link).attr('href', 'http://host.com/base/');
+ browserTrigger(link, 'click');
+ expectRewriteTo($browser, 'http://host.com/base/');
}
);
});
@@ -1332,4 +1340,58 @@ describe('$location', function() {
});
});
});
+
+ describe('LocationHtml5Url', function() {
+ var location, locationIndex;
+
+ beforeEach(function() {
+ location = new LocationHtml5Url('http://server/pre/', 'http://server/pre/path');
+ locationIndex = new LocationHtml5Url('http://server/pre/index.html', 'http://server/pre/path');
+ });
+
+ it('should rewrite URL', function() {
+ expect(location.$$rewrite('http://other')).toEqual(undefined);
+ expect(location.$$rewrite('http://server/pre')).toEqual('http://server/pre/');
+ expect(location.$$rewrite('http://server/pre/')).toEqual('http://server/pre/');
+ expect(location.$$rewrite('http://server/pre/otherPath')).toEqual('http://server/pre/otherPath');
+ expect(locationIndex.$$rewrite('http://server/pre')).toEqual('http://server/pre/');
+ expect(locationIndex.$$rewrite('http://server/pre/')).toEqual('http://server/pre/');
+ expect(locationIndex.$$rewrite('http://server/pre/otherPath')).toEqual('http://server/pre/otherPath');
+ });
+ });
+
+
+ describe('LocationHashbangUrl', function() {
+ var location;
+
+ beforeEach(function() {
+ location = new LocationHashbangUrl('http://server/pre/', 'http://server/pre/#/path');
+ });
+
+ it('should rewrite URL', function() {
+ expect(location.$$rewrite('http://other')).toEqual(undefined);
+ expect(location.$$rewrite('http://server/pre/')).toEqual('http://server/pre/');
+ expect(location.$$rewrite('http://server/pre/#otherPath')).toEqual('http://server/pre/#otherPath');
+ });
+ });
+
+
+ describe('LocationHashbangInHtml5Url', function() {
+ var location, locationIndex;
+
+ beforeEach(function() {
+ location = new LocationHashbangInHtml5Url('http://server/pre/', '#!');
+ locationIndex = new LocationHashbangInHtml5Url('http://server/pre/index.html', '#!');
+ });
+
+ it('should rewrite URL', function() {
+ expect(location.$$rewrite('http://other')).toEqual(undefined);
+ expect(location.$$rewrite('http://server/pre')).toEqual('http://server/pre/');
+ expect(location.$$rewrite('http://server/pre/')).toEqual('http://server/pre/');
+ expect(location.$$rewrite('http://server/pre/otherPath')).toEqual('http://server/pre/#!otherPath');
+ expect(locationIndex.$$rewrite('http://server/pre')).toEqual('http://server/pre/');
+ expect(locationIndex.$$rewrite('http://server/pre/')).toEqual(undefined);
+ expect(locationIndex.$$rewrite('http://server/pre/otherPath')).toEqual('http://server/pre/index.html#!otherPath');
+ });
+ });
});