-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(router): add support for relative paths (#14)
- Loading branch information
Showing
3 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { UrlParser } from 'angular-routing'; | ||
|
||
describe('UrlParser', () => { | ||
let parser: UrlParser; | ||
|
||
beforeEach(() => { | ||
parser = new UrlParser(); | ||
}); | ||
|
||
describe('joinUrls', () => { | ||
it('should join two urls', () => { | ||
expect(parser.joinUrls('path1/path2', 'path3/path4')) | ||
.toEqual('path1/path2/path3/path4'); | ||
}); | ||
it('should strip off original query params', () => { | ||
expect(parser.joinUrls('path1/path2?param1=value1', 'path3/path4')) | ||
.toEqual('path1/path2/path3/path4'); | ||
}); | ||
it('should leave query params on target url', () => { | ||
expect(parser.joinUrls('path1/path2', 'path3/path4?param1=value1')) | ||
.toEqual('path1/path2/path3/path4?param1=value1'); | ||
}); | ||
it('should ignore cwd on segment', () => { | ||
expect(parser.joinUrls('path1/path2', './path3/path4?param1=value1')) | ||
.toEqual('path1/path2/path3/path4?param1=value1'); | ||
}); | ||
it('should apply ".." to go back through segments', () => { | ||
expect(parser.joinUrls('path1/path2', '../../path3/path4?param1=value1')) | ||
.toEqual('path3/path4?param1=value1'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters