mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
To increase the ease of development we are moving @angular/docs into the adev directory within this repo. While we are doing this to improve our development experience in the short term, efforts are also in place to maintain a division between this @angular/docs (shared) code and adev itself, so that it can be extracted back out in the future when components is ready to leverage it as well. PR Close #57132
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
/*!
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.dev/license
|
|
*/
|
|
|
|
import {RelativeLink} from './relative-link.pipe';
|
|
|
|
describe('RelativeLink', () => {
|
|
let pipe: RelativeLink;
|
|
|
|
beforeEach(() => {
|
|
pipe = new RelativeLink();
|
|
});
|
|
|
|
it('should transform absolute url to relative', () => {
|
|
const absoluteUrl = 'https://angular.dev/guide/directives#test';
|
|
|
|
const result = pipe.transform(absoluteUrl);
|
|
|
|
expect(result).toBe('guide/directives#test');
|
|
});
|
|
|
|
it('should return fragment once result param is equal to `hash`', () => {
|
|
const absoluteUrl = 'https://angular.dev/guide/directives#test';
|
|
|
|
const result = pipe.transform(absoluteUrl, 'hash');
|
|
|
|
expect(result).toBe('test');
|
|
});
|
|
|
|
it('should return relative url without fragment once result param is equal to `pathname`', () => {
|
|
const absoluteUrl = 'https://angular.dev/guide/directives#test';
|
|
|
|
const result = pipe.transform(absoluteUrl, 'pathname');
|
|
|
|
expect(result).toBe('guide/directives');
|
|
});
|
|
});
|