-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from ScottLogic/sfd-173-external-links
SFD-173 External links replace the Estimator view
- Loading branch information
Showing
10 changed files
with
87 additions
and
22 deletions.
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
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
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
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,19 @@ | ||
import { ElementRef } from '@angular/core'; | ||
import { ExternalLinkDirective } from './external-link.directive'; | ||
|
||
describe('ExternalLinkDirective', () => { | ||
let element: ElementRef; | ||
|
||
beforeEach(() => { | ||
element = { | ||
nativeElement: jasmine.createSpyObj('nativeElement', ['setAttribute']), | ||
}; | ||
}); | ||
|
||
it('should set required attributes on element', () => { | ||
const directive = new ExternalLinkDirective(element); | ||
expect(directive).toBeTruthy(); | ||
expect(element.nativeElement.setAttribute).toHaveBeenCalledWith('target', '_blank'); | ||
expect(element.nativeElement.setAttribute).toHaveBeenCalledWith('rel', 'noreferrer'); | ||
}); | ||
}); |
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,12 @@ | ||
import { Directive, ElementRef } from '@angular/core'; | ||
|
||
@Directive({ | ||
selector: '[tce-external-link]', | ||
standalone: true, | ||
}) | ||
export class ExternalLinkDirective { | ||
constructor(private element: ElementRef) { | ||
this.element.nativeElement.setAttribute('target', '_blank'); | ||
this.element.nativeElement.setAttribute('rel', 'noreferrer'); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { Component } from '@angular/core'; | ||
import { ExpansionPanelComponent } from '../expansion-panel/expansion-panel.component'; | ||
import { ExternalLinkDirective } from '../directives/external-link.directive'; | ||
|
||
@Component({ | ||
selector: 'disclaimer', | ||
standalone: true, | ||
imports: [ExpansionPanelComponent], | ||
imports: [ExpansionPanelComponent, ExternalLinkDirective], | ||
templateUrl: './disclaimer.component.html', | ||
}) | ||
export class DisclaimerComponent {} |