fix: Handle spaces in PTZ presets (#2084)

- Closes #2079
This commit is contained in:
Dermot Duffy
2025-06-03 20:27:40 -07:00
committed by GitHub
parent a3d062eec5
commit 13e43b8747
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ export function prettifyTitle(input?: string): string | undefined {
if (!input) {
return undefined;
}
const words = input.split(/[_\s]+/);
const words = input.trim().split(/[_\s]+/);
return words
.map((word) => {
return word[0].toUpperCase() + word.substring(1);
+6
View File
@@ -36,6 +36,12 @@ describe('prettifyTitle', () => {
it('should prettify words', () => {
expect(prettifyTitle('this is_a string')).toBe('This Is A String');
});
it('should handle leading spaces', () => {
expect(prettifyTitle(' this is_a string')).toBe('This Is A String');
});
it('should handle empty string', () => {
expect(prettifyTitle('')).toBeUndefined();
});
});
describe('arrayMove', () => {