diff --git a/packages/core/src/state.test.ts b/packages/core/src/state.test.ts index 26a304c3..e2183d9f 100644 --- a/packages/core/src/state.test.ts +++ b/packages/core/src/state.test.ts @@ -24,6 +24,11 @@ describe('state', () => { filePath: 'a&b~c-d_e.svg', componentName: 'SvgAbcDE', }) + expect(expandState({ filePath: 'Arrow up.svg' })).toEqual({ + filePath: 'Arrow up.svg', + componentName: 'SvgArrowUp', + }) + }) }) }) diff --git a/packages/core/src/state.ts b/packages/core/src/state.ts index 20e4f099..c9900d57 100644 --- a/packages/core/src/state.ts +++ b/packages/core/src/state.ts @@ -13,7 +13,7 @@ export interface State { } } -const VALID_CHAR_REGEX = /[^a-zA-Z0-9_-]/g +const VALID_CHAR_REGEX = /[^a-zA-Z0-9 _-]/g const getComponentName = (filePath?: string): string => { if (!filePath) return 'SvgComponent'