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

Commit 2872d5d

Browse files
committed
Add unit test
1 parent df5fdb9 commit 2872d5d

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
@@ -145,6 +145,7 @@
145145
/* urlUtils.js */
146146
"urlResolve": false,
147147
"urlIsSameOrigin": false,
148+
"urlIsSameOriginAsBaseUrl": true,
148149

149150
/* karma */
150151
"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)