diff --git a/packages/core/package.json b/packages/core/package.json index c70f0c99..78b48dc7 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@viamrobotics/prime-core", - "version": "0.0.65", + "version": "0.0.66", "publishConfig": { "access": "public" }, diff --git a/packages/core/src/lib/__tests__/pill.spec.ts b/packages/core/src/lib/__tests__/pill.spec.ts index 14136e52..98a1d8ca 100644 --- a/packages/core/src/lib/__tests__/pill.spec.ts +++ b/packages/core/src/lib/__tests__/pill.spec.ts @@ -9,9 +9,9 @@ describe('Pill', () => { expect(screen.getByText('test')).toBeVisible(); }); - it('Renders a normal pill that is not readonly if no readonly attribute has been specified', () => { - render(Pill); - expect(screen.getByRole('button')).toBeVisible(); + it('Renders a removable pill', () => { + render(Pill, { value: 'test' }); + expect(screen.getByLabelText('Remove test')).toBeVisible(); }); it('Renders a pill that is readonly if a readonly attribute of true has been specified', () => { @@ -20,8 +20,8 @@ describe('Pill', () => { }); it('Renders a pill that is not readonly if a readonly attribute of false has been specified', () => { - render(Pill, { readonly: false }); - expect(screen.getByRole('button')).toBeVisible(); + render(Pill, { value: 'test', readonly: false }); + expect(screen.getByLabelText('Remove test')).toBeVisible(); }); it('Renders a normal pill if no disabled attribute has been specified', () => { @@ -46,6 +46,11 @@ describe('Pill', () => { ); }); + it('Renders a resource pill that is not removable if a removable attribute of true has not been specified', () => { + render(Pill, { variant: 'outlined', removable: false }); + expect(screen.queryByRole('button')).toBeNull(); + }); + it('Confirms default pill is clickable', async () => { const { component } = render(Pill); const onClick = vi.fn(); diff --git a/packages/core/src/lib/pill.svelte b/packages/core/src/lib/pill.svelte index d57b1680..5bbe30cb 100644 --- a/packages/core/src/lib/pill.svelte +++ b/packages/core/src/lib/pill.svelte @@ -10,20 +10,29 @@ For displaying a list of items.