Skip to content

Commit

Permalink
test(web): add ActivityIndicator test
Browse files Browse the repository at this point in the history
  • Loading branch information
paularmstrong authored and blakeblackshear committed Feb 20, 2021
1 parent 50b42eb commit ddb6127
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions web/src/components/__tests__/ActivityIndicator.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { h } from 'preact';
import ActivityIndicator from '../ActivityIndicator';
import { render, screen } from '@testing-library/preact';

describe('ActivityIndicator', () => {
test('renders an ActivityIndicator with default size md', async () => {
render(<ActivityIndicator />);
expect(screen.getByLabelText('Loading…')).toMatchInlineSnapshot(`
<div
aria-label="Loading…"
class="w-full flex items-center justify-center"
>
<div
class="activityindicator ease-in rounded-full border-gray-200 text-blue-500 h-8 w-8 border-4 border-t-4"
/>
</div>
`);
});

test('renders an ActivityIndicator with size sm', async () => {
render(<ActivityIndicator size="sm" />);
expect(screen.getByLabelText('Loading…')).toMatchInlineSnapshot(`
<div
aria-label="Loading…"
class="w-full flex items-center justify-center"
>
<div
class="activityindicator ease-in rounded-full border-gray-200 text-blue-500 h-4 w-4 border-2 border-t-2"
/>
</div>
`);
});

test('renders an ActivityIndicator with size lg', async () => {
render(<ActivityIndicator size="lg" />);
expect(screen.getByLabelText('Loading…')).toMatchInlineSnapshot(`
<div
aria-label="Loading…"
class="w-full flex items-center justify-center"
>
<div
class="activityindicator ease-in rounded-full border-gray-200 text-blue-500 h-16 w-16 border-8 border-t-8"
/>
</div>
`);
});
});

0 comments on commit ddb6127

Please sign in to comment.