Skip to content

Commit

Permalink
Merge pull request #5 from appwrite/tooltip
Browse files Browse the repository at this point in the history
feat: created tooltip component and test
  • Loading branch information
TorstenDittmann authored May 14, 2022
2 parents 4997d2c + c62f3ce commit 1cd3dfd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export { default as DropList } from './dropList.svelte';
export { default as DropListItem } from './dropListItem.svelte';
export { default as DropListLink } from './dropListLink.svelte';
export { default as Collapsible } from './collapsible.svelte';
export { default as Tooltip } from './tooltip.svelte';
export { default as Avatar } from './avatar.svelte';
export { default as SwitchBox } from './switchBox.svelte';
export { default as SwitchBoxes } from './switchBoxes.svelte';
Expand Down
11 changes: 11 additions & 0 deletions src/lib/components/tooltip.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script lang="ts">
export let icon = 'info';
export let aria = 'info';
</script>

<button class="tooltip" aria-label={aria}>
<span class={`icon-${icon}`} aria-hidden="true" />
<span class="tooltip-popup" role="tooltip">
<slot />
</span>
</button>
9 changes: 9 additions & 0 deletions tests/unit/components/tooltip.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import '@testing-library/jest-dom';
import { render } from '@testing-library/svelte';
import { Tooltip } from '../../../src/lib/components';

test('shows tooltip', () => {
const { getByRole } = render(Tooltip);

expect(getByRole('tooltip')).toBeInTheDocument();
});

1 comment on commit 1cd3dfd

@vercel
Copy link

@vercel vercel bot commented on 1cd3dfd May 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.