mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
feat(core): add vimeo media host and html/react components (#1667)
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
export function escapeHtml(str: string): string {
|
||||
return str
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''')
|
||||
.replace(/`/g, '`');
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from './casing';
|
||||
export * from './escape-html';
|
||||
export * from './generate-id';
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { escapeHtml } from '../escape-html';
|
||||
|
||||
describe('escapeHtml', () => {
|
||||
it('escapes HTML special characters', () => {
|
||||
expect(escapeHtml('&<>"\'`')).toBe('&<>"'`');
|
||||
});
|
||||
|
||||
it('preserves strings without HTML special characters', () => {
|
||||
expect(escapeHtml('https://player.vimeo.com/video/123?autoplay=1')).toBe(
|
||||
'https://player.vimeo.com/video/123?autoplay=1'
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user