diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index 8365803..7f7ada4 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -18,7 +18,6 @@ import { ExportButtonComponent } from "./spindle/export-button/export-button.com import { FontAwesomeModule } from "@fortawesome/angular-fontawesome"; import { TableModule } from "primeng/table"; import { AethelComponent } from "./aethel/aethel.component"; -import { HighlightPipe } from "./shared/pipes/highlight.pipe"; import { SpindleAboutComponent } from "./spindle/spindle-about/spindle-about.component"; import { SpindleNotationComponent } from "./spindle/spindle-notation/spindle-notation.component"; import { ReferencesComponent } from "./references/references.component"; @@ -39,7 +38,6 @@ import { SampleComponent } from "./sample/sample.component"; SpindleNotationComponent, ReferencesComponent, AethelComponent, - HighlightPipe, ProofPipe, SampleComponent, ], diff --git a/frontend/src/app/shared/pipes/highlight.pipe.spec.ts b/frontend/src/app/shared/pipes/highlight.pipe.spec.ts deleted file mode 100644 index 0c1393c..0000000 --- a/frontend/src/app/shared/pipes/highlight.pipe.spec.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { TestBed } from "@angular/core/testing"; -import { HighlightPipe } from "./highlight.pipe"; -import { DomSanitizer } from "@angular/platform-browser"; - -describe("HighlightPipe", () => { - let pipe: HighlightPipe; - - beforeEach(async () => { - TestBed.configureTestingModule({ - providers: [{ - provide: DomSanitizer, - useValue: { - bypassSecurityTrustHtml: (value: string) => value, - }, - - }] - }); - const sanitizer = TestBed.inject(DomSanitizer); - pipe = new HighlightPipe(sanitizer); - }); - - it("should create an instance", () => { - expect(pipe).toBeTruthy(); - }); - - it("should highlight the specified word in the input string", () => { - const inputString = "Lorem ipsum dolor sit amet"; - const wordToHighlight = "ipsum"; - const expectedOutput = "Lorem ipsum dolor sit amet"; - - const result = pipe.transform(inputString, wordToHighlight); - - expect(result).toEqual(expectedOutput); - }); - - it("should handle case-insensitive highlighting", () => { - const inputString = "Lorem ipsum dolor sit amet"; - const wordToHighlight = "LOREM"; - const expectedOutput = "Lorem ipsum dolor sit amet"; - - const result = pipe.transform(inputString, wordToHighlight); - - expect(result).toEqual(expectedOutput); - }); - - it("should handle multiple occurrences of the word to highlight", () => { - const inputString = - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ipsum ipsum ipsum."; - const wordToHighlight = "ipsum"; - const expectedOutput = - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ipsum ipsum ipsum."; - - const result = pipe.transform(inputString, wordToHighlight); - - expect(result).toEqual(expectedOutput); - }); -}); diff --git a/frontend/src/app/shared/pipes/highlight.pipe.ts b/frontend/src/app/shared/pipes/highlight.pipe.ts deleted file mode 100644 index 4f9f291..0000000 --- a/frontend/src/app/shared/pipes/highlight.pipe.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Pipe, PipeTransform } from "@angular/core"; -import { DomSanitizer, SafeHtml } from "@angular/platform-browser"; - -@Pipe({ - name: "highlight", -}) -export class HighlightPipe implements PipeTransform { - constructor(private sanitizer: DomSanitizer) {} - - transform(value: string, word: string): SafeHtml { - const regex = new RegExp(`\\b${word}\\b`, "gi"); - const highlighted = value.replace(regex, "$&"); - return this.sanitizer.bypassSecurityTrustHtml(highlighted); - } -}