diff --git a/web/src/lib/components/album-page/album-description.spec.ts b/web/src/lib/components/album-page/album-description.spec.ts new file mode 100644 index 0000000000..1c069de2bc --- /dev/null +++ b/web/src/lib/components/album-page/album-description.spec.ts @@ -0,0 +1,18 @@ +import AlbumDescription from '$lib/components/album-page/album-description.svelte'; +import '@testing-library/jest-dom'; +import { render, screen } from '@testing-library/svelte'; +import { describe } from 'vitest'; + +describe('AlbumDescription component', () => { + it('shows an AutogrowTextarea component when isOwned is true', () => { + render(AlbumDescription, { isOwned: true, id: '', description: '' }); + const autogrowTextarea = screen.getByTestId('autogrow-textarea'); + expect(autogrowTextarea).toBeInTheDocument(); + }); + + it('does not show an AutogrowTextarea component when isOwned is false', () => { + render(AlbumDescription, { isOwned: false, id: '', description: '' }); + const autogrowTextarea = screen.queryByTestId('autogrow-textarea'); + expect(autogrowTextarea).not.toBeInTheDocument(); + }); +}); diff --git a/web/src/lib/components/album-page/album-description.svelte b/web/src/lib/components/album-page/album-description.svelte index 1d7add6883..23bcf8c95a 100644 --- a/web/src/lib/components/album-page/album-description.svelte +++ b/web/src/lib/components/album-page/album-description.svelte @@ -1,20 +1,13 @@ {#if isOwned} -