-
-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(formatters): add a fake hyperlink formatter (#630)
- Takes any text value and display it as a fake a hyperlink (only styled as an hyperlink)
- Loading branch information
1 parent
0ee3421
commit 694f0ea
Showing
3 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
src/app/modules/angular-slickgrid/formatters/__tests__/fakeHyperlinkFormatter.spec.ts
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,15 @@ | ||
import { fakeHyperlinkFormatter } from '../fakeHyperlinkFormatter'; | ||
|
||
describe('the Edit Icon Formatter', () => { | ||
it('should return a span with the "fake-hyperlink" class when a value is provided', () => { | ||
const value = 'Custom Value'; | ||
const result = fakeHyperlinkFormatter(0, 0, value); | ||
expect(result).toBe('<span class="fake-hyperlink">Custom Value</span>'); | ||
}); | ||
|
||
it('should return an empty string formatter when no value is provided', () => { | ||
const value = null; | ||
const result = fakeHyperlinkFormatter(0, 0, value); | ||
expect(result).toBe(''); | ||
}); | ||
}); |
5 changes: 5 additions & 0 deletions
5
src/app/modules/angular-slickgrid/formatters/fakeHyperlinkFormatter.ts
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,5 @@ | ||
import { Formatter } from '../models/formatter.interface'; | ||
|
||
export const fakeHyperlinkFormatter: Formatter = (_row: number, _cell: number, value: string) => { | ||
return value ? `<span class="fake-hyperlink">${value}</span>` : ''; | ||
}; |
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