Skip to content

Commit

Permalink
tests: fix tab selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
TorstenDittmann committed Jul 22, 2024
1 parent 717b80a commit 8325295
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/lib/components/secondaryTabsItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
{/if}
{:else}
<button
role="tab"
type="button"
class="secondary-tabs-button"
class:u-width-full-line={fullWidth}
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/components/dropTabsItem.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { vi } from 'vitest';
import { render, fireEvent } from '@testing-library/svelte';
import { SecondaryTabsItem } from '../../../src/lib/components';

test('shows button', () => {
test('shows tab', () => {
const { getByRole } = render(SecondaryTabsItem);

expect(getByRole('button')).toBeInTheDocument();
expect(getByRole('tab')).toBeInTheDocument();
});

test('shows link', () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/components/tab.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test('shows tab', () => {
test('shows tab - is selected', () => {
const { getByRole } = render(Tab, { selected: true });

expect(getByRole('tab')).toHaveClass('is-selected');
expect(getByRole('tab').querySelector('button')).toHaveClass('is-selected');
});

test('shows tab - is link', () => {
Expand All @@ -23,7 +23,7 @@ test('shows tab - is link', () => {

test('shows tab - on:click', async () => {
const { getByRole, component } = render(Tab);
const tab = getByRole('tab');
const tab = getByRole('tab').querySelector('button');
const callback = vi.fn();
component.$on('click', callback);

Expand Down

0 comments on commit 8325295

Please sign in to comment.