diff --git a/src/lib/components/Label/Label.spec.tsx b/src/lib/components/Label/Label.spec.tsx index b92ac9c61..3af4dc5cf 100644 --- a/src/lib/components/Label/Label.spec.tsx +++ b/src/lib/components/Label/Label.spec.tsx @@ -1,9 +1,10 @@ -import { render } from '@testing-library/react'; +import { render, screen } from '@testing-library/react'; import { HiGlobe, HiLockClosed } from 'react-icons/hi'; import { describe, expect, it } from 'vitest'; import { Button } from '../Button'; import { Checkbox } from '../Checkbox'; import { FileInput } from '../FileInput'; +import { Flowbite } from '../Flowbite'; import { Radio } from '../Radio'; import { RangeSlider } from '../RangeSlider'; import { Select } from '../Select'; @@ -30,9 +31,31 @@ describe.concurrent('Components / Label', () => { inputLabels.forEach((label) => expect(getByLabelText(label)).toHaveAccessibleName(label)); }); + + describe('Theme', () => { + it('should use `disabled` classes', () => { + const theme = { + label: { + root: { + disabled: 'opacity-50', + }, + }, + }; + + render( + + , + ); + + expect(label()).toHaveClass('opacity-50'); + }); + }); }); }); +const label = () => screen.getByTestId('flowbite-label'); + const TestForm = (): JSX.Element => (
diff --git a/src/lib/components/Label/Label.tsx b/src/lib/components/Label/Label.tsx index f20d30e6b..fd9ceecc1 100644 --- a/src/lib/components/Label/Label.tsx +++ b/src/lib/components/Label/Label.tsx @@ -40,7 +40,8 @@ export const Label: FC = ({ return (