Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: button must have a spinner when progress true #189

Merged
merged 2 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions packages/frontend/src/lib/button/Button.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import '@testing-library/jest-dom/vitest';
import { test, expect } from 'vitest';
import { render, screen } from '@testing-library/svelte';
import Button from '/@/lib/button/Button.svelte';

test('Button inProgress must have a spinner', async () => {
// render the component
render(Button, { inProgress: true });

const svg = screen.getByRole('img');
expect(svg).toBeDefined();
});

test('Button no progress no icon do not have spinner', async () => {
// render the component
render(Button, { inProgress: false });

const svg = screen.queryByRole('img');
expect(svg).toBeNull();
});
2 changes: 1 addition & 1 deletion packages/frontend/src/lib/button/Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ $: {
aria-label="{$$props['aria-label']}"
on:click
disabled="{disabled || inProgress}">
{#if icon}
{#if icon || inProgress}
<div class="flex flex-row p-0 m-0 bg-transparent justify-center items-center space-x-[4px]">
{#if inProgress}
<Spinner size="1em" />
Expand Down
Loading