Skip to content

Commit

Permalink
Fix Prism declaration for server-side rendering (part II) (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfcere authored Mar 14, 2018
1 parent 597550d commit 210e8bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/app/markdown/markdown.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,14 @@ describe('MarkdowService', () => {

it('should not call Prism when not available', () => {

Prism = undefined;
global['Prism'] = undefined;

markdownService.highlight();
});

it('should call Prism when available', () => {

Prism = { highlightAll: () => {} };
global['Prism'] = { highlightAll: () => {} };

spyOn(Prism, 'highlightAll');

Expand Down
5 changes: 2 additions & 3 deletions src/app/markdown/markdown.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ export class MarkdownService {
}

highlight() {
if (!Prism) {
return;
if (typeof Prism !== 'undefined') {
Prism.highlightAll(false);
}
Prism.highlightAll(false);
}

private extractData(response: Response) {
Expand Down

0 comments on commit 210e8bd

Please sign in to comment.