-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* model update * install url-parse * add safeMumbleUrlPipe * display mumble url in game details page
- Loading branch information
1 parent
d783cdd
commit d1ed861
Showing
9 changed files
with
88 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,32 @@ | ||
import { SafeMumbleUrlPipe } from './safe-mumble-url.pipe'; | ||
import { TestBed, inject } from '@angular/core/testing'; | ||
import { BrowserModule, DomSanitizer } from '@angular/platform-browser'; | ||
|
||
class DomSanitizerStub { | ||
bypassSecurityTrustUrl(input: string) { return input; } | ||
} | ||
|
||
describe('SafeMumbleUrlPipe', () => { | ||
let pipe: SafeMumbleUrlPipe; | ||
|
||
beforeEach(() => TestBed.configureTestingModule({ | ||
imports: [ BrowserModule ], | ||
providers: [ | ||
{ provide: DomSanitizer, useClass: DomSanitizerStub }, | ||
] | ||
})); | ||
|
||
beforeEach(inject([DomSanitizer], (domSanitizer: DomSanitizer) => { | ||
pipe = new SafeMumbleUrlPipe(domSanitizer); | ||
})); | ||
|
||
it('should create', () => { | ||
expect(pipe).toBeTruthy(); | ||
}); | ||
|
||
it('should bypass security url check', () => { | ||
const spy = spyOn(TestBed.get(DomSanitizer), 'bypassSecurityTrustUrl'); | ||
pipe.transform('FAKE_URL'); | ||
expect(spy).toHaveBeenCalledWith('FAKE_URL'); | ||
}); | ||
}); |
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,17 @@ | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
import { SafeUrl, DomSanitizer } from '@angular/platform-browser'; | ||
|
||
@Pipe({ | ||
name: 'safeMumbleUrl' | ||
}) | ||
export class SafeMumbleUrlPipe implements PipeTransform { | ||
|
||
constructor( | ||
private sanitizer: DomSanitizer, | ||
) { } | ||
|
||
transform(value: string): SafeUrl { | ||
return this.sanitizer.bypassSecurityTrustUrl(value); | ||
} | ||
|
||
} |
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