Skip to content

Commit

Permalink
fix(NLP-12627): added test
Browse files Browse the repository at this point in the history
  • Loading branch information
Predrag committed Jan 12, 2024
1 parent a78c7cf commit 2aee3bf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/pipes/src/balHighlight.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,14 @@ describe('balHighlight', () => {
test('should return same text without search query', () => {
expect(balHighlight('search text', '')).toBe('search text')
})
test('should highlight only text, not the text inside href', () => {
expect(
balHighlight(
`<a href="localhost:4200/mybaloise-api/api/documents/v1/12345678-1234-4321-1234-123456789012-12345678?filename=Vertrag" target="_blank">Vertrag</a>`,
'Vertrag',
),
).toBe(
`<a href="localhost:4200/mybaloise-api/api/documents/v1/12345678-1234-4321-1234-123456789012-12345678?filename=Vertrag" target="_blank"><span class="bal-highlight">Vertrag</span></a>`,
)
})
})

0 comments on commit 2aee3bf

Please sign in to comment.