Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit d2b2d37

Browse files
committed
Add unit test
1 parent 48a0123 commit d2b2d37

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

test/.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@
148148
/* urlUtils.js */
149149
"urlResolve": false,
150150
"urlIsSameOrigin": false,
151+
"urlIsSameOriginAsBaseUrl": true,
151152

152153
/* karma */
153154
"dump": false,

test/ng/urlUtilsSpec.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,17 @@ describe('urlUtils', function() {
2323
});
2424
});
2525

26-
describe('isSameOrigin', function() {
26+
describe('isSameOrigin and urlIsSameOriginAsBaseUrl', function() {
2727
it('should support various combinations of urls - both string and parsed', inject(function($document) {
2828
function expectIsSameOrigin(url, expectedValue) {
2929
expect(urlIsSameOrigin(url)).toBe(expectedValue);
3030
expect(urlIsSameOrigin(urlResolve(url))).toBe(expectedValue);
31+
32+
// urlIsSameOriginAsBaseUrl() should behave the same as urlIsSameOrigin() by default.
33+
// Behavior when there is a non-default base URL or when the base URL changes dynamically
34+
// is tested in the end-to-end tests in e2e/tests/base-tag.spec.js.
35+
expect(urlIsSameOriginAsBaseUrl(url)).toBe(expectedValue);
36+
expect(urlIsSameOriginAsBaseUrl(urlResolve(url))).toBe(expectedValue);
3137
}
3238
expectIsSameOrigin('path', true);
3339
var origin = urlResolve($document[0].location.href);

0 commit comments

Comments
 (0)