Files
lucide/packages/shared/tests/toCamelCase.spec.ts
b6ed43d48c feat(packages): Added aria-hidden fallback for decorative icons to all packages (#3604)
* Add aria hidden to lucide package

* Add aria-hidden to astro package

* Add tests for shared package

* Fix test for props

* add aria prop to lucide-solid

* Add aria-hidden to lucide-vue-next

* Add aria-hidden prop to angular package

* Fix builds

* Add notice about aria-label in docs

* Format code

* Update packages/svelte/tests/Icon.spec.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update packages/lucide-svelte/tests/Icon.spec.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update packages/shared/src/utils/hasA11yProp.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Adjusted docs

* Fix import

* update tests

* test(shared): fix hasA11yProp unit test

* fix(packages/lucide-angular): fix hasA11yProp import path (non-relative import path will not get properly resolved by ng-packagr)

* Format code

* Adjust aria props to root element

* Format code

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Karsa <contact@karsa.org>
2026-01-20 15:55:02 +01:00

42 lines
1.3 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import { toCamelCase } from '../src/utils/toCamelCase';
describe('toCamelCase', () => {
it('should convert kebab-case to camelCase', () => {
expect(toCamelCase('hello-world')).toBe('helloWorld');
expect(toCamelCase('foo-bar-baz')).toBe('fooBarBaz');
});
it('should convert snake_case to camelCase', () => {
expect(toCamelCase('hello_world')).toBe('helloWorld');
expect(toCamelCase('foo_bar_baz')).toBe('fooBarBaz');
});
it('should convert space separated to camelCase', () => {
expect(toCamelCase('hello world')).toBe('helloWorld');
expect(toCamelCase('foo bar baz')).toBe('fooBarBaz');
});
it('should handle mixed separators', () => {
expect(toCamelCase('hello-world_foo bar')).toBe('helloWorldFooBar');
});
it('should lowercase the first character if uppercase', () => {
expect(toCamelCase('HelloWorld')).toBe('helloWorld');
expect(toCamelCase('Hello-World')).toBe('helloWorld');
});
it('should return the same string if already camelCase', () => {
expect(toCamelCase('alreadyCamelCase')).toBe('alreadyCamelCase');
});
it('should handle single word', () => {
expect(toCamelCase('word')).toBe('word');
expect(toCamelCase('Word')).toBe('word');
});
it('should handle empty string', () => {
expect(toCamelCase('')).toBe('');
});
});