Skip to content

Commit

Permalink
fix(project): integration of the library
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyNahas committed Nov 25, 2019
1 parent 09c9543 commit 6524c3e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion ngx-linkifyjs
Submodule ngx-linkifyjs updated from 860d1d to e7ca35
6 changes: 0 additions & 6 deletions src/module/ngx-linkifyjs.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@ import mention from 'linkifyjs/plugins/mention';
import {NgxLinkifyjsService} from './service/ngx-linkifyjs.service';
import {NgxLinkifyjsPipe} from './pipes/ngx-linkifyjs.pipe';

// Export module's public API
export {Link} from './interfaces/ngx-linkifyjs.interface';
import {NgxLinkifyjsConfig} from './interfaces/ngx-linkifyjs.interface';

export {LinkType} from './enum/linktype.enum';
export {NgxLinkifyOptions} from './interfaces/ngx-linkifyjs.interface';
export {NgxLinkifyjsPipe} from './pipes/ngx-linkifyjs.pipe';
export {NgxLinkifyjsService} from './service/ngx-linkifyjs.service';

export const NgxLinkifyjsConfigToken = new InjectionToken<NgxLinkifyjsConfig>('NgxLinkifyjsConfig');
export const DEFAULT_CONFIG: NgxLinkifyjsConfig = {enableHash: true, enableMention: true};
Expand Down
4 changes: 2 additions & 2 deletions src/module/pipes/ngx-linkifyjs.pipe.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {Pipe, PipeTransform} from '@angular/core';

// @ts-ignore
import linkifyStr from 'linkifyjs/string';
import {NgxLinkifyOptions} from '../..';
import {NgxLinkifyOptions} from '../interfaces/ngx-linkifyjs.interface';


@Pipe({
name: 'linkify'
Expand Down
16 changes: 9 additions & 7 deletions src/module/service/ngx-linkifyjs.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import * as hashtag from 'linkifyjs/plugins/hashtag';
import * as mention from 'linkifyjs/plugins/mention';

import {NgxLinkifyjsService} from './ngx-linkifyjs.service';
import {Link, LinkType} from '../..';
import {Link} from '../interfaces/ngx-linkifyjs.interface';
import {LinkType} from '../enum/linktype.enum';

describe('NgxLinkifyjsService without importing hashtag/mention', () => {
beforeEach(() => {
Expand Down Expand Up @@ -67,14 +68,15 @@ describe('NgxLinkifyjsService', () => {
}));

// linkify function
it('should linkify the provided text with providing an empty object option', inject([NgxLinkifyjsService], (service: NgxLinkifyjsService) => {
const result: string = service.linkify('For help with GitHub.com, please email support@github.com', null);
it('should linkify the provided text with providing an empty object option',
inject([NgxLinkifyjsService], (service: NgxLinkifyjsService) => {
const result: string = service.linkify('For help with GitHub.com, please email support@github.com', null);

const expectedResult = 'For help with <a href=\"http://github.com\" class=\"linkified\" target=\"_blank\">GitHub.com</a>, ' +
'please email <a href=\"mailto:support@github.com\" class=\"linkified\">support@github.com</a>';
const expectedResult = 'For help with <a href=\"http://github.com\" class=\"linkified\" target=\"_blank\">GitHub.com</a>, ' +
'please email <a href=\"mailto:support@github.com\" class=\"linkified\">support@github.com</a>';

expect(result).toEqual(expectedResult);
}));
expect(result).toEqual(expectedResult);
}));

// linkify function
it('should the target attribute not equal to _blank', inject([NgxLinkifyjsService], (service: NgxLinkifyjsService) => {
Expand Down
3 changes: 1 addition & 2 deletions src/module/service/ngx-linkifyjs.service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import {Injectable} from '@angular/core';
// @ts-ignore
import * as linkify from 'linkifyjs';
import {Link} from '../..';
import {NgxLinkifyOptions} from '../interfaces/ngx-linkifyjs.interface';
import {Link, NgxLinkifyOptions} from '../interfaces/ngx-linkifyjs.interface';

@Injectable()
export class NgxLinkifyjsService {
Expand Down

0 comments on commit 6524c3e

Please sign in to comment.